7d3e230b4b59f6a640cbd061c82a1663781e765e tdreszer Wed Dec 21 14:43:14 2011 -0800 Fixed bug in custom tracks bigBed item click. diff --git src/hg/hgc/hgc.c src/hg/hgc/hgc.c index 2951875..add052f 100644 --- src/hg/hgc/hgc.c +++ src/hg/hgc/hgc.c @@ -1406,31 +1406,34 @@ struct sqlConnection *conn = hAllocConnTrack(database, tdb); struct asObject *as = asForTdb(conn, tdb); hFreeConn(&conn); if (as == NULL) return 0; #endif///ndef EXTRA_FIELDS_SUPPORT // We are trying to print extra fields so we need to figure out how many fields to skip int start = 0; char *type = cloneString(tdb->type); char *word = nextWord(&type); if (word && (sameWord(word,"bed") || sameWord(word,"bigBed"))) { if (NULL != (word = nextWord(&type))) start = sqlUnsigned(word); - #ifdef EXTRA_FIELDS_SUPPORT + #ifndef EXTRA_FIELDS_SUPPORT + else // custom beds and bigBeds may not have full type "begBed 9 +" + start = max(0,slCount(as->columnList) - fieldCount); + #else///ifdef EXTRA_FIELDS_SUPPORT // extraFields do not have to define all fields if (fieldCount > slCount(extras)) start = 0; #endif///def EXTRA_FIELDS_SUPPORT } int count = 0; #ifdef EXTRA_FIELDS_SUPPORT struct extraField *col = extras; #else///ifndef EXTRA_FIELDS_SUPPORT struct asColumn *col = as->columnList; #endif///ndef EXTRA_FIELDS_SUPPORT for(;col != NULL && count < fieldCount;col=col->next) { if (start > 0) // skip past already known fields { @@ -1457,37 +1460,43 @@ printf("<td>%lld</td></tr>\n", valInt); } else if (col->type == ftFloat) { double valDouble = sqlDouble(fields[ix]); printf("<td>%g</td></tr>\n", valDouble); } #else///ifndef EXTRA_FIELDS_SUPPORT printf("<tr><td><B>%s:</B></td>", col->comment); if (col->isList || col->isArray || col->lowType->stringy) { printf("<td>%s</td></tr>\n", fields[ix]); } else if (asTypesIsInt(col->lowType->type)) { - long long valInt = sqlLongLong(fields[ix]); - printf("<td>%lld</td></tr>\n", valInt); + long valInt = strtol(fields[ix],NULL,10); + if (errno == 0 && valInt != 0) + printf("<td>%ld</td></tr>\n", valInt); + else + printf("<td>%s</td></tr>\n", fields[ix]);// decided not to print error } else if (asTypesIsFloating(col->lowType->type)) { - double valDouble = sqlDouble(fields[ix]); + double valDouble = strtod(fields[ix],NULL); + if (errno == 0 && valDouble != 0) printf("<td>%g</td></tr>\n", valDouble); + else + printf("<td>%s</td></tr>\n", fields[ix]);// decided not to print error } #endif///ndef EXTRA_FIELDS_SUPPORT else { printf("<td>%s</td></tr>\n", fields[ix]); } } #ifdef EXTRA_FIELDS_SUPPORT extraFieldsFree(&extras); #else///ifndef EXTRA_FIELDS_SUPPORT asObjectFree(&as); #endif///ndef EXTRA_FIELDS_SUPPORT if(count > 0) printf("</table>\n");