[gs-bugs] [Bug 691461] Converting version 0.11 from C to C++ for use with MSVC++

bugzilla-daemon at ghostscript.com bugzilla-daemon at ghostscript.com
Fri Jul 16 08:21:16 UTC 2010


http://bugs.ghostscript.com/show_bug.cgi?id=691461

--- Comment #1 from Ken Sharp <ken.sharp at artifex.com> 2010-07-16 08:21:15 UTC ---
Created an attachment (id=6494)
 --> (http://bugs.ghostscript.com/attachment.cgi?id=6494)
modified version of getopt.c

This is due to some weirdness in the MSVC stdio.h. The simplest way to 'fix'
this that I've found is simply to define __STDC__ in the VS solution. This
prevents the definition of 'const' which solves the problem. Another obvious
solution would be to further guard the definition of const, which needs done in
2 files I think.

Right click the solution, select properties from the context menu. In the left
pane click Configuration properties, then from the expanded tree click C/C++,
select from the expanded tree the 'Preprocessor' item. In the right pane, under
'Preprocessor Definition' add __STDC__ (there will probably already be some
definitions, use ; as a separator).

The next issue is that (as you already know) getopt.c uses K&R function
declarations. I've attached a modified getopt.c which replaces these with ANSI
definitions.

Then we have two 'main()' entry points, one in Main.cpp and one in jbig2dec.c.
Since the one in Main.cpp doesn't do much I just removed it for now. You should
probably remove jbig2dec.c since this is the command line code, presumably you
will use this as a library.

The next problem is that it looks like jbig2dec relies on libpng in order to
write the decoded image as a PNG file. I get numerous unresolved externals in
jbig2_image_png.c. You can stub these out, or remove the code entirely since it
is mostly used by jbig2dec.c which you won't want.

Anyway, I think you should be able to carry on from here.

-- 
Configure bugmail: http://bugs.ghostscript.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the gs-bugs mailing list