e685265dd1b666acaab2bc076c141c368fb4be66 hiram Thu Oct 15 11:36:17 2015 -0700 fixup gcc warnings for -Wunused-but-set-variable refs #16121 diff --git src/hg/hgTracks/wigTrack.c src/hg/hgTracks/wigTrack.c index dbdfa5c..474f062 100644 --- src/hg/hgTracks/wigTrack.c +++ src/hg/hgTracks/wigTrack.c @@ -399,31 +399,30 @@ * rows will need to be loaded at any one time. */ { struct sqlConnection *conn = NULL ; // if this is a custom track we don't need an SQL connection to the database if (!(isCustomTrack(tg->table) && tg->customPt)) conn = hAllocConn(database); struct sqlResult *sr; char **row; int rowOffset; struct wiggle wiggle; struct wigItem *wiList = NULL; char *whereNULL = NULL; int itemsLoaded = 0; -char *previousFileName; struct hash *spans = NULL; /* Spans encountered during load */ /* Check our scale from the global variables that exist in * hgTracks.c - This can give us a guide about which rows to load. * If the scale is more than 1000 bases per pixel, we can try loading * only those rows with Span >= 1000 to see if an appropriate zoom * level exists. */ int basesPerPixel = (int)((double)(winEnd - winStart)/(double)insideWidth); char *span1K = "Span >= 1000 limit 1"; char *spanOver1K = "Span >= 1000"; char whereSpan[SMALLBUF]; int spanMinimum = 1; char *dbTableName = NULL; struct trackDb *tdb = NULL; int loadStart = winStart, loadEnd = winEnd; @@ -506,31 +505,30 @@ { sr = hRangeQuery(conn, dbTableName, chromName, loadStart, loadEnd, whereNULL, &rowOffset); } /* Allocate trackSpans one time only */ if (! trackSpans) trackSpans = newHash(4); /* Each instance of this LoadItems will create a new spans hash * It will be the value included in the trackSpans hash */ spans = newHash(4); /* Each row read will be turned into an instance of a wigItem * A growing list of wigItems will be the items list to return */ -previousFileName = ""; itemsLoaded = 0; while ((row = sqlNextRow(sr)) != NULL) { struct wigItem *wi; ++itemsLoaded; wiggleStaticLoad(row + rowOffset, &wiggle); AllocVar(wi); wigSetItemData(tg, wi, &wiggle, spans); slAddHead(&wiList, wi); } sqlFreeResult(&sr); hFreeConn(&conn); slReverse(&wiList); @@ -1208,43 +1206,38 @@ /* Set up to draw on hvg if no other destination set already */ { if (tg->wigGraphOutput == NULL) tg->wigGraphOutput = wigGraphOutputSolid(xOff, yOff, hvg); } void wigDrawPredraw(struct track *tg, int seqStart, int seqEnd, struct hvGfx *hvg, int xOff, int yOff, int width, MgFont *font, Color color, enum trackVisibility vis, struct preDrawContainer *preContainer, int preDrawZero, int preDrawSize, double *retGraphUpperLimit, double *retGraphLowerLimit) /* Draw once we've figured out predraw (numerical values to graph) we draw it here. * This code is shared by wig, bigWig, and bedGraph drawers. */ { wigTrackSetGraphOutputDefault(tg, xOff, yOff, hvg); -enum wiggleYLineMarkEnum yLineOnOff; -double yLineMark; /* determined from data */ double graphUpperLimit=0; /* scaling choice will set these */ double graphLowerLimit=0; /* scaling choice will set these */ double graphRange=0; /* scaling choice will set these */ double epsilon; /* range of data in one pixel */ struct wigCartOptions *wigCart = (struct wigCartOptions *) tg->wigCartData; -yLineOnOff = wigCart->yLineOnOff; -yLineMark = wigCart->yLineMark; - /* width - width of drawing window in pixels * pixelsPerBase - pixels per base * basesPerPixel - calculated as 1.0/pixelsPerBase */ struct preDrawElement *preDraw = preContainer->preDraw; if (preContainer->smoothingDone == FALSE) { preDrawWindowFunction(preDraw, preDrawSize, wigCart->windowingFunction, wigCart->transformFunc, wigCart->doNegative); preDrawSmoothing(preDraw, preDrawSize, wigCart->smoothingWindow); graphRange = preDrawAutoScale(preDraw, preDrawZero, width, wigCart->autoScale, wigCart->windowingFunction, &preContainer->graphUpperLimit, &preContainer->graphLowerLimit, @@ -1319,31 +1312,30 @@ * basesPerPixel - calculated as 1.0/pixelsPerBase */ itemCount = 0; /* Allocate predraw and save it and related info in the track. */ struct preDrawContainer *pre = tg->preDrawContainer = initPreDrawContainer(width); struct preDrawElement *preDraw = pre->preDraw; /* to accumulate everything in prep for draw */ int preDrawZero = pre->preDrawZero; /* location in preDraw where screen starts */ int preDrawSize = pre->preDrawSize; /* size of preDraw array */ usingDataSpan = wigFindSpan(tg, basesPerPixel); /* walk through all the data and prepare the preDraw array */ for (wi = tg->items; wi != NULL; wi = wi->next) { - size_t bytesRead; /* to check fread being OK */ int dataOffset = 0; /* within data block during drawing */ ++itemCount; /* Now that we know what Span to draw, see if this item should be * drawn at all. */ if (usingDataSpan == wi->span) { /* Check our data file, see if we need to open a new one */ if (differentStringNullOk(currentFile,"")) { if (differentStringNullOk(currentFile,wi->file)) { @@ -1389,31 +1381,31 @@ x1 = round(x1d); double x2d = (double)((wi->start+(wi->count * usingDataSpan))-seqStart) * pixelsPerBase; x2 = round(x2d); /* this used to be if (x2 > x1) which often caused reading of blocks * when they were merely x2 = x1 + 1 due to rounding errors as * they became integers. This double comparison for something over * 0.5 will account for rounding errors that are really small, but * still handle a slipping window size as it walks across the screen */ if ((x2d - x1d) > 0.5) { unsigned char *readData; /* the bytes read in from the file */ udcSeek(wibFH, wi->offset); readData = (unsigned char *) needMem((size_t) (wi->count + 1)); - bytesRead = udcRead(wibFH, readData, + udcRead(wibFH, readData, (size_t) wi->count * (size_t) sizeof(unsigned char)); /* walk through all the data in this block */ for (dataOffset = 0; dataOffset < wi->count; ++dataOffset) { unsigned char datum = readData[dataOffset]; if (datum != WIG_NO_DATA) { x1 = ((wi->start-seqStart) + (dataOffset * usingDataSpan)) * pixelsPerBase; x2 = x1 + (usingDataSpan * pixelsPerBase); for (i = x1; i <= x2; ++i) { int xCoord = preDrawZero + i; if ((xCoord >= 0) && (xCoord < preDrawSize)) { double dataValue =