bugpng++, a C++ wrapper for libpng - Bugs: bug #45426, PNG++ produces warnings when...

 
 

bug #45426: PNG++ produces warnings when compiling under MSVC++ 2015 for AMD64 (with patch!)

Submitter:  None
Submitted:  Sat 27 Jun 2015 05:56:33 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 25 Oct 2015 06:37:21 PM UTC, comment #5: 

The size_t<=>uint_32 use should now also be OK.

Alexander Shulgin <alexshulgin>
Group administrator
Sun 25 Oct 2015 05:24:14 PM UTC, comment #4: 

Well, this has taken me a while to finally take a look.

I could conclude that strerror_s() is not available with current versions of glibc and even though this function is indeed in the C11 standard, its implementation is optional, not mandatory.

In the end, we use strerror_s() if available, otherwise we use strerror_r().

Alexander Shulgin <alexshulgin>
Group administrator
Tue 30 Jun 2015 07:57:19 PM UTC, comment #3: 

http://en.cppreference.com/w/c/string/byte/strerror
Seems strerror_s is standard since C11

Anonymous
Mon 29 Jun 2015 05:49:50 AM UTC, comment #2: 

Thank you for this patch!

I will review and merge the changes, if everything is OK.  For one, I can see that on GNU or POSIX system you should use strerror_r instead (strerror_s being a MS extension?)

Alexander Shulgin <alexshulgin>
Group administrator
Sat 27 Jun 2015 06:42:02 PM UTC, comment #1: 

BTW, here is the compiler output with warnings:

1>d:\programming\libraries\png++\pngpp_svn\error.hpp(80): warning C4996: 'strerror': This function or variable may be unsafe. Consider using strerror_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>  C:\Program Files (x86)\Windows Kits\10\Include\10.0.10056.0\ucrt\string.h(179): note: see declaration of 'strerror'
1>d:\programming\libraries\png++\pngpp_svn\image_info.hpp(74): warning C4267: '=': conversion from 'size_t' to 'png::uint_32', possible loss of data
1>d:\programming\libraries\png++\pngpp_svn\image_info.hpp(84): warning C4267: '=': conversion from 'size_t' to 'png::uint_32', possible loss of data
1>d:\programming\libraries\png++\pngpp_svn\info.hpp(108): warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data
1>d:\programming\libraries\png++\pngpp_svn\info.hpp(116): warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data
1>d:\programming\libraries\png++\pngpp_svn\info.hpp(149): warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data


Anonymous
Sat 27 Jun 2015 05:56:33 PM UTC, original submission:  

Most of the warnings were about size_t (which is unsigned __int64 under AMD64) being assigned to uint_32.
One more warning warns that strerror() is not thread safe.

These warning have been fixed by me, so png++ does not produce any warnings anymore. See attached patch.

Most of the size_t variables were replaced with uint_32 (and byte in one case) because PNG does not support image dimensions of 64 bit anyway. Moreover, it is always 32 bit unsigned integer. The bit depth is 8 bit, so that was changed as well.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #34331:  pngpp_svn-vs2015_warnings_fix.patch added by None (12KiB - application/octet-stream - The fix for warnings.)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by alexshulgin (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-10-25 alexshulgin StatusNone Fixed
        Open/ClosedOpen Closed
    2015-06-27 None Attached File- Added pngpp_svn-vs2015_warnings_fix.patch, #34331

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code