Merge branch 'main' into dev
This commit is contained in:
@@ -818,10 +818,8 @@ if(CPU_TYPE STREQUAL "x86_64" OR CPU_TYPE STREQUAL "i386")
|
|||||||
set(DEFAULT_FLOATTEST sse)
|
set(DEFAULT_FLOATTEST sse)
|
||||||
elseif(CPU_TYPE STREQUAL "x86_64")
|
elseif(CPU_TYPE STREQUAL "x86_64")
|
||||||
set(DEFAULT_FLOATTEST no-fp-contract)
|
set(DEFAULT_FLOATTEST no-fp-contract)
|
||||||
elseif(CPU_TYPE STREQUAL "i386" AND MSVC)
|
|
||||||
set(DEFAULT_FLOATTEST msvc)
|
|
||||||
# else we can't really set an intelligent default for i386. The appropriate
|
# else we can't really set an intelligent default for i386. The appropriate
|
||||||
# value could be 387, no-fp-contract, or fp-contract, depending on the
|
# value could be no-fp-contract, fp-contract, 387, or msvc, depending on the
|
||||||
# compiler and compiler options. We leave it to the user to set FLOATTEST
|
# compiler and compiler options. We leave it to the user to set FLOATTEST
|
||||||
# manually.
|
# manually.
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -13,6 +13,15 @@ more details.) The `WITH_12BIT` CMake variable can be used to disable
|
|||||||
12-bit-per-component JPEG support.
|
12-bit-per-component JPEG support.
|
||||||
|
|
||||||
|
|
||||||
|
2.1.4
|
||||||
|
=====
|
||||||
|
|
||||||
|
### Significant changes relative to 2.1.3
|
||||||
|
|
||||||
|
1. Fixed a regression introduced in 2.1.3 that caused build failures with
|
||||||
|
Visual Studio 2010.
|
||||||
|
|
||||||
|
|
||||||
2.1.3
|
2.1.3
|
||||||
=====
|
=====
|
||||||
|
|
||||||
|
|||||||
@@ -113,13 +113,16 @@ configure_file(win/${INST_ID}/projectTargets-release.cmake.in
|
|||||||
if(WITH_JAVA)
|
if(WITH_JAVA)
|
||||||
set(JAVA_DEPEND turbojpeg-java)
|
set(JAVA_DEPEND turbojpeg-java)
|
||||||
endif()
|
endif()
|
||||||
|
if(WITH_TURBOJPEG)
|
||||||
|
set(TURBOJPEG_DEPEND turbojpeg turbojpeg-static tjbench)
|
||||||
|
endif()
|
||||||
if(WITH_12BIT)
|
if(WITH_12BIT)
|
||||||
set(12BIT_DEPEND jpeg12 jpeg12-static cjpeg12 djpeg12 jpeg12tran)
|
set(12BIT_DEPEND jpeg12 jpeg12-static cjpeg12 djpeg12 jpeg12tran)
|
||||||
endif()
|
endif()
|
||||||
add_custom_target(installer
|
add_custom_target(installer
|
||||||
makensis -nocd ${INST_DEFS} installer.nsi
|
makensis -nocd ${INST_DEFS} installer.nsi
|
||||||
DEPENDS jpeg jpeg-static turbojpeg turbojpeg-static rdjpgcom wrjpgcom
|
DEPENDS jpeg jpeg-static rdjpgcom wrjpgcom cjpeg djpeg jpegtran
|
||||||
cjpeg djpeg jpegtran tjbench ${JAVA_DEPEND} ${12BIT_DEPEND}
|
${JAVA_DEPEND} ${TURBOJPEG_DEPEND} ${12BIT_DEPEND}
|
||||||
SOURCES installer.nsi)
|
SOURCES installer.nsi)
|
||||||
|
|
||||||
endif() # WIN32
|
endif() # WIN32
|
||||||
|
|||||||
4
jerror.c
4
jerror.c
@@ -190,9 +190,9 @@ format_message(j_common_ptr cinfo, char *buffer)
|
|||||||
|
|
||||||
/* Format the message into the passed buffer */
|
/* Format the message into the passed buffer */
|
||||||
if (isstring)
|
if (isstring)
|
||||||
snprintf(buffer, JMSG_LENGTH_MAX, msgtext, err->msg_parm.s);
|
SNPRINTF(buffer, JMSG_LENGTH_MAX, msgtext, err->msg_parm.s);
|
||||||
else
|
else
|
||||||
snprintf(buffer, JMSG_LENGTH_MAX, msgtext,
|
SNPRINTF(buffer, JMSG_LENGTH_MAX, msgtext,
|
||||||
err->msg_parm.i[0], err->msg_parm.i[1],
|
err->msg_parm.i[0], err->msg_parm.i[1],
|
||||||
err->msg_parm.i[2], err->msg_parm.i[3],
|
err->msg_parm.i[2], err->msg_parm.i[3],
|
||||||
err->msg_parm.i[4], err->msg_parm.i[5],
|
err->msg_parm.i[4], err->msg_parm.i[5],
|
||||||
|
|||||||
12
jinclude.h
12
jinclude.h
@@ -45,6 +45,18 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
|
||||||
|
#define SNPRINTF(str, n, format, ...) \
|
||||||
|
_snprintf_s(str, n, _TRUNCATE, format, ##__VA_ARGS__)
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#define SNPRINTF snprintf
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifndef NO_GETENV
|
#ifndef NO_GETENV
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "jinclude.h"
|
#include "jinclude.h"
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
|
||||||
#define CHECK_VALUE(actual, expected, desc) \
|
#define CHECK_VALUE(actual, expected, desc) \
|
||||||
|
|||||||
24
tjbench.c
24
tjbench.c
@@ -107,7 +107,7 @@ static char *formatName(int subsamp, int cs, char *buf)
|
|||||||
if (cs == TJCS_YCbCr)
|
if (cs == TJCS_YCbCr)
|
||||||
return (char *)subNameLong[subsamp];
|
return (char *)subNameLong[subsamp];
|
||||||
else if (cs == TJCS_YCCK || cs == TJCS_CMYK) {
|
else if (cs == TJCS_YCCK || cs == TJCS_CMYK) {
|
||||||
snprintf(buf, 80, "%s %s", csName[cs], subNameLong[subsamp]);
|
SNPRINTF(buf, 80, "%s %s", csName[cs], subNameLong[subsamp]);
|
||||||
return buf;
|
return buf;
|
||||||
} else
|
} else
|
||||||
return (char *)csName[cs];
|
return (char *)csName[cs];
|
||||||
@@ -120,10 +120,10 @@ static char *sigfig(double val, int figs, char *buf, int len)
|
|||||||
int digitsAfterDecimal = figs - (int)ceil(log10(fabs(val)));
|
int digitsAfterDecimal = figs - (int)ceil(log10(fabs(val)));
|
||||||
|
|
||||||
if (digitsAfterDecimal < 1)
|
if (digitsAfterDecimal < 1)
|
||||||
snprintf(format, 80, "%%.0f");
|
SNPRINTF(format, 80, "%%.0f");
|
||||||
else
|
else
|
||||||
snprintf(format, 80, "%%.%df", digitsAfterDecimal);
|
SNPRINTF(format, 80, "%%.%df", digitsAfterDecimal);
|
||||||
snprintf(buf, len, format, val);
|
SNPRINTF(buf, len, format, val);
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,7 +160,7 @@ static int decomp(unsigned char *srcBuf, unsigned char **jpegBuf,
|
|||||||
unsigned char *dstPtr, *dstPtr2, *yuvBuf = NULL;
|
unsigned char *dstPtr, *dstPtr2, *yuvBuf = NULL;
|
||||||
|
|
||||||
if (jpegQual > 0) {
|
if (jpegQual > 0) {
|
||||||
snprintf(qualStr, 13, "_Q%d", jpegQual);
|
SNPRINTF(qualStr, 13, "_Q%d", jpegQual);
|
||||||
qualStr[12] = 0;
|
qualStr[12] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -262,20 +262,20 @@ static int decomp(unsigned char *srcBuf, unsigned char **jpegBuf,
|
|||||||
if (!doWrite) goto bailout;
|
if (!doWrite) goto bailout;
|
||||||
|
|
||||||
if (sf.num != 1 || sf.denom != 1)
|
if (sf.num != 1 || sf.denom != 1)
|
||||||
snprintf(sizeStr, 24, "%d_%d", sf.num, sf.denom);
|
SNPRINTF(sizeStr, 24, "%d_%d", sf.num, sf.denom);
|
||||||
else if (tilew != w || tileh != h)
|
else if (tilew != w || tileh != h)
|
||||||
snprintf(sizeStr, 24, "%dx%d", tilew, tileh);
|
SNPRINTF(sizeStr, 24, "%dx%d", tilew, tileh);
|
||||||
else snprintf(sizeStr, 24, "full");
|
else SNPRINTF(sizeStr, 24, "full");
|
||||||
if (decompOnly)
|
if (decompOnly)
|
||||||
snprintf(tempStr, 1024, "%s_%s.%s", fileName, sizeStr, ext);
|
SNPRINTF(tempStr, 1024, "%s_%s.%s", fileName, sizeStr, ext);
|
||||||
else
|
else
|
||||||
snprintf(tempStr, 1024, "%s_%s%s_%s.%s", fileName, subName[subsamp],
|
SNPRINTF(tempStr, 1024, "%s_%s%s_%s.%s", fileName, subName[subsamp],
|
||||||
qualStr, sizeStr, ext);
|
qualStr, sizeStr, ext);
|
||||||
|
|
||||||
if (tjSaveImage(tempStr, dstBuf, scaledw, 0, scaledh, pf, flags) == -1)
|
if (tjSaveImage(tempStr, dstBuf, scaledw, 0, scaledh, pf, flags) == -1)
|
||||||
THROW_TJG("saving bitmap");
|
THROW_TJG("saving bitmap");
|
||||||
ptr = strrchr(tempStr, '.');
|
ptr = strrchr(tempStr, '.');
|
||||||
snprintf(ptr, 1024 - (ptr - tempStr), "-err.%s", ext);
|
SNPRINTF(ptr, 1024 - (ptr - tempStr), "-err.%s", ext);
|
||||||
if (srcBuf && sf.num == 1 && sf.denom == 1) {
|
if (srcBuf && sf.num == 1 && sf.denom == 1) {
|
||||||
if (!quiet) printf("Compression error written to %s.\n", tempStr);
|
if (!quiet) printf("Compression error written to %s.\n", tempStr);
|
||||||
if (subsamp == TJ_GRAYSCALE) {
|
if (subsamp == TJ_GRAYSCALE) {
|
||||||
@@ -478,7 +478,7 @@ static int fullTest(unsigned char *srcBuf, int w, int h, int subsamp,
|
|||||||
(double)totalJpegSize * 8. / 1000000. * (double)iter / elapsed);
|
(double)totalJpegSize * 8. / 1000000. * (double)iter / elapsed);
|
||||||
}
|
}
|
||||||
if (tilew == w && tileh == h && doWrite) {
|
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);
|
||||||
if ((file = fopen(tempStr, "wb")) == NULL)
|
if ((file = fopen(tempStr, "wb")) == NULL)
|
||||||
THROW_UNIX("opening reference image");
|
THROW_UNIX("opening reference image");
|
||||||
|
|||||||
@@ -409,7 +409,7 @@ static void compTest(tjhandle handle, unsigned char **dstBuf,
|
|||||||
jpegQual, flags));
|
jpegQual, flags));
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(tempStr, 1024, "%s_enc_%s_%s_%s_Q%d.jpg", basename, pfStr, buStr,
|
SNPRINTF(tempStr, 1024, "%s_enc_%s_%s_%s_Q%d.jpg", basename, pfStr, buStr,
|
||||||
subName[subsamp], jpegQual);
|
subName[subsamp], jpegQual);
|
||||||
writeJPEG(*dstBuf, *dstSize, tempStr);
|
writeJPEG(*dstBuf, *dstSize, tempStr);
|
||||||
printf("Done.\n Result in %s\n", tempStr);
|
printf("Done.\n Result in %s\n", tempStr);
|
||||||
@@ -782,7 +782,7 @@ static int doBmpTest(const char *ext, int width, int align, int height, int pf,
|
|||||||
THROW("Could not allocate memory");
|
THROW("Could not allocate memory");
|
||||||
initBitmap(buf, width, pitch, height, pf, flags);
|
initBitmap(buf, width, pitch, height, pf, flags);
|
||||||
|
|
||||||
snprintf(filename, 80, "test_bmp_%s_%d_%s.%s", pixFormatStr[pf], align,
|
SNPRINTF(filename, 80, "test_bmp_%s_%d_%s.%s", pixFormatStr[pf], align,
|
||||||
(flags & TJFLAG_BOTTOMUP) ? "bu" : "td", ext);
|
(flags & TJFLAG_BOTTOMUP) ? "bu" : "td", ext);
|
||||||
TRY_TJ(tjSaveImage(filename, buf, width, pitch, height, pf, flags));
|
TRY_TJ(tjSaveImage(filename, buf, width, pitch, height, pf, flags));
|
||||||
md5sum = MD5File(filename, md5buf);
|
md5sum = MD5File(filename, md5buf);
|
||||||
|
|||||||
9
tjutil.h
9
tjutil.h
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C)2011 D. R. Commander. All Rights Reserved.
|
* Copyright (C)2011, 2022 D. R. Commander. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
@@ -31,6 +31,13 @@
|
|||||||
#define strncasecmp strnicmp
|
#define strncasecmp strnicmp
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#define SNPRINTF(str, n, format, ...) \
|
||||||
|
_snprintf_s(str, n, _TRUNCATE, format, ##__VA_ARGS__)
|
||||||
|
#else
|
||||||
|
#define SNPRINTF snprintf
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef min
|
#ifndef min
|
||||||
#define min(a, b) ((a) < (b) ? (a) : (b))
|
#define min(a, b) ((a) < (b) ? (a) : (b))
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
34
turbojpeg.c
34
turbojpeg.c
@@ -126,9 +126,9 @@ static void my_progress_monitor(j_common_ptr dinfo)
|
|||||||
int scan_no = ((j_decompress_ptr)dinfo)->input_scan_number;
|
int scan_no = ((j_decompress_ptr)dinfo)->input_scan_number;
|
||||||
|
|
||||||
if (scan_no > 500) {
|
if (scan_no > 500) {
|
||||||
snprintf(myprog->this->errStr, JMSG_LENGTH_MAX,
|
SNPRINTF(myprog->this->errStr, JMSG_LENGTH_MAX,
|
||||||
"Progressive JPEG image has more than 500 scans");
|
"Progressive JPEG image has more than 500 scans");
|
||||||
snprintf(errStr, JMSG_LENGTH_MAX,
|
SNPRINTF(errStr, JMSG_LENGTH_MAX,
|
||||||
"Progressive JPEG image has more than 500 scans");
|
"Progressive JPEG image has more than 500 scans");
|
||||||
myprog->this->isInstanceError = TRUE;
|
myprog->this->isInstanceError = TRUE;
|
||||||
myerr->warning = FALSE;
|
myerr->warning = FALSE;
|
||||||
@@ -191,24 +191,24 @@ static int cs2pf[JPEG_NUMCS] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#define THROWG(m) { \
|
#define THROWG(m) { \
|
||||||
snprintf(errStr, JMSG_LENGTH_MAX, "%s", m); \
|
SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s", m); \
|
||||||
retval = -1; goto bailout; \
|
retval = -1; goto bailout; \
|
||||||
}
|
}
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#define THROW_UNIX(m) { \
|
#define THROW_UNIX(m) { \
|
||||||
char strerrorBuf[80] = { 0 }; \
|
char strerrorBuf[80] = { 0 }; \
|
||||||
strerror_s(strerrorBuf, 80, errno); \
|
strerror_s(strerrorBuf, 80, errno); \
|
||||||
snprintf(errStr, JMSG_LENGTH_MAX, "%s\n%s", m, strerrorBuf); \
|
SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s\n%s", m, strerrorBuf); \
|
||||||
retval = -1; goto bailout; \
|
retval = -1; goto bailout; \
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#define THROW_UNIX(m) { \
|
#define THROW_UNIX(m) { \
|
||||||
snprintf(errStr, JMSG_LENGTH_MAX, "%s\n%s", m, strerror(errno)); \
|
SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s\n%s", m, strerror(errno)); \
|
||||||
retval = -1; goto bailout; \
|
retval = -1; goto bailout; \
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#define THROW(m) { \
|
#define THROW(m) { \
|
||||||
snprintf(this->errStr, JMSG_LENGTH_MAX, "%s", m); \
|
SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s", m); \
|
||||||
this->isInstanceError = TRUE; THROWG(m) \
|
this->isInstanceError = TRUE; THROWG(m) \
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -223,7 +223,7 @@ static int cs2pf[JPEG_NUMCS] = {
|
|||||||
j_decompress_ptr dinfo = NULL; \
|
j_decompress_ptr dinfo = NULL; \
|
||||||
\
|
\
|
||||||
if (!this) { \
|
if (!this) { \
|
||||||
snprintf(errStr, JMSG_LENGTH_MAX, "Invalid handle"); \
|
SNPRINTF(errStr, JMSG_LENGTH_MAX, "Invalid handle"); \
|
||||||
return -1; \
|
return -1; \
|
||||||
} \
|
} \
|
||||||
cinfo = &this->cinfo; dinfo = &this->dinfo; \
|
cinfo = &this->cinfo; dinfo = &this->dinfo; \
|
||||||
@@ -235,7 +235,7 @@ static int cs2pf[JPEG_NUMCS] = {
|
|||||||
j_compress_ptr cinfo = NULL; \
|
j_compress_ptr cinfo = NULL; \
|
||||||
\
|
\
|
||||||
if (!this) { \
|
if (!this) { \
|
||||||
snprintf(errStr, JMSG_LENGTH_MAX, "Invalid handle"); \
|
SNPRINTF(errStr, JMSG_LENGTH_MAX, "Invalid handle"); \
|
||||||
return -1; \
|
return -1; \
|
||||||
} \
|
} \
|
||||||
cinfo = &this->cinfo; \
|
cinfo = &this->cinfo; \
|
||||||
@@ -247,7 +247,7 @@ static int cs2pf[JPEG_NUMCS] = {
|
|||||||
j_decompress_ptr dinfo = NULL; \
|
j_decompress_ptr dinfo = NULL; \
|
||||||
\
|
\
|
||||||
if (!this) { \
|
if (!this) { \
|
||||||
snprintf(errStr, JMSG_LENGTH_MAX, "Invalid handle"); \
|
SNPRINTF(errStr, JMSG_LENGTH_MAX, "Invalid handle"); \
|
||||||
return -1; \
|
return -1; \
|
||||||
} \
|
} \
|
||||||
dinfo = &this->dinfo; \
|
dinfo = &this->dinfo; \
|
||||||
@@ -519,12 +519,12 @@ DLLEXPORT tjhandle tjInitCompress(void)
|
|||||||
tjinstance *this = NULL;
|
tjinstance *this = NULL;
|
||||||
|
|
||||||
if ((this = (tjinstance *)malloc(sizeof(tjinstance))) == NULL) {
|
if ((this = (tjinstance *)malloc(sizeof(tjinstance))) == NULL) {
|
||||||
snprintf(errStr, JMSG_LENGTH_MAX,
|
SNPRINTF(errStr, JMSG_LENGTH_MAX,
|
||||||
"tjInitCompress(): Memory allocation failure");
|
"tjInitCompress(): Memory allocation failure");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
memset(this, 0, sizeof(tjinstance));
|
memset(this, 0, sizeof(tjinstance));
|
||||||
snprintf(this->errStr, JMSG_LENGTH_MAX, "No error");
|
SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "No error");
|
||||||
return _tjInitCompress(this);
|
return _tjInitCompress(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1193,12 +1193,12 @@ DLLEXPORT tjhandle tjInitDecompress(void)
|
|||||||
tjinstance *this;
|
tjinstance *this;
|
||||||
|
|
||||||
if ((this = (tjinstance *)malloc(sizeof(tjinstance))) == NULL) {
|
if ((this = (tjinstance *)malloc(sizeof(tjinstance))) == NULL) {
|
||||||
snprintf(errStr, JMSG_LENGTH_MAX,
|
SNPRINTF(errStr, JMSG_LENGTH_MAX,
|
||||||
"tjInitDecompress(): Memory allocation failure");
|
"tjInitDecompress(): Memory allocation failure");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
memset(this, 0, sizeof(tjinstance));
|
memset(this, 0, sizeof(tjinstance));
|
||||||
snprintf(this->errStr, JMSG_LENGTH_MAX, "No error");
|
SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "No error");
|
||||||
return _tjInitDecompress(this);
|
return _tjInitDecompress(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1277,7 +1277,7 @@ DLLEXPORT int tjDecompressHeader(tjhandle handle, unsigned char *jpegBuf,
|
|||||||
DLLEXPORT tjscalingfactor *tjGetScalingFactors(int *numscalingfactors)
|
DLLEXPORT tjscalingfactor *tjGetScalingFactors(int *numscalingfactors)
|
||||||
{
|
{
|
||||||
if (numscalingfactors == NULL) {
|
if (numscalingfactors == NULL) {
|
||||||
snprintf(errStr, JMSG_LENGTH_MAX,
|
SNPRINTF(errStr, JMSG_LENGTH_MAX,
|
||||||
"tjGetScalingFactors(): Invalid argument");
|
"tjGetScalingFactors(): Invalid argument");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -1884,12 +1884,12 @@ DLLEXPORT tjhandle tjInitTransform(void)
|
|||||||
tjhandle handle = NULL;
|
tjhandle handle = NULL;
|
||||||
|
|
||||||
if ((this = (tjinstance *)malloc(sizeof(tjinstance))) == NULL) {
|
if ((this = (tjinstance *)malloc(sizeof(tjinstance))) == NULL) {
|
||||||
snprintf(errStr, JMSG_LENGTH_MAX,
|
SNPRINTF(errStr, JMSG_LENGTH_MAX,
|
||||||
"tjInitTransform(): Memory allocation failure");
|
"tjInitTransform(): Memory allocation failure");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
memset(this, 0, sizeof(tjinstance));
|
memset(this, 0, sizeof(tjinstance));
|
||||||
snprintf(this->errStr, JMSG_LENGTH_MAX, "No error");
|
SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "No error");
|
||||||
handle = _tjInitCompress(this);
|
handle = _tjInitCompress(this);
|
||||||
if (!handle) return NULL;
|
if (!handle) return NULL;
|
||||||
handle = _tjInitDecompress(this);
|
handle = _tjInitDecompress(this);
|
||||||
@@ -1980,7 +1980,7 @@ DLLEXPORT int tjTransform(tjhandle handle, const unsigned char *jpegBuf,
|
|||||||
if (xinfo[i].crop) {
|
if (xinfo[i].crop) {
|
||||||
if ((t[i].r.x % tjMCUWidth[jpegSubsamp]) != 0 ||
|
if ((t[i].r.x % tjMCUWidth[jpegSubsamp]) != 0 ||
|
||||||
(t[i].r.y % tjMCUHeight[jpegSubsamp]) != 0) {
|
(t[i].r.y % tjMCUHeight[jpegSubsamp]) != 0) {
|
||||||
snprintf(this->errStr, JMSG_LENGTH_MAX,
|
SNPRINTF(this->errStr, JMSG_LENGTH_MAX,
|
||||||
"To crop this JPEG image, x must be a multiple of %d\n"
|
"To crop this JPEG image, x must be a multiple of %d\n"
|
||||||
"and y must be a multiple of %d.\n",
|
"and y must be a multiple of %d.\n",
|
||||||
tjMCUWidth[jpegSubsamp], tjMCUHeight[jpegSubsamp]);
|
tjMCUWidth[jpegSubsamp], tjMCUHeight[jpegSubsamp]);
|
||||||
|
|||||||
Reference in New Issue
Block a user