www.digitalmars.com         C & C++   DMDScript  

c++.beta - dmc bug in png lib

reply chris elliott <biol75 york.ac.uk> writes:
Walter, I think this is a dmc bug: I found it within the wxWidgets 
library when a new version of png was introduced.

This is a reduced version of pngrutil.c
I'm compiling it with

dmc -mn -c -opngrutil.obj -g -o+none -D_WIN32_WINNT=0x0400 
-I..\..\src\zlib    pngrutil.c

please let me know if you see the bug too, or if i can provide any 
further information
chris

/* pngrutil.c - utilities to read a PNG file
  *
  * Last changed in libpng 1.2.19 August 19, 2007
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1998-2007 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, 
Inc.)
  *
  * This file contains routines that are only called from within
  * libpng itself during the course of reading an image.
  */


#include "png.h"

png_charp /* PRIVATE */
png_decompress_chunk( png_structp png_ptr,   int comp_type,
                               /* png_charp chunkdata, png_size_t 
chunklength,
                               png_size_t prefix_size, png_size_t 
*newlength */ )
{

       int ret = 0;

       if (ret != 1)
       {

          char umsg[52];

/* IF YOU REMOVE THIS COMMENT IT FAILS AT png_snprintf(umsg, 50,
          "Unknown zTXt compression type %d", comp_type);


         if (ret == 2)
             png_snprintf(umsg, 52,
                 "Buffer error in compressed datastream in %s chunk",
                 png_ptr->chunk_name);
          else if (ret == 3)
             png_snprintf(umsg, 52,
                 "Data error in compressed datastream in %s chunk",
                 png_ptr->chunk_name);
          else
             png_snprintf(umsg, 52,
                 "Incomplete compressed datastream in %s chunk",
                 png_ptr->chunk_name);
          png_warning(png_ptr, umsg);
*/


    }
    else /* if (comp_type != PNG_COMPRESSION_TYPE_BASE) */
    {
       char umsg[50];

       png_snprintf(umsg, 50,
          "Unknown zTXt compression type %d", comp_type);
       png_warning(png_ptr, umsg);
    }
}
Oct 06 2007
parent reply Walter Bright <newshound1 digitalmars.com> writes:
chris elliott wrote:
 Walter, I think this is a dmc bug: I found it within the wxWidgets 
 library when a new version of png was introduced.
Please try to reduce it to a standalone code snippet, please.
Oct 11 2007
parent reply chris elliott <biol75 york.ac.uk> writes:
Walter Bright wrote:
 chris elliott wrote:
 Walter, I think this is a dmc bug: I found it within the wxWidgets 
 library when a new version of png was introduced.
Please try to reduce it to a standalone code snippet, please.
I've tried this: dmc -mn -c -g -o+none chris.c --------------------chris.c---------------------------------- int main () { char umsg[50]; char umsg2[50]; int comp_type = 10; /*comment the next line and the second png_snprintf is compiled OK */ png_snprintf(umsg, 50, "Unknown zTXt compression type %s", "hello"); png_snprintf(umsg2, 50, "Unknown zTXt compression type %d", comp_type); }
Oct 25 2007
parent Walter Bright <newshound1 digitalmars.com> writes:
Thanks!
Oct 26 2007