From feccdcf8c89f44bd6a139200b6748daac0d39b1e Mon Sep 17 00:00:00 2001 From: DRC Date: Mon, 23 Feb 2015 19:19:40 +0000 Subject: [PATCH] Surround the usage of getenv() in the TurboJPEG API with #ifndef NO_GETENV so that developers can add -DNO_GETENV to the C flags when building for platforms that don't have getenv(). Currently this is known to be necessary when building for Windows Phone. git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.4.x@1537 632fc199-4ca6-4c93-a231-07263d6284db --- turbojpeg.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/turbojpeg.c b/turbojpeg.c index bc153da9..e8b156a0 100644 --- a/turbojpeg.c +++ b/turbojpeg.c @@ -206,6 +206,7 @@ static int setCompDefaults(struct jpeg_compress_struct *cinfo, cinfo->input_components=tjPixelSize[pixelFormat]; jpeg_set_defaults(cinfo); +#ifndef NO_GETENV if((env=getenv("TJ_OPTIMIZE"))!=NULL && strlen(env)>0 && !strcmp(env, "1")) cinfo->optimize_coding=TRUE; if((env=getenv("TJ_ARITHMETIC"))!=NULL && strlen(env)>0 && !strcmp(env, "1")) @@ -224,6 +225,7 @@ static int setCompDefaults(struct jpeg_compress_struct *cinfo, cinfo->restart_in_rows=temp; } } +#endif if(jpegQual>=0) { @@ -237,9 +239,11 @@ static int setCompDefaults(struct jpeg_compress_struct *cinfo, jpeg_set_colorspace(cinfo, JCS_YCCK); else jpeg_set_colorspace(cinfo, JCS_YCbCr); +#ifndef NO_GETENV if((env=getenv("TJ_PROGRESSIVE"))!=NULL && strlen(env)>0 && !strcmp(env, "1")) jpeg_simple_progression(cinfo); +#endif cinfo->comp_info[0].h_samp_factor=tjMCUWidth[subsamp]/8; cinfo->comp_info[1].h_samp_factor=1;