3689ca52fbed49180bf658ef076c70a5ce2889cc
braney
  Wed Sep 23 17:51:41 2015 -0700
change a constant in the bigBed code that wasn't quite right and
resulted in an integer overflow bug.

diff --git src/lib/bbiWrite.c src/lib/bbiWrite.c
index 2f27699..feb178c 100644
--- src/lib/bbiWrite.c
+++ src/lib/bbiWrite.c
@@ -251,31 +251,31 @@
 /* Fill in resScales with amount to zoom at each level, and zero out resSizes based
  * on average span. Returns the number of zoom levels we actually will use. */
 {
 int resTryCount = bbiMaxZoomLevels, resTry;
 int resIncrement = bbiResIncrement;
 int minZoom = 10;
 int res = aveSize;
 if (res < minZoom)
     res = minZoom;
 for (resTry = 0; resTry < resTryCount; ++resTry)
     {
     resSizes[resTry] = 0;
     resScales[resTry] = res;
     // if aveSize is large, then the initial value of res is large, and we
     // and we cannot do all 10 levels without overflowing res* integers and other related variables.
-    if (res > 1000000000) 
+    if (res > INT_MAX/bbiResIncrement) 
 	{
 	resTryCount = resTry + 1;  
 	verbose(2, "resTryCount reduced from 10 to %d\n", resTryCount);
 	break;
 	}
     res *= resIncrement;
     }
 return resTryCount;
 }
 
 int bbiWriteZoomLevels(
     struct lineFile *lf,    /* Input file. */
     FILE *f,		    /* Output. */
     int blockSize,	    /* Size of index block */
     int itemsPerSlot,	    /* Number of data points bundled at lowest level. */