TJBench: Fix segfault on Android
For whatever reason, the "write" global variable in tjbench.c was overriding the linkage with the write() system function. This may have affected other platforms as well but was not known to.
This commit is contained in:
@@ -46,7 +46,7 @@
|
|||||||
#define _throwbmp(m) _throw(m, bmpgeterr())
|
#define _throwbmp(m) _throw(m, bmpgeterr())
|
||||||
|
|
||||||
int flags=TJFLAG_NOREALLOC, componly=0, decomponly=0, doyuv=0, quiet=0,
|
int flags=TJFLAG_NOREALLOC, componly=0, decomponly=0, doyuv=0, quiet=0,
|
||||||
dotile=0, pf=TJPF_BGR, yuvpad=1, warmup=1, write=1;
|
dotile=0, pf=TJPF_BGR, yuvpad=1, warmup=1, dowrite=1;
|
||||||
char *ext="ppm";
|
char *ext="ppm";
|
||||||
const char *pixFormatStr[TJ_NUMPF]=
|
const char *pixFormatStr[TJ_NUMPF]=
|
||||||
{
|
{
|
||||||
@@ -214,7 +214,7 @@ int decomp(unsigned char *srcbuf, unsigned char **jpegbuf,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!write) goto bailout;
|
if (!dowrite) goto bailout;
|
||||||
|
|
||||||
if(sf.num!=1 || sf.denom!=1)
|
if(sf.num!=1 || sf.denom!=1)
|
||||||
snprintf(sizestr, 20, "%d_%d", sf.num, sf.denom);
|
snprintf(sizestr, 20, "%d_%d", sf.num, sf.denom);
|
||||||
@@ -425,7 +425,7 @@ int fullTest(unsigned char *srcbuf, int w, int h, int subsamp, int jpegqual,
|
|||||||
printf(" Output bit stream: %f Megabits/sec\n",
|
printf(" Output bit stream: %f Megabits/sec\n",
|
||||||
(double)totaljpegsize*8./1000000.*(double)iter/elapsed);
|
(double)totaljpegsize*8./1000000.*(double)iter/elapsed);
|
||||||
}
|
}
|
||||||
if(tilew==w && tileh==h && write)
|
if(tilew==w && tileh==h && dowrite)
|
||||||
{
|
{
|
||||||
snprintf(tempstr, 1024, "%s_%s_Q%d.jpg", filename, subName[subsamp],
|
snprintf(tempstr, 1024, "%s_%s_Q%d.jpg", filename, subName[subsamp],
|
||||||
jpegqual);
|
jpegqual);
|
||||||
@@ -911,7 +911,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!strcasecmp(argv[i], "-componly")) componly=1;
|
if(!strcasecmp(argv[i], "-componly")) componly=1;
|
||||||
if(!strcasecmp(argv[i], "-nowrite")) write=0;
|
if(!strcasecmp(argv[i], "-nowrite")) dowrite=0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user