shithub: jbig2

Download patch

ref: 5991310f87724aaa1d47850baf75c2512c269cef
parent: 0726320a4b55078e9d8deb590e477d598b3da66e
author: Ken Sharp <[email protected]>
date: Wed Jan 29 05:00:39 EST 2020

Fix jbig2dec compilation when inline is not defined.

VS 2008 defines __inline but not inline, later versions of Visual Studio
do define inline, but apparently also permit __inline (presumably for
backwards compatibility).

Since we now use inline for performance purposes in jbig2_image.h its
vital that inline is defined. Here we modify the win32 config file to
define inline in terms of __inline for VS 2008 and above, unless inline
is already defined in which case we use it as is. For VS 2005
Ghostscript defines inline as nothing, so we do the same.

Finally, add a last-ditch definition of inline (as nothing) to jbig2.h
to cover any build environment where inline is still undefined, so that
the code will at least compile.

--- a/config_win32.h
+++ b/config_win32.h
@@ -41,6 +41,15 @@
 /* VS 2008 and later have vsnprintf */
 # if _MSC_VER < 1500
 #  define vsnprintf _vsnprintf
+/* Previously we defined inline as nothing for 2005 and below */
+#  define inline
+#else
+/* VS 2008 has __inline but not inline, later versiosn (unknown exactly where) define inline
+ * so cater for it being defined already.
+ */
+# if !(defined(inline))
+#  define inline __inline
+# endif
 # endif
 
 /* VS 2014 and later have (finally) snprintf */
--- a/jbig2.h
+++ b/jbig2.h
@@ -106,6 +106,11 @@
 
 #endif                          /* _JBIG2_H */
 
+/* If we don't have a definition for inline, make it nothing so the code will compile */
+#ifndef inline
+#define inline
+#endif
+
 #ifdef __cplusplus
 }
 #endif