STR #2920

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 Home  |  Articles & FAQs  |  Bugs & Features  |  Documentation  |  Download  |  Screenshots  ]

Return to Bugs & Features | Roadmap 1.3 ]

STR #2920

Application:FLTK Library
Status:1 - Closed w/Resolution
Priority:3 - Moderate, e.g. unable to compile the software
Scope:3 - Applies to all machines and operating systems
Subsystem:Image Support
Summary:Fl_JPEG_Image.cxx bug in fltk-1.3.x for jpeg-9
Created By:szukw000
Assigned To:AlbrechtS
Fix Version:1.3.4 (SVN: v10621)
Update Notification:

Receive EMails Don't Receive EMails

Trouble Report Files:

No files

Trouble Report Comments:

Name/Time/Date Text top right image
#1 szukw000
19:14 Jan 17, 2013
There has been a change in jpeg-9:

Fl_JPEG_Image.cxx: In constructor 'Fl_JPEG_Image::Fl_JPEG_Image(const char*)':
Fl_JPEG_Image.cxx:158:29: error: invalid conversion from 'int' to 'boolean' [-fpermissive]
In file included from Fl_JPEG_Image.cxx:50:0:
/usr/include/jpeglib.h:1032:13: error:   initializing argument 2 of 'int jpeg_read_header(j_decompress_ptr, boolean)' [-fpermissive]


--- fltk-1.3.x-r9791/src/Fl_JPEG_Image.cxx.orig 2013-01-18 04:54:06.763109737 +0100
+++ fltk-1.3.x-r9791/src/Fl_JPEG_Image.cxx  2013-01-18 04:54:55.147111013 +0100
@@ -155,7 +155,7 @@

   jpeg_stdio_src(&dinfo, fp);
-  jpeg_read_header(&dinfo, 1);
+  jpeg_read_header(&dinfo, TRUE);

   dinfo.quantize_colors      = (boolean)FALSE;
   dinfo.out_color_space      = JCS_RGB;
@@ -333,7 +333,7 @@

   jpeg_mem_src(&dinfo, data);
-  jpeg_read_header(&dinfo, 1);
+  jpeg_read_header(&dinfo, TRUE);

   dinfo.quantize_colors      = (boolean)FALSE;
   dinfo.out_color_space      = JCS_RGB;
#2 greg.ercolano
09:58 Jan 18, 2013
> There's been a change in jpeg 9

FLTK currently releases with jpeg 8c (according to the change log), so I take it you're linking against an external jpeg 9, right?

Change should be OK as long as it doesn't break building with FLTK's built-in jpeg 8c. And according to fltk's jpeg/jpeglib.h, it seems like your change is desirable:

EXTERN(int) jpeg_read_header JPP((j_decompress_ptr cinfo,
                                  boolean require_image));

..the second arg is a boolean in 8c, so this change is probably recommended.

Awaiting a second opinion..
#3 szukw000
13:10 Jan 18, 2013

extern "C"
#  include <jpeglib.h>
#endif // HAVE_LIBJPEG

The same holds for fltk-3.0.x-r9799/src/fltk3images/JPEGImage.cxx .

The 'jpeglib.h' in question is the file of jpeg-9.
It includes 'jmorecfg.h'.

'jmorecfg.h' of JPEG now contains:

#ifndef FALSE           /* in case these macros already exist */
#define FALSE   0       /* values of boolean */
#ifndef TRUE
#define TRUE    1
typedef enum { FALSE = 0, TRUE = 1 } boolean;

The 'jmorecfg.h' of FLTK contains:

typedef int boolean;
#ifndef FALSE           /* in case these macros already exist */
#define FALSE   0       /* values of boolean */
#ifndef TRUE
#define TRUE    1

This obviously results in a bug in fltk-1.3 and fltk-3.0 .

#4 ianmacarthur
16:01 Sep 04, 2014
All, where are we with this one? Do we want to merge in Winfried's proposed changes, or...?  
#5 michaelbaeuerle
02:16 Oct 28, 2014
I have taken a look at the headers of libjpeg-turbo and it defines 'boolean' as 'int' too (if not available, same as libjpeg 8).

But Winfried's patch looks like it would work with all three variants.
#6 AlbrechtS
12:34 Mar 15, 2015
Fixed in Subversion repository.

Verified with jpeg-8 and jpeg-9.
bottom left image   bottom right image

Return to Bugs & Features ]


Comments are owned by the poster. All other content is copyright 1998-2022 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to ''.