Skip to content

Commit

Permalink
Fix broken JPEG decoding (tested on Windows)
Browse files Browse the repository at this point in the history
  • Loading branch information
jgranick committed Jul 9, 2024
1 parent c3a8676 commit f684505
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
7 changes: 5 additions & 2 deletions project/lib/custom/jpeg/jconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
#define MEM_SRCDST_SUPPORTED 1

/* Use accelerated SIMD routines. */
#ifndef __ANDROID__
#define WITH_SIMD 1
#endif

/*
* Define BITS_IN_JSAMPLE as either
Expand Down Expand Up @@ -67,9 +69,10 @@
#endif

/* If rpcndr.h has defined boolean, jmorecfg.h should not. */
#ifdef __RPCNDR_H__
#define HAVE_BOOLEAN
#ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */
typedef unsigned char boolean;
#endif
#define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */

/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */
Expand Down
10 changes: 10 additions & 0 deletions project/src/graphics/format/JPEG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,19 @@ namespace lime {
static void OnOutput (j_common_ptr cinfo) {}


// #ifdef NDEBUG
// char errorMessage[JMSG_LENGTH_MAX];
// #endif

static void OnError (j_common_ptr cinfo) {

ErrorData * err = (ErrorData *)cinfo->err;

// #ifdef NDEBUG
// ( *(cinfo->err->format_message) ) (cinfo, errorMessage);
// fprintf(stderr, "%s\n", errorMessage);
// #endif

longjmp (err->on_error, 1);

}
Expand Down

0 comments on commit f684505

Please sign in to comment.