troosh / openjpeg

Automatically exported from code.google.com/p/openjpeg
Other
0 stars 0 forks source link

OPJViewer suggested fixes for Win64 (and Win32) #102

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I posted these issues on the forum at DSP Laboratory - DIEI where the original 
author works and he suggested that I posted these here instead.  Please let me 
know if there's a better way to get these changes accepted.

I discovered this nice program with the OpenJPEG 1.4 distribution. I am 
developing on Win7 x64 with VS2008 and wxMSW 2.8.12.  I found a few problems 
that I suggest be fixed:

1. In OPJThreads.cpp, in the OPJMarkerTree ctor (around line 435), I suggest 
moving the assignment
  m_childframe = subframe;
above where the thread is run. Otherwise, you can have a situation where 
OPJParseThread::WriteText() is posting its event to 
m_tree->m_childframe but unfortunately m_childframe could still be 
uninitialized. This happened to me repeatedly unless I rearranged the ctor as I 
recommend.

The other changes I suggest just fix compiler errors or warnings that I see 
with VC++ 2008 and compiler warning level /W3:

2. There are three little callbacks in imagjpeg2000.cpp called 
jpeg2000_{error,warning,info}_callback. Each contains the line
int message_len = strlen(msg);

These should all be "size_t message_len..." instead.

3. Likewise, in wxjp2parser.cpp, there are four lines that look like this:

  const long unix_time = ...
or
  const long unix_time1 = ...

These actually cause errors when their addresses are passed to ctime() since 
the sizeof(long) is not right on Win64. So, please change the type of all of 
these to time_t instead of long.

Thank you very much for you fine program. Please contact me if any of this does 
not make sense.

Original issue reported on code.google.com by cgod...@gmail.com on 30 Oct 2011 at 2:15

GoogleCodeExporter commented 9 years ago
Would it be possible for you to directly attach the output of 'svn diff'. This 
will be easier for us to apply.
Thanks

Original comment by mathieu.malaterre on 11 Jan 2012 at 9:09

GoogleCodeExporter commented 9 years ago
Attached is the output from svn diff in applications/OPJViewer.  Four files 
were changed.  Note that since I first sent in my edits, we upgraded to VS 2010 
which is a little choosier.  So I fixed a handful of signed/unsigned comparison 
warnings as well.

Also, source/about_htm.h uses a CPP symbol (OPENJPEG_VERSION) that does not 
seemed to be used any longer in the project, or maybe it's added during release 
and does not appear in the SVN version.  In any case, I added 

#define OPENJPEG_VERSION "1.4"

at the top of about_htm.h just to satisfy the compiler.  What is the proper way 
to do this now?

Original comment by cgod...@gmail.com on 13 Jan 2012 at 1:53

Attachments:

GoogleCodeExporter commented 9 years ago
I forgot to mention that I compiled with /wd4996 to suppress all of the 
deprecation warnings.  I would be interested in a pointer to where these are 
explained.  I would be willing to upgrade this example to replace the 
deprecated code if someone were to show me the way.

Thanks!

Original comment by cgod...@gmail.com on 13 Jan 2012 at 1:58

GoogleCodeExporter commented 9 years ago

Original comment by mathieu.malaterre on 25 Feb 2014 at 3:41