Ian,

Thanks for reporting this.  The scope of the problem was larger than garmin training center so I applied a more general fix than the one you suggested.  It should be fixed in https://code.google.com/p/gpsbabel/source/detail?r=4846.  The problem was recently introduce, the first release with the bug was 1.5.0.

Steve

On 6/6/2014 3:52 AM, Ian Grant wrote:
Hi,

I have a small fix to offer for the TCX format.
I noticed my TCX output files were always written with sport="Biking" despite me selecting Running.

I think this block in gtrnctr.cc is to blame:

  if (opt_sport) {
    for (i = 0; i < MAX_SPORTS; i++) {
      if (0 == case_ignore_strncmp(opt_sport, gtc_sportlist[i], 2)) {
        gtc_sport = i;
        break;
      }
    }
  }

The case_ignore_strncmp seems to compare only the first two characters of the user's selection (opt_sport) to the full string from list of defined sports, therefore the sport is never matched and always defaults to Biking.
I changed that line to compare the whole string:

 if (0 == case_ignore_strcmp(opt_sport, gtc_sportlist[i])) {

Which fixes it for me. Surprised no-one else seems to mention it when I tried googling. Hopefully it can be easily incorporated into the source code.

Thanks,

Ian


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their 
applications. Written by three acclaimed leaders in the field, 
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech


_______________________________________________
Gpsbabel-code mailing list  http://www.gpsbabel.org
Gpsbabel-code@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gpsbabel-code