Fix build if [CD]_LOSSLESS_SUPPORTED undefined

(regression introduced by fc01f4673b)
This commit is contained in:
DRC
2023-01-27 13:08:04 -06:00
parent d7790789a6
commit d0015876ec

View File

@@ -283,6 +283,9 @@ DLLEXPORT _JSAMPLE *GET_NAME(tj3LoadImage, BITS_IN_JSAMPLE)
{ {
static const char FUNCTION_NAME[] = static const char FUNCTION_NAME[] =
GET_STRING(tj3LoadImage, BITS_IN_JSAMPLE); GET_STRING(tj3LoadImage, BITS_IN_JSAMPLE);
#if BITS_IN_JSAMPLE != 16 || defined(C_LOSSLESS_SUPPORTED)
int retval = 0, tempc; int retval = 0, tempc;
size_t pitch; size_t pitch;
tjhandle handle2 = NULL; tjhandle handle2 = NULL;
@@ -392,6 +395,23 @@ bailout:
if (file) fclose(file); if (file) fclose(file);
if (retval < 0) { free(dstBuf); dstBuf = NULL; } if (retval < 0) { free(dstBuf); dstBuf = NULL; }
return dstBuf; return dstBuf;
#else /* BITS_IN_JSAMPLE != 16 || defined(C_LOSSLESS_SUPPORTED) */
static const char ERROR_MSG[] =
"16-bit data precision requires lossless JPEG,\n"
"which was disabled at build time.";
_JSAMPLE *retval = NULL;
GET_TJINSTANCE(handle, NULL)
SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME,
ERROR_MSG);
this->isInstanceError = TRUE; THROWG(ERROR_MSG, NULL)
bailout:
return retval;
#endif
} }
@@ -403,6 +423,9 @@ DLLEXPORT int GET_NAME(tj3SaveImage, BITS_IN_JSAMPLE)
static const char FUNCTION_NAME[] = static const char FUNCTION_NAME[] =
GET_STRING(tj3SaveImage, BITS_IN_JSAMPLE); GET_STRING(tj3SaveImage, BITS_IN_JSAMPLE);
int retval = 0; int retval = 0;
#if BITS_IN_JSAMPLE != 16 || defined(D_LOSSLESS_SUPPORTED)
tjhandle handle2 = NULL; tjhandle handle2 = NULL;
tjinstance *this2; tjinstance *this2;
j_decompress_ptr dinfo = NULL; j_decompress_ptr dinfo = NULL;
@@ -483,6 +506,16 @@ bailout:
tj3Destroy(handle2); tj3Destroy(handle2);
if (file) fclose(file); if (file) fclose(file);
return retval; return retval;
#else /* BITS_IN_JSAMPLE != 16 || defined(D_LOSSLESS_SUPPORTED) */
GET_TJINSTANCE(handle, -1)
THROW("16-bit data precision requires lossless JPEG,\n"
"which was disabled at build time.")
bailout:
return retval;
#endif
} }