mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
updated to the latest version of libpng
This commit is contained in:
parent
9a12e99fad
commit
d95b8c8c35
24 changed files with 25362 additions and 34210 deletions
|
|
@ -277,7 +277,6 @@ OBJECTS := \
|
||||||
$(OBJDIR)/transupp.o \
|
$(OBJDIR)/transupp.o \
|
||||||
$(OBJDIR)/png.o \
|
$(OBJDIR)/png.o \
|
||||||
$(OBJDIR)/pngerror.o \
|
$(OBJDIR)/pngerror.o \
|
||||||
$(OBJDIR)/pnggccrd.o \
|
|
||||||
$(OBJDIR)/pngget.o \
|
$(OBJDIR)/pngget.o \
|
||||||
$(OBJDIR)/pngmem.o \
|
$(OBJDIR)/pngmem.o \
|
||||||
$(OBJDIR)/pngpread.o \
|
$(OBJDIR)/pngpread.o \
|
||||||
|
|
@ -287,7 +286,6 @@ OBJECTS := \
|
||||||
$(OBJDIR)/pngrutil.o \
|
$(OBJDIR)/pngrutil.o \
|
||||||
$(OBJDIR)/pngset.o \
|
$(OBJDIR)/pngset.o \
|
||||||
$(OBJDIR)/pngtrans.o \
|
$(OBJDIR)/pngtrans.o \
|
||||||
$(OBJDIR)/pngvcrd.o \
|
|
||||||
$(OBJDIR)/pngwio.o \
|
$(OBJDIR)/pngwio.o \
|
||||||
$(OBJDIR)/pngwrite.o \
|
$(OBJDIR)/pngwrite.o \
|
||||||
$(OBJDIR)/pngwtran.o \
|
$(OBJDIR)/pngwtran.o \
|
||||||
|
|
@ -1643,11 +1641,6 @@ $(OBJDIR)/pngerror.o: ../../src/juce_appframework/gui/graphics/imaging/image_fil
|
||||||
@echo $(notdir $<)
|
@echo $(notdir $<)
|
||||||
@$(CC) $(CFLAGS) -o $@ -c $<
|
@$(CC) $(CFLAGS) -o $@ -c $<
|
||||||
|
|
||||||
$(OBJDIR)/pnggccrd.o: ../../src/juce_appframework/gui/graphics/imaging/image_file_formats/pnglib/pnggccrd.c
|
|
||||||
-@$(CMD_MKOBJDIR)
|
|
||||||
@echo $(notdir $<)
|
|
||||||
@$(CC) $(CFLAGS) -o $@ -c $<
|
|
||||||
|
|
||||||
$(OBJDIR)/pngget.o: ../../src/juce_appframework/gui/graphics/imaging/image_file_formats/pnglib/pngget.c
|
$(OBJDIR)/pngget.o: ../../src/juce_appframework/gui/graphics/imaging/image_file_formats/pnglib/pngget.c
|
||||||
-@$(CMD_MKOBJDIR)
|
-@$(CMD_MKOBJDIR)
|
||||||
@echo $(notdir $<)
|
@echo $(notdir $<)
|
||||||
|
|
@ -1693,11 +1686,6 @@ $(OBJDIR)/pngtrans.o: ../../src/juce_appframework/gui/graphics/imaging/image_fil
|
||||||
@echo $(notdir $<)
|
@echo $(notdir $<)
|
||||||
@$(CC) $(CFLAGS) -o $@ -c $<
|
@$(CC) $(CFLAGS) -o $@ -c $<
|
||||||
|
|
||||||
$(OBJDIR)/pngvcrd.o: ../../src/juce_appframework/gui/graphics/imaging/image_file_formats/pnglib/pngvcrd.c
|
|
||||||
-@$(CMD_MKOBJDIR)
|
|
||||||
@echo $(notdir $<)
|
|
||||||
@$(CC) $(CFLAGS) -o $@ -c $<
|
|
||||||
|
|
||||||
$(OBJDIR)/pngwio.o: ../../src/juce_appframework/gui/graphics/imaging/image_file_formats/pnglib/pngwio.c
|
$(OBJDIR)/pngwio.o: ../../src/juce_appframework/gui/graphics/imaging/image_file_formats/pnglib/pngwio.c
|
||||||
-@$(CMD_MKOBJDIR)
|
-@$(CMD_MKOBJDIR)
|
||||||
@echo $(notdir $<)
|
@echo $(notdir $<)
|
||||||
|
|
|
||||||
|
|
@ -3183,10 +3183,6 @@
|
||||||
RelativePath="..\..\..\src\juce_appframework\gui\graphics\imaging\image_file_formats\pnglib\pngerror.c"
|
RelativePath="..\..\..\src\juce_appframework\gui\graphics\imaging\image_file_formats\pnglib\pngerror.c"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\src\juce_appframework\gui\graphics\imaging\image_file_formats\pnglib\pnggccrd.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\src\juce_appframework\gui\graphics\imaging\image_file_formats\pnglib\pngget.c"
|
RelativePath="..\..\..\src\juce_appframework\gui\graphics\imaging\image_file_formats\pnglib\pngget.c"
|
||||||
>
|
>
|
||||||
|
|
@ -3223,10 +3219,6 @@
|
||||||
RelativePath="..\..\..\src\juce_appframework\gui\graphics\imaging\image_file_formats\pnglib\pngtrans.c"
|
RelativePath="..\..\..\src\juce_appframework\gui\graphics\imaging\image_file_formats\pnglib\pngtrans.c"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\src\juce_appframework\gui\graphics\imaging\image_file_formats\pnglib\pngvcrd.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\src\juce_appframework\gui\graphics\imaging\image_file_formats\pnglib\pngwio.c"
|
RelativePath="..\..\..\src\juce_appframework\gui\graphics\imaging\image_file_formats\pnglib\pngwio.c"
|
||||||
>
|
>
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ Changelist for version 1.45
|
||||||
- refactored the OpenGLComponent, adding new classes OpenGLPixelFormat and OpenGLContext
|
- refactored the OpenGLComponent, adding new classes OpenGLPixelFormat and OpenGLContext
|
||||||
- A component's KeyListeners are now called before its keyPressed method, so if you want to intercept keys and stop them getting sent to the component, you can add a keylistener and comsume the events.
|
- A component's KeyListeners are now called before its keyPressed method, so if you want to intercept keys and stop them getting sent to the component, you can add a keylistener and comsume the events.
|
||||||
- added an option to choose a Midi output device to the AudioDeviceManager and AudioDeviceSelectorComponent
|
- added an option to choose a Midi output device to the AudioDeviceManager and AudioDeviceSelectorComponent
|
||||||
|
- updated the included version of libpng
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
Changelist for version 1.44
|
Changelist for version 1.44
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@ COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
|
||||||
If you modify libpng you may insert additional notices immediately following
|
If you modify libpng you may insert additional notices immediately following
|
||||||
this sentence.
|
this sentence.
|
||||||
|
|
||||||
libpng version 1.2.6, December 3, 2004, is
|
libpng versions 1.2.6, August 15, 2004, through 1.2.21, October 4, 2007, are
|
||||||
Copyright (c) 2004 Glenn Randers-Pehrson, and is
|
Copyright (c) 2004, 2006-2007 Glenn Randers-Pehrson, and are
|
||||||
distributed according to the same disclaimer and license as libpng-1.2.5
|
distributed according to the same disclaimer and license as libpng-1.2.5
|
||||||
with the following individual added to the list of Contributing Authors
|
with the following individual added to the list of Contributing Authors
|
||||||
|
|
||||||
|
|
@ -106,4 +106,4 @@ certification mark of the Open Source Initiative.
|
||||||
|
|
||||||
Glenn Randers-Pehrson
|
Glenn Randers-Pehrson
|
||||||
glennrp at users.sourceforge.net
|
glennrp at users.sourceforge.net
|
||||||
December 3, 2004
|
October 4, 2007
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -1,295 +1,341 @@
|
||||||
|
|
||||||
/* pngerror.c - stub functions for i/o and memory allocation
|
/* pngerror.c - stub functions for i/o and memory allocation
|
||||||
*
|
*
|
||||||
* libpng version 1.2.8 - December 3, 2004
|
* Last changed in libpng 1.2.20 October 4, 2007
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1998-2004 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2007 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
* This file provides a location for all error handling. Users who
|
* This file provides a location for all error handling. Users who
|
||||||
* need special error handling are expected to write replacement functions
|
* need special error handling are expected to write replacement functions
|
||||||
* and use png_set_error_fn() to use those functions. See the instructions
|
* and use png_set_error_fn() to use those functions. See the instructions
|
||||||
* at each function.
|
* at each function.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
#define PNG_INTERNAL
|
||||||
#include "png.h"
|
#include "png.h"
|
||||||
|
|
||||||
static void /* PRIVATE */
|
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
|
||||||
png_default_error PNGARG((png_structp png_ptr,
|
static void /* PRIVATE */
|
||||||
png_const_charp error_message));
|
png_default_error PNGARG((png_structp png_ptr,
|
||||||
static void /* PRIVATE */
|
png_const_charp error_message));
|
||||||
png_default_warning PNGARG((png_structp png_ptr,
|
#ifndef PNG_NO_WARNINGS
|
||||||
png_const_charp warning_message));
|
static void /* PRIVATE */
|
||||||
|
png_default_warning PNGARG((png_structp png_ptr,
|
||||||
/* This function is called whenever there is a fatal error. This function
|
png_const_charp warning_message));
|
||||||
* should not be changed. If there is a need to handle errors differently,
|
#endif /* PNG_NO_WARNINGS */
|
||||||
* you should supply a replacement error function and use png_set_error_fn()
|
|
||||||
* to replace the error function at run-time.
|
/* This function is called whenever there is a fatal error. This function
|
||||||
*/
|
* should not be changed. If there is a need to handle errors differently,
|
||||||
void PNGAPI
|
* you should supply a replacement error function and use png_set_error_fn()
|
||||||
png_error_nostring(png_structp png_ptr, png_const_charp error_message)
|
* to replace the error function at run-time.
|
||||||
{
|
*/
|
||||||
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
#ifndef PNG_NO_ERROR_TEXT
|
||||||
char msg[16];
|
void PNGAPI
|
||||||
if (png_ptr->flags&(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))
|
png_error(png_structp png_ptr, png_const_charp error_message)
|
||||||
{
|
{
|
||||||
if (*error_message == '#')
|
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
||||||
{
|
char msg[16];
|
||||||
int offset;
|
if (png_ptr != NULL)
|
||||||
for (offset=1; offset<15; offset++)
|
{
|
||||||
if (*(error_message+offset) == ' ')
|
if (png_ptr->flags&
|
||||||
break;
|
(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))
|
||||||
if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT)
|
{
|
||||||
{
|
if (*error_message == '#')
|
||||||
int i;
|
{
|
||||||
for (i=0; i<offset-1; i++)
|
int offset;
|
||||||
msg[i]=error_message[i+1];
|
for (offset=1; offset<15; offset++)
|
||||||
msg[i]='\0';
|
if (*(error_message+offset) == ' ')
|
||||||
error_message=msg;
|
break;
|
||||||
}
|
if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT)
|
||||||
else
|
{
|
||||||
error_message+=offset;
|
int i;
|
||||||
}
|
for (i=0; i<offset-1; i++)
|
||||||
else
|
msg[i]=error_message[i+1];
|
||||||
{
|
msg[i]='\0';
|
||||||
if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT)
|
error_message=msg;
|
||||||
{
|
}
|
||||||
msg[0]='0';
|
else
|
||||||
msg[1]='\0';
|
error_message+=offset;
|
||||||
error_message=msg;
|
}
|
||||||
}
|
else
|
||||||
}
|
{
|
||||||
}
|
if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT)
|
||||||
#endif
|
{
|
||||||
if (png_ptr != NULL && png_ptr->error_fn != NULL)
|
msg[0]='0';
|
||||||
(*(png_ptr->error_fn))(png_ptr, error_message);
|
msg[1]='\0';
|
||||||
|
error_message=msg;
|
||||||
/* If the custom handler doesn't exist, or if it returns,
|
}
|
||||||
use the default handler, which will not return. */
|
}
|
||||||
png_default_error(png_ptr, error_message);
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
/* This function is called whenever there is a non-fatal error. This function
|
if (png_ptr != NULL && png_ptr->error_fn != NULL)
|
||||||
* should not be changed. If there is a need to handle warnings differently,
|
(*(png_ptr->error_fn))(png_ptr, error_message);
|
||||||
* you should supply a replacement warning function and use
|
|
||||||
* png_set_error_fn() to replace the warning function at run-time.
|
/* If the custom handler doesn't exist, or if it returns,
|
||||||
*/
|
use the default handler, which will not return. */
|
||||||
void PNGAPI
|
png_default_error(png_ptr, error_message);
|
||||||
png_warning_nostring(png_structp png_ptr, png_const_charp warning_message)
|
}
|
||||||
{
|
#else
|
||||||
int offset = 0;
|
void PNGAPI
|
||||||
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
png_err(png_structp png_ptr)
|
||||||
if (png_ptr->flags&(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))
|
{
|
||||||
#endif
|
if (png_ptr != NULL && png_ptr->error_fn != NULL)
|
||||||
{
|
(*(png_ptr->error_fn))(png_ptr, '\0');
|
||||||
if (*warning_message == '#')
|
|
||||||
{
|
/* If the custom handler doesn't exist, or if it returns,
|
||||||
for (offset=1; offset<15; offset++)
|
use the default handler, which will not return. */
|
||||||
if (*(warning_message+offset) == ' ')
|
png_default_error(png_ptr, '\0');
|
||||||
break;
|
}
|
||||||
}
|
#endif /* PNG_NO_ERROR_TEXT */
|
||||||
}
|
|
||||||
if (png_ptr != NULL && png_ptr->warning_fn != NULL)
|
#ifndef PNG_NO_WARNINGS
|
||||||
(*(png_ptr->warning_fn))(png_ptr, warning_message+offset);
|
/* This function is called whenever there is a non-fatal error. This function
|
||||||
else
|
* should not be changed. If there is a need to handle warnings differently,
|
||||||
png_default_warning(png_ptr, warning_message+offset);
|
* you should supply a replacement warning function and use
|
||||||
}
|
* png_set_error_fn() to replace the warning function at run-time.
|
||||||
|
*/
|
||||||
/* These utilities are used internally to build an error message that relates
|
void PNGAPI
|
||||||
* to the current chunk. The chunk name comes from png_ptr->chunk_name,
|
png_warning(png_structp png_ptr, png_const_charp warning_message)
|
||||||
* this is used to prefix the message. The message is limited in length
|
{
|
||||||
* to 63 bytes, the name characters are output as hex digits wrapped in []
|
int offset = 0;
|
||||||
* if the character is invalid.
|
if (png_ptr != NULL)
|
||||||
*/
|
{
|
||||||
#define isnonalpha(c) ((c) < 65 || (c) > 122 || ((c) > 90 && (c) < 97))
|
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
||||||
static PNG_CONST char png_digit[16] = {
|
if (png_ptr->flags&
|
||||||
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))
|
||||||
'A', 'B', 'C', 'D', 'E', 'F'
|
#endif
|
||||||
};
|
{
|
||||||
|
if (*warning_message == '#')
|
||||||
static void /* PRIVATE */
|
{
|
||||||
png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp
|
for (offset=1; offset<15; offset++)
|
||||||
error_message)
|
if (*(warning_message+offset) == ' ')
|
||||||
{
|
break;
|
||||||
int iout = 0, iin = 0;
|
}
|
||||||
|
}
|
||||||
while (iin < 4)
|
if (png_ptr != NULL && png_ptr->warning_fn != NULL)
|
||||||
{
|
(*(png_ptr->warning_fn))(png_ptr, warning_message+offset);
|
||||||
int c = png_ptr->chunk_name[iin++];
|
}
|
||||||
if (isnonalpha(c))
|
else
|
||||||
{
|
png_default_warning(png_ptr, warning_message+offset);
|
||||||
buffer[iout++] = '[';
|
}
|
||||||
buffer[iout++] = png_digit[(c & 0xf0) >> 4];
|
#endif /* PNG_NO_WARNINGS */
|
||||||
buffer[iout++] = png_digit[c & 0x0f];
|
|
||||||
buffer[iout++] = ']';
|
|
||||||
}
|
/* These utilities are used internally to build an error message that relates
|
||||||
else
|
* to the current chunk. The chunk name comes from png_ptr->chunk_name,
|
||||||
{
|
* this is used to prefix the message. The message is limited in length
|
||||||
buffer[iout++] = (png_byte)c;
|
* to 63 bytes, the name characters are output as hex digits wrapped in []
|
||||||
}
|
* if the character is invalid.
|
||||||
}
|
*/
|
||||||
|
#define isnonalpha(c) ((c) < 65 || (c) > 122 || ((c) > 90 && (c) < 97))
|
||||||
if (error_message == NULL)
|
static PNG_CONST char png_digit[16] = {
|
||||||
buffer[iout] = 0;
|
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
||||||
else
|
'A', 'B', 'C', 'D', 'E', 'F'
|
||||||
{
|
};
|
||||||
buffer[iout++] = ':';
|
|
||||||
buffer[iout++] = ' ';
|
#if !defined(PNG_NO_WARNINGS) || !defined(PNG_NO_ERROR_TEXT)
|
||||||
png_strncpy(buffer+iout, error_message, 63);
|
static void /* PRIVATE */
|
||||||
buffer[iout+63] = 0;
|
png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp
|
||||||
}
|
error_message)
|
||||||
}
|
{
|
||||||
|
int iout = 0, iin = 0;
|
||||||
void PNGAPI
|
|
||||||
png_chunk_error_nostring(png_structp png_ptr, png_const_charp error_message)
|
while (iin < 4)
|
||||||
{
|
{
|
||||||
char msg[18+64];
|
int c = png_ptr->chunk_name[iin++];
|
||||||
png_format_buffer(png_ptr, msg, error_message);
|
if (isnonalpha(c))
|
||||||
png_error(png_ptr, msg);
|
{
|
||||||
}
|
buffer[iout++] = '[';
|
||||||
|
buffer[iout++] = png_digit[(c & 0xf0) >> 4];
|
||||||
void PNGAPI
|
buffer[iout++] = png_digit[c & 0x0f];
|
||||||
png_chunk_warning_nostring(png_structp png_ptr, png_const_charp warning_message)
|
buffer[iout++] = ']';
|
||||||
{
|
}
|
||||||
char msg[18+64];
|
else
|
||||||
png_format_buffer(png_ptr, msg, warning_message);
|
{
|
||||||
png_warning(png_ptr, msg);
|
buffer[iout++] = (png_byte)c;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/* This is the default error handling function. Note that replacements for
|
|
||||||
* this function MUST NOT RETURN, or the program will likely crash. This
|
if (error_message == NULL)
|
||||||
* function is used by default, or if the program supplies NULL for the
|
buffer[iout] = 0;
|
||||||
* error function pointer in png_set_error_fn().
|
else
|
||||||
*/
|
{
|
||||||
static void /* PRIVATE */
|
buffer[iout++] = ':';
|
||||||
png_default_error(png_structp png_ptr, png_const_charp error_message)
|
buffer[iout++] = ' ';
|
||||||
{
|
png_strncpy(buffer+iout, error_message, 63);
|
||||||
#ifndef PNG_NO_CONSOLE_IO
|
buffer[iout+63] = 0;
|
||||||
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
}
|
||||||
if (*error_message == '#')
|
}
|
||||||
{
|
|
||||||
int offset;
|
#ifdef PNG_READ_SUPPORTED
|
||||||
char error_number[16];
|
void PNGAPI
|
||||||
for (offset=0; offset<15; offset++)
|
png_chunk_error(png_structp png_ptr, png_const_charp error_message)
|
||||||
{
|
{
|
||||||
error_number[offset] = *(error_message+offset+1);
|
char msg[18+64];
|
||||||
if (*(error_message+offset) == ' ')
|
if (png_ptr == NULL)
|
||||||
break;
|
png_error(png_ptr, error_message);
|
||||||
}
|
else
|
||||||
if((offset > 1) && (offset < 15))
|
{
|
||||||
{
|
png_format_buffer(png_ptr, msg, error_message);
|
||||||
error_number[offset-1]='\0';
|
png_error(png_ptr, msg);
|
||||||
fprintf(stderr, "libpng error no. %s: %s\n", error_number,
|
}
|
||||||
error_message+offset);
|
}
|
||||||
}
|
#endif /* PNG_READ_SUPPORTED */
|
||||||
else
|
#endif /* !defined(PNG_NO_WARNINGS) || !defined(PNG_NO_ERROR_TEXT) */
|
||||||
fprintf(stderr, "libpng error: %s, offset=%d\n", error_message,offset);
|
|
||||||
}
|
#ifndef PNG_NO_WARNINGS
|
||||||
else
|
void PNGAPI
|
||||||
#endif
|
png_chunk_warning(png_structp png_ptr, png_const_charp warning_message)
|
||||||
fprintf(stderr, "libpng error: %s\n", error_message);
|
{
|
||||||
#endif
|
char msg[18+64];
|
||||||
|
if (png_ptr == NULL)
|
||||||
#ifdef PNG_SETJMP_SUPPORTED
|
png_warning(png_ptr, warning_message);
|
||||||
# ifdef USE_FAR_KEYWORD
|
else
|
||||||
{
|
{
|
||||||
jmp_buf jmpbuf;
|
png_format_buffer(png_ptr, msg, warning_message);
|
||||||
png_memcpy(jmpbuf,png_ptr->jmpbuf,png_sizeof(jmp_buf));
|
png_warning(png_ptr, msg);
|
||||||
longjmp(jmpbuf, 1);
|
}
|
||||||
}
|
}
|
||||||
# else
|
#endif /* PNG_NO_WARNINGS */
|
||||||
longjmp(png_ptr->jmpbuf, 1);
|
|
||||||
# endif
|
|
||||||
#else
|
/* This is the default error handling function. Note that replacements for
|
||||||
/* make compiler happy */ ;
|
* this function MUST NOT RETURN, or the program will likely crash. This
|
||||||
if (png_ptr)
|
* function is used by default, or if the program supplies NULL for the
|
||||||
PNG_ABORT();
|
* error function pointer in png_set_error_fn().
|
||||||
#endif
|
*/
|
||||||
#ifdef PNG_NO_CONSOLE_IO
|
static void /* PRIVATE */
|
||||||
/* make compiler happy */ ;
|
png_default_error(png_structp png_ptr, png_const_charp error_message)
|
||||||
if (&error_message != NULL)
|
{
|
||||||
return;
|
#ifndef PNG_NO_CONSOLE_IO
|
||||||
#endif
|
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
||||||
}
|
if (*error_message == '#')
|
||||||
|
{
|
||||||
/* This function is called when there is a warning, but the library thinks
|
int offset;
|
||||||
* it can continue anyway. Replacement functions don't have to do anything
|
char error_number[16];
|
||||||
* here if you don't want them to. In the default configuration, png_ptr is
|
for (offset=0; offset<15; offset++)
|
||||||
* not used, but it is passed in case it may be useful.
|
{
|
||||||
*/
|
error_number[offset] = *(error_message+offset+1);
|
||||||
static void /* PRIVATE */
|
if (*(error_message+offset) == ' ')
|
||||||
png_default_warning(png_structp png_ptr, png_const_charp warning_message)
|
break;
|
||||||
{
|
}
|
||||||
#ifndef PNG_NO_CONSOLE_IO
|
if((offset > 1) && (offset < 15))
|
||||||
# ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
{
|
||||||
if (*warning_message == '#')
|
error_number[offset-1]='\0';
|
||||||
{
|
fprintf(stderr, "libpng error no. %s: %s\n", error_number,
|
||||||
int offset;
|
error_message+offset);
|
||||||
char warning_number[16];
|
}
|
||||||
for (offset=0; offset<15; offset++)
|
else
|
||||||
{
|
fprintf(stderr, "libpng error: %s, offset=%d\n", error_message,offset);
|
||||||
warning_number[offset]=*(warning_message+offset+1);
|
}
|
||||||
if (*(warning_message+offset) == ' ')
|
else
|
||||||
break;
|
#endif
|
||||||
}
|
fprintf(stderr, "libpng error: %s\n", error_message);
|
||||||
if((offset > 1) && (offset < 15))
|
#endif
|
||||||
{
|
|
||||||
warning_number[offset-1]='\0';
|
#ifdef PNG_SETJMP_SUPPORTED
|
||||||
fprintf(stderr, "libpng warning no. %s: %s\n", warning_number,
|
if (png_ptr)
|
||||||
warning_message+offset);
|
{
|
||||||
}
|
# ifdef USE_FAR_KEYWORD
|
||||||
else
|
{
|
||||||
fprintf(stderr, "libpng warning: %s\n", warning_message);
|
jmp_buf jmpbuf;
|
||||||
}
|
png_memcpy(jmpbuf, png_ptr->jmpbuf, png_sizeof(jmp_buf));
|
||||||
else
|
longjmp(jmpbuf, 1);
|
||||||
# endif
|
}
|
||||||
fprintf(stderr, "libpng warning: %s\n", warning_message);
|
# else
|
||||||
#else
|
longjmp(png_ptr->jmpbuf, 1);
|
||||||
/* make compiler happy */ ;
|
# endif
|
||||||
if (warning_message)
|
}
|
||||||
return;
|
#else
|
||||||
#endif
|
PNG_ABORT();
|
||||||
/* make compiler happy */ ;
|
#endif
|
||||||
if (png_ptr)
|
#ifdef PNG_NO_CONSOLE_IO
|
||||||
return;
|
error_message = error_message; /* make compiler happy */
|
||||||
}
|
#endif
|
||||||
|
}
|
||||||
/* This function is called when the application wants to use another method
|
|
||||||
* of handling errors and warnings. Note that the error function MUST NOT
|
#ifndef PNG_NO_WARNINGS
|
||||||
* return to the calling routine or serious problems will occur. The return
|
/* This function is called when there is a warning, but the library thinks
|
||||||
* method used in the default routine calls longjmp(png_ptr->jmpbuf, 1)
|
* it can continue anyway. Replacement functions don't have to do anything
|
||||||
*/
|
* here if you don't want them to. In the default configuration, png_ptr is
|
||||||
void PNGAPI
|
* not used, but it is passed in case it may be useful.
|
||||||
png_set_error_fn(png_structp png_ptr, png_voidp error_ptr,
|
*/
|
||||||
png_error_ptr error_fn, png_error_ptr warning_fn)
|
static void /* PRIVATE */
|
||||||
{
|
png_default_warning(png_structp png_ptr, png_const_charp warning_message)
|
||||||
png_ptr->error_ptr = error_ptr;
|
{
|
||||||
png_ptr->error_fn = error_fn;
|
#ifndef PNG_NO_CONSOLE_IO
|
||||||
png_ptr->warning_fn = warning_fn;
|
# ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
||||||
}
|
if (*warning_message == '#')
|
||||||
|
{
|
||||||
|
int offset;
|
||||||
/* This function returns a pointer to the error_ptr associated with the user
|
char warning_number[16];
|
||||||
* functions. The application should free any memory associated with this
|
for (offset=0; offset<15; offset++)
|
||||||
* pointer before png_write_destroy and png_read_destroy are called.
|
{
|
||||||
*/
|
warning_number[offset]=*(warning_message+offset+1);
|
||||||
png_voidp PNGAPI
|
if (*(warning_message+offset) == ' ')
|
||||||
png_get_error_ptr(png_structp png_ptr)
|
break;
|
||||||
{
|
}
|
||||||
return ((png_voidp)png_ptr->error_ptr);
|
if((offset > 1) && (offset < 15))
|
||||||
}
|
{
|
||||||
|
warning_number[offset-1]='\0';
|
||||||
|
fprintf(stderr, "libpng warning no. %s: %s\n", warning_number,
|
||||||
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
warning_message+offset);
|
||||||
void PNGAPI
|
}
|
||||||
png_set_strip_error_numbers(png_structp png_ptr, png_uint_32 strip_mode)
|
else
|
||||||
{
|
fprintf(stderr, "libpng warning: %s\n", warning_message);
|
||||||
if(png_ptr != NULL)
|
}
|
||||||
{
|
else
|
||||||
png_ptr->flags &=
|
# endif
|
||||||
((~(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))&strip_mode);
|
fprintf(stderr, "libpng warning: %s\n", warning_message);
|
||||||
}
|
#else
|
||||||
}
|
warning_message = warning_message; /* make compiler happy */
|
||||||
#endif
|
#endif
|
||||||
|
png_ptr = png_ptr; /* make compiler happy */
|
||||||
|
}
|
||||||
|
#endif /* PNG_NO_WARNINGS */
|
||||||
|
|
||||||
|
/* This function is called when the application wants to use another method
|
||||||
|
* of handling errors and warnings. Note that the error function MUST NOT
|
||||||
|
* return to the calling routine or serious problems will occur. The return
|
||||||
|
* method used in the default routine calls longjmp(png_ptr->jmpbuf, 1)
|
||||||
|
*/
|
||||||
|
void PNGAPI
|
||||||
|
png_set_error_fn(png_structp png_ptr, png_voidp error_ptr,
|
||||||
|
png_error_ptr error_fn, png_error_ptr warning_fn)
|
||||||
|
{
|
||||||
|
if (png_ptr == NULL)
|
||||||
|
return;
|
||||||
|
png_ptr->error_ptr = error_ptr;
|
||||||
|
png_ptr->error_fn = error_fn;
|
||||||
|
png_ptr->warning_fn = warning_fn;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* This function returns a pointer to the error_ptr associated with the user
|
||||||
|
* functions. The application should free any memory associated with this
|
||||||
|
* pointer before png_write_destroy and png_read_destroy are called.
|
||||||
|
*/
|
||||||
|
png_voidp PNGAPI
|
||||||
|
png_get_error_ptr(png_structp png_ptr)
|
||||||
|
{
|
||||||
|
if (png_ptr == NULL)
|
||||||
|
return NULL;
|
||||||
|
return ((png_voidp)png_ptr->error_ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
||||||
|
void PNGAPI
|
||||||
|
png_set_strip_error_numbers(png_structp png_ptr, png_uint_32 strip_mode)
|
||||||
|
{
|
||||||
|
if(png_ptr != NULL)
|
||||||
|
{
|
||||||
|
png_ptr->flags &=
|
||||||
|
((~(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))&strip_mode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -1,161 +1,167 @@
|
||||||
|
|
||||||
/* pngrio.c - functions for data input
|
/* pngrio.c - functions for data input
|
||||||
*
|
*
|
||||||
* libpng 1.2.8 - December 3, 2004
|
* Last changed in libpng 1.2.13 November 13, 2006
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1998-2004 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2006 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
* This file provides a location for all input. Users who need
|
* This file provides a location for all input. Users who need
|
||||||
* special handling are expected to write a function that has the same
|
* special handling are expected to write a function that has the same
|
||||||
* arguments as this and performs a similar function, but that possibly
|
* arguments as this and performs a similar function, but that possibly
|
||||||
* has a different input method. Note that you shouldn't change this
|
* has a different input method. Note that you shouldn't change this
|
||||||
* function, but rather write a replacement function and then make
|
* function, but rather write a replacement function and then make
|
||||||
* libpng use it at run time with png_set_read_fn(...).
|
* libpng use it at run time with png_set_read_fn(...).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
#define PNG_INTERNAL
|
||||||
#include "png.h"
|
#include "png.h"
|
||||||
|
|
||||||
/* Read the data from whatever input you are using. The default routine
|
#if defined(PNG_READ_SUPPORTED)
|
||||||
reads from a file pointer. Note that this routine sometimes gets called
|
|
||||||
with very small lengths, so you should implement some kind of simple
|
/* Read the data from whatever input you are using. The default routine
|
||||||
buffering if you are using unbuffered reads. This should never be asked
|
reads from a file pointer. Note that this routine sometimes gets called
|
||||||
to read more then 64K on a 16 bit machine. */
|
with very small lengths, so you should implement some kind of simple
|
||||||
void /* PRIVATE */
|
buffering if you are using unbuffered reads. This should never be asked
|
||||||
png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
to read more then 64K on a 16 bit machine. */
|
||||||
{
|
void /* PRIVATE */
|
||||||
png_debug1(4,"reading %d bytes\n", (int)length);
|
png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||||
if (png_ptr->read_data_fn != NULL)
|
{
|
||||||
(*(png_ptr->read_data_fn))(png_ptr, data, length);
|
png_debug1(4,"reading %d bytes\n", (int)length);
|
||||||
else
|
if (png_ptr->read_data_fn != NULL)
|
||||||
png_error(png_ptr, "Call to NULL read function");
|
(*(png_ptr->read_data_fn))(png_ptr, data, length);
|
||||||
}
|
else
|
||||||
|
png_error(png_ptr, "Call to NULL read function");
|
||||||
#if !defined(PNG_NO_STDIO)
|
}
|
||||||
/* This is the function that does the actual reading of data. If you are
|
|
||||||
not reading from a standard C stream, you should create a replacement
|
#if !defined(PNG_NO_STDIO)
|
||||||
read_data function and use it at run time with png_set_read_fn(), rather
|
/* This is the function that does the actual reading of data. If you are
|
||||||
than changing the library. */
|
not reading from a standard C stream, you should create a replacement
|
||||||
#ifndef USE_FAR_KEYWORD
|
read_data function and use it at run time with png_set_read_fn(), rather
|
||||||
void PNGAPI
|
than changing the library. */
|
||||||
png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
#ifndef USE_FAR_KEYWORD
|
||||||
{
|
void PNGAPI
|
||||||
png_size_t check;
|
png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||||
|
{
|
||||||
/* fread() returns 0 on error, so it is OK to store this in a png_size_t
|
png_size_t check;
|
||||||
* instead of an int, which is what fread() actually returns.
|
|
||||||
*/
|
if(png_ptr == NULL) return;
|
||||||
#if defined(_WIN32_WCE)
|
/* fread() returns 0 on error, so it is OK to store this in a png_size_t
|
||||||
if ( !ReadFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) )
|
* instead of an int, which is what fread() actually returns.
|
||||||
check = 0;
|
*/
|
||||||
#else
|
#if defined(_WIN32_WCE)
|
||||||
check = (png_size_t)fread(data, (png_size_t)1, length,
|
if ( !ReadFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) )
|
||||||
(png_FILE_p)png_ptr->io_ptr);
|
check = 0;
|
||||||
#endif
|
#else
|
||||||
|
check = (png_size_t)fread(data, (png_size_t)1, length,
|
||||||
if (check != length)
|
(png_FILE_p)png_ptr->io_ptr);
|
||||||
png_error(png_ptr, "Read Error");
|
#endif
|
||||||
}
|
|
||||||
#else
|
if (check != length)
|
||||||
/* this is the model-independent version. Since the standard I/O library
|
png_error(png_ptr, "Read Error");
|
||||||
can't handle far buffers in the medium and small models, we have to copy
|
}
|
||||||
the data.
|
#else
|
||||||
*/
|
/* this is the model-independent version. Since the standard I/O library
|
||||||
|
can't handle far buffers in the medium and small models, we have to copy
|
||||||
#define NEAR_BUF_SIZE 1024
|
the data.
|
||||||
#define MIN(a,b) (a <= b ? a : b)
|
*/
|
||||||
|
|
||||||
static void /* PRIVATE */
|
#define NEAR_BUF_SIZE 1024
|
||||||
png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
#define MIN(a,b) (a <= b ? a : b)
|
||||||
{
|
|
||||||
int check;
|
static void PNGAPI
|
||||||
png_byte *n_data;
|
png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||||
png_FILE_p io_ptr;
|
{
|
||||||
|
int check;
|
||||||
/* Check if data really is near. If so, use usual code. */
|
png_byte *n_data;
|
||||||
n_data = (png_byte *)CVT_PTR_NOCHECK(data);
|
png_FILE_p io_ptr;
|
||||||
io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr);
|
|
||||||
if ((png_bytep)n_data == data)
|
if(png_ptr == NULL) return;
|
||||||
{
|
/* Check if data really is near. If so, use usual code. */
|
||||||
#if defined(_WIN32_WCE)
|
n_data = (png_byte *)CVT_PTR_NOCHECK(data);
|
||||||
if ( !ReadFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) )
|
io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr);
|
||||||
check = 0;
|
if ((png_bytep)n_data == data)
|
||||||
#else
|
{
|
||||||
check = fread(n_data, 1, length, io_ptr);
|
#if defined(_WIN32_WCE)
|
||||||
#endif
|
if ( !ReadFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) )
|
||||||
}
|
check = 0;
|
||||||
else
|
#else
|
||||||
{
|
check = fread(n_data, 1, length, io_ptr);
|
||||||
png_byte buf[NEAR_BUF_SIZE];
|
#endif
|
||||||
png_size_t read, remaining, err;
|
}
|
||||||
check = 0;
|
else
|
||||||
remaining = length;
|
{
|
||||||
do
|
png_byte buf[NEAR_BUF_SIZE];
|
||||||
{
|
png_size_t read, remaining, err;
|
||||||
read = MIN(NEAR_BUF_SIZE, remaining);
|
check = 0;
|
||||||
#if defined(_WIN32_WCE)
|
remaining = length;
|
||||||
if ( !ReadFile((HANDLE)(io_ptr), buf, read, &err, NULL) )
|
do
|
||||||
err = 0;
|
{
|
||||||
#else
|
read = MIN(NEAR_BUF_SIZE, remaining);
|
||||||
err = fread(buf, (png_size_t)1, read, io_ptr);
|
#if defined(_WIN32_WCE)
|
||||||
#endif
|
if ( !ReadFile((HANDLE)(io_ptr), buf, read, &err, NULL) )
|
||||||
png_memcpy(data, buf, read); /* copy far buffer to near buffer */
|
err = 0;
|
||||||
if(err != read)
|
#else
|
||||||
break;
|
err = fread(buf, (png_size_t)1, read, io_ptr);
|
||||||
else
|
#endif
|
||||||
check += err;
|
png_memcpy(data, buf, read); /* copy far buffer to near buffer */
|
||||||
data += read;
|
if(err != read)
|
||||||
remaining -= read;
|
break;
|
||||||
}
|
else
|
||||||
while (remaining != 0);
|
check += err;
|
||||||
}
|
data += read;
|
||||||
if ((png_uint_32)check != (png_uint_32)length)
|
remaining -= read;
|
||||||
png_error(png_ptr, "read Error");
|
}
|
||||||
}
|
while (remaining != 0);
|
||||||
#endif
|
}
|
||||||
#endif
|
if ((png_uint_32)check != (png_uint_32)length)
|
||||||
|
png_error(png_ptr, "read Error");
|
||||||
/* This function allows the application to supply a new input function
|
}
|
||||||
for libpng if standard C streams aren't being used.
|
#endif
|
||||||
|
#endif
|
||||||
This function takes as its arguments:
|
|
||||||
png_ptr - pointer to a png input data structure
|
/* This function allows the application to supply a new input function
|
||||||
io_ptr - pointer to user supplied structure containing info about
|
for libpng if standard C streams aren't being used.
|
||||||
the input functions. May be NULL.
|
|
||||||
read_data_fn - pointer to a new input function that takes as its
|
This function takes as its arguments:
|
||||||
arguments a pointer to a png_struct, a pointer to
|
png_ptr - pointer to a png input data structure
|
||||||
a location where input data can be stored, and a 32-bit
|
io_ptr - pointer to user supplied structure containing info about
|
||||||
unsigned int that is the number of bytes to be read.
|
the input functions. May be NULL.
|
||||||
To exit and output any fatal error messages the new write
|
read_data_fn - pointer to a new input function that takes as its
|
||||||
function should call png_error(png_ptr, "Error msg"). */
|
arguments a pointer to a png_struct, a pointer to
|
||||||
void PNGAPI
|
a location where input data can be stored, and a 32-bit
|
||||||
png_set_read_fn(png_structp png_ptr, png_voidp io_ptr,
|
unsigned int that is the number of bytes to be read.
|
||||||
png_rw_ptr read_data_fn)
|
To exit and output any fatal error messages the new write
|
||||||
{
|
function should call png_error(png_ptr, "Error msg"). */
|
||||||
png_ptr->io_ptr = io_ptr;
|
void PNGAPI
|
||||||
|
png_set_read_fn(png_structp png_ptr, png_voidp io_ptr,
|
||||||
#if !defined(PNG_NO_STDIO)
|
png_rw_ptr read_data_fn)
|
||||||
if (read_data_fn != NULL)
|
{
|
||||||
png_ptr->read_data_fn = read_data_fn;
|
if(png_ptr == NULL) return;
|
||||||
else
|
png_ptr->io_ptr = io_ptr;
|
||||||
png_ptr->read_data_fn = png_default_read_data;
|
|
||||||
#else
|
#if !defined(PNG_NO_STDIO)
|
||||||
png_ptr->read_data_fn = read_data_fn;
|
if (read_data_fn != NULL)
|
||||||
#endif
|
png_ptr->read_data_fn = read_data_fn;
|
||||||
|
else
|
||||||
/* It is an error to write to a read device */
|
png_ptr->read_data_fn = png_default_read_data;
|
||||||
if (png_ptr->write_data_fn != NULL)
|
#else
|
||||||
{
|
png_ptr->read_data_fn = read_data_fn;
|
||||||
png_ptr->write_data_fn = NULL;
|
#endif
|
||||||
png_warning(png_ptr,
|
|
||||||
"It's an error to set both read_data_fn and write_data_fn in the ");
|
/* It is an error to write to a read device */
|
||||||
png_warning(png_ptr,
|
if (png_ptr->write_data_fn != NULL)
|
||||||
"same structure. Resetting write_data_fn to NULL.");
|
{
|
||||||
}
|
png_ptr->write_data_fn = NULL;
|
||||||
|
png_warning(png_ptr,
|
||||||
#if defined(PNG_WRITE_FLUSH_SUPPORTED)
|
"It's an error to set both read_data_fn and write_data_fn in the ");
|
||||||
png_ptr->output_flush_fn = NULL;
|
png_warning(png_ptr,
|
||||||
#endif
|
"same structure. Resetting write_data_fn to NULL.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(PNG_WRITE_FLUSH_SUPPORTED)
|
||||||
|
png_ptr->output_flush_fn = NULL;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif /* PNG_READ_SUPPORTED */
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -1,228 +1,234 @@
|
||||||
|
|
||||||
/* pngwio.c - functions for data output
|
/* pngwio.c - functions for data output
|
||||||
*
|
*
|
||||||
* libpng 1.2.8 - December 3, 2004
|
* Last changed in libpng 1.2.13 November 13, 2006
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1998-2004 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2006 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
* This file provides a location for all output. Users who need
|
* This file provides a location for all output. Users who need
|
||||||
* special handling are expected to write functions that have the same
|
* special handling are expected to write functions that have the same
|
||||||
* arguments as these and perform similar functions, but that possibly
|
* arguments as these and perform similar functions, but that possibly
|
||||||
* use different output methods. Note that you shouldn't change these
|
* use different output methods. Note that you shouldn't change these
|
||||||
* functions, but rather write replacement functions and then change
|
* functions, but rather write replacement functions and then change
|
||||||
* them at run time with png_set_write_fn(...).
|
* them at run time with png_set_write_fn(...).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
#define PNG_INTERNAL
|
||||||
#include "png.h"
|
#include "png.h"
|
||||||
#ifdef PNG_WRITE_SUPPORTED
|
#ifdef PNG_WRITE_SUPPORTED
|
||||||
|
|
||||||
/* Write the data to whatever output you are using. The default routine
|
/* Write the data to whatever output you are using. The default routine
|
||||||
writes to a file pointer. Note that this routine sometimes gets called
|
writes to a file pointer. Note that this routine sometimes gets called
|
||||||
with very small lengths, so you should implement some kind of simple
|
with very small lengths, so you should implement some kind of simple
|
||||||
buffering if you are using unbuffered writes. This should never be asked
|
buffering if you are using unbuffered writes. This should never be asked
|
||||||
to write more than 64K on a 16 bit machine. */
|
to write more than 64K on a 16 bit machine. */
|
||||||
|
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
png_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||||
{
|
{
|
||||||
if (png_ptr->write_data_fn != NULL )
|
if (png_ptr->write_data_fn != NULL )
|
||||||
(*(png_ptr->write_data_fn))(png_ptr, data, length);
|
(*(png_ptr->write_data_fn))(png_ptr, data, length);
|
||||||
else
|
else
|
||||||
png_error(png_ptr, "Call to NULL write function");
|
png_error(png_ptr, "Call to NULL write function");
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(PNG_NO_STDIO)
|
#if !defined(PNG_NO_STDIO)
|
||||||
/* This is the function that does the actual writing of data. If you are
|
/* This is the function that does the actual writing of data. If you are
|
||||||
not writing to a standard C stream, you should create a replacement
|
not writing to a standard C stream, you should create a replacement
|
||||||
write_data function and use it at run time with png_set_write_fn(), rather
|
write_data function and use it at run time with png_set_write_fn(), rather
|
||||||
than changing the library. */
|
than changing the library. */
|
||||||
#ifndef USE_FAR_KEYWORD
|
#ifndef USE_FAR_KEYWORD
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||||
{
|
{
|
||||||
png_uint_32 check;
|
png_uint_32 check;
|
||||||
|
|
||||||
#if defined(_WIN32_WCE)
|
if(png_ptr == NULL) return;
|
||||||
if ( !WriteFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) )
|
#if defined(_WIN32_WCE)
|
||||||
check = 0;
|
if ( !WriteFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) )
|
||||||
#else
|
check = 0;
|
||||||
check = fwrite(data, 1, length, (png_FILE_p)(png_ptr->io_ptr));
|
#else
|
||||||
#endif
|
check = fwrite(data, 1, length, (png_FILE_p)(png_ptr->io_ptr));
|
||||||
if (check != length)
|
#endif
|
||||||
png_error(png_ptr, "Write Error");
|
if (check != length)
|
||||||
}
|
png_error(png_ptr, "Write Error");
|
||||||
#else
|
}
|
||||||
/* this is the model-independent version. Since the standard I/O library
|
#else
|
||||||
can't handle far buffers in the medium and small models, we have to copy
|
/* this is the model-independent version. Since the standard I/O library
|
||||||
the data.
|
can't handle far buffers in the medium and small models, we have to copy
|
||||||
*/
|
the data.
|
||||||
|
*/
|
||||||
#define NEAR_BUF_SIZE 1024
|
|
||||||
#define MIN(a,b) (a <= b ? a : b)
|
#define NEAR_BUF_SIZE 1024
|
||||||
|
#define MIN(a,b) (a <= b ? a : b)
|
||||||
void PNGAPI
|
|
||||||
png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
void PNGAPI
|
||||||
{
|
png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||||
png_uint_32 check;
|
{
|
||||||
png_byte *near_data; /* Needs to be "png_byte *" instead of "png_bytep" */
|
png_uint_32 check;
|
||||||
png_FILE_p io_ptr;
|
png_byte *near_data; /* Needs to be "png_byte *" instead of "png_bytep" */
|
||||||
|
png_FILE_p io_ptr;
|
||||||
/* Check if data really is near. If so, use usual code. */
|
|
||||||
near_data = (png_byte *)CVT_PTR_NOCHECK(data);
|
if(png_ptr == NULL) return;
|
||||||
io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr);
|
/* Check if data really is near. If so, use usual code. */
|
||||||
if ((png_bytep)near_data == data)
|
near_data = (png_byte *)CVT_PTR_NOCHECK(data);
|
||||||
{
|
io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr);
|
||||||
#if defined(_WIN32_WCE)
|
if ((png_bytep)near_data == data)
|
||||||
if ( !WriteFile(io_ptr, near_data, length, &check, NULL) )
|
{
|
||||||
check = 0;
|
#if defined(_WIN32_WCE)
|
||||||
#else
|
if ( !WriteFile(io_ptr, near_data, length, &check, NULL) )
|
||||||
check = fwrite(near_data, 1, length, io_ptr);
|
check = 0;
|
||||||
#endif
|
#else
|
||||||
}
|
check = fwrite(near_data, 1, length, io_ptr);
|
||||||
else
|
#endif
|
||||||
{
|
}
|
||||||
png_byte buf[NEAR_BUF_SIZE];
|
else
|
||||||
png_size_t written, remaining, err;
|
{
|
||||||
check = 0;
|
png_byte buf[NEAR_BUF_SIZE];
|
||||||
remaining = length;
|
png_size_t written, remaining, err;
|
||||||
do
|
check = 0;
|
||||||
{
|
remaining = length;
|
||||||
written = MIN(NEAR_BUF_SIZE, remaining);
|
do
|
||||||
png_memcpy(buf, data, written); /* copy far buffer to near buffer */
|
{
|
||||||
#if defined(_WIN32_WCE)
|
written = MIN(NEAR_BUF_SIZE, remaining);
|
||||||
if ( !WriteFile(io_ptr, buf, written, &err, NULL) )
|
png_memcpy(buf, data, written); /* copy far buffer to near buffer */
|
||||||
err = 0;
|
#if defined(_WIN32_WCE)
|
||||||
#else
|
if ( !WriteFile(io_ptr, buf, written, &err, NULL) )
|
||||||
err = fwrite(buf, 1, written, io_ptr);
|
err = 0;
|
||||||
#endif
|
#else
|
||||||
if (err != written)
|
err = fwrite(buf, 1, written, io_ptr);
|
||||||
break;
|
#endif
|
||||||
else
|
if (err != written)
|
||||||
check += err;
|
break;
|
||||||
data += written;
|
else
|
||||||
remaining -= written;
|
check += err;
|
||||||
}
|
data += written;
|
||||||
while (remaining != 0);
|
remaining -= written;
|
||||||
}
|
}
|
||||||
if (check != length)
|
while (remaining != 0);
|
||||||
png_error(png_ptr, "Write Error");
|
}
|
||||||
}
|
if (check != length)
|
||||||
|
png_error(png_ptr, "Write Error");
|
||||||
#endif
|
}
|
||||||
#endif
|
|
||||||
|
#endif
|
||||||
/* This function is called to output any data pending writing (normally
|
#endif
|
||||||
to disk). After png_flush is called, there should be no data pending
|
|
||||||
writing in any buffers. */
|
/* This function is called to output any data pending writing (normally
|
||||||
#if defined(PNG_WRITE_FLUSH_SUPPORTED)
|
to disk). After png_flush is called, there should be no data pending
|
||||||
void /* PRIVATE */
|
writing in any buffers. */
|
||||||
png_flush(png_structp png_ptr)
|
#if defined(PNG_WRITE_FLUSH_SUPPORTED)
|
||||||
{
|
void /* PRIVATE */
|
||||||
if (png_ptr->output_flush_fn != NULL)
|
png_flush(png_structp png_ptr)
|
||||||
(*(png_ptr->output_flush_fn))(png_ptr);
|
{
|
||||||
}
|
if (png_ptr->output_flush_fn != NULL)
|
||||||
|
(*(png_ptr->output_flush_fn))(png_ptr);
|
||||||
#if !defined(PNG_NO_STDIO)
|
}
|
||||||
void PNGAPI
|
|
||||||
png_default_flush(png_structp png_ptr)
|
#if !defined(PNG_NO_STDIO)
|
||||||
{
|
void PNGAPI
|
||||||
#if !defined(_WIN32_WCE)
|
png_default_flush(png_structp png_ptr)
|
||||||
png_FILE_p io_ptr;
|
{
|
||||||
io_ptr = (png_FILE_p)CVT_PTR((png_ptr->io_ptr));
|
#if !defined(_WIN32_WCE)
|
||||||
if (io_ptr != NULL)
|
png_FILE_p io_ptr;
|
||||||
fflush(io_ptr);
|
#endif
|
||||||
#endif
|
if(png_ptr == NULL) return;
|
||||||
}
|
#if !defined(_WIN32_WCE)
|
||||||
#endif
|
io_ptr = (png_FILE_p)CVT_PTR((png_ptr->io_ptr));
|
||||||
#endif
|
if (io_ptr != NULL)
|
||||||
|
fflush(io_ptr);
|
||||||
/* This function allows the application to supply new output functions for
|
#endif
|
||||||
libpng if standard C streams aren't being used.
|
}
|
||||||
|
#endif
|
||||||
This function takes as its arguments:
|
#endif
|
||||||
png_ptr - pointer to a png output data structure
|
|
||||||
io_ptr - pointer to user supplied structure containing info about
|
/* This function allows the application to supply new output functions for
|
||||||
the output functions. May be NULL.
|
libpng if standard C streams aren't being used.
|
||||||
write_data_fn - pointer to a new output function that takes as its
|
|
||||||
arguments a pointer to a png_struct, a pointer to
|
This function takes as its arguments:
|
||||||
data to be written, and a 32-bit unsigned int that is
|
png_ptr - pointer to a png output data structure
|
||||||
the number of bytes to be written. The new write
|
io_ptr - pointer to user supplied structure containing info about
|
||||||
function should call png_error(png_ptr, "Error msg")
|
the output functions. May be NULL.
|
||||||
to exit and output any fatal error messages.
|
write_data_fn - pointer to a new output function that takes as its
|
||||||
flush_data_fn - pointer to a new flush function that takes as its
|
arguments a pointer to a png_struct, a pointer to
|
||||||
arguments a pointer to a png_struct. After a call to
|
data to be written, and a 32-bit unsigned int that is
|
||||||
the flush function, there should be no data in any buffers
|
the number of bytes to be written. The new write
|
||||||
or pending transmission. If the output method doesn't do
|
function should call png_error(png_ptr, "Error msg")
|
||||||
any buffering of ouput, a function prototype must still be
|
to exit and output any fatal error messages.
|
||||||
supplied although it doesn't have to do anything. If
|
flush_data_fn - pointer to a new flush function that takes as its
|
||||||
PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile
|
arguments a pointer to a png_struct. After a call to
|
||||||
time, output_flush_fn will be ignored, although it must be
|
the flush function, there should be no data in any buffers
|
||||||
supplied for compatibility. */
|
or pending transmission. If the output method doesn't do
|
||||||
void PNGAPI
|
any buffering of ouput, a function prototype must still be
|
||||||
png_set_write_fn(png_structp png_ptr, png_voidp io_ptr,
|
supplied although it doesn't have to do anything. If
|
||||||
png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn)
|
PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile
|
||||||
{
|
time, output_flush_fn will be ignored, although it must be
|
||||||
png_ptr->io_ptr = io_ptr;
|
supplied for compatibility. */
|
||||||
|
void PNGAPI
|
||||||
#if !defined(PNG_NO_STDIO)
|
png_set_write_fn(png_structp png_ptr, png_voidp io_ptr,
|
||||||
if (write_data_fn != NULL)
|
png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn)
|
||||||
png_ptr->write_data_fn = write_data_fn;
|
{
|
||||||
else
|
if(png_ptr == NULL) return;
|
||||||
png_ptr->write_data_fn = png_default_write_data;
|
png_ptr->io_ptr = io_ptr;
|
||||||
#else
|
|
||||||
png_ptr->write_data_fn = write_data_fn;
|
#if !defined(PNG_NO_STDIO)
|
||||||
#endif
|
if (write_data_fn != NULL)
|
||||||
|
png_ptr->write_data_fn = write_data_fn;
|
||||||
#if defined(PNG_WRITE_FLUSH_SUPPORTED)
|
else
|
||||||
#if !defined(PNG_NO_STDIO)
|
png_ptr->write_data_fn = png_default_write_data;
|
||||||
if (output_flush_fn != NULL)
|
#else
|
||||||
png_ptr->output_flush_fn = output_flush_fn;
|
png_ptr->write_data_fn = write_data_fn;
|
||||||
else
|
#endif
|
||||||
png_ptr->output_flush_fn = png_default_flush;
|
|
||||||
#else
|
#if defined(PNG_WRITE_FLUSH_SUPPORTED)
|
||||||
png_ptr->output_flush_fn = output_flush_fn;
|
#if !defined(PNG_NO_STDIO)
|
||||||
#endif
|
if (output_flush_fn != NULL)
|
||||||
#endif /* PNG_WRITE_FLUSH_SUPPORTED */
|
png_ptr->output_flush_fn = output_flush_fn;
|
||||||
|
else
|
||||||
/* It is an error to read while writing a png file */
|
png_ptr->output_flush_fn = png_default_flush;
|
||||||
if (png_ptr->read_data_fn != NULL)
|
#else
|
||||||
{
|
png_ptr->output_flush_fn = output_flush_fn;
|
||||||
png_ptr->read_data_fn = NULL;
|
#endif
|
||||||
png_warning(png_ptr,
|
#endif /* PNG_WRITE_FLUSH_SUPPORTED */
|
||||||
"Attempted to set both read_data_fn and write_data_fn in");
|
|
||||||
png_warning(png_ptr,
|
/* It is an error to read while writing a png file */
|
||||||
"the same structure. Resetting read_data_fn to NULL.");
|
if (png_ptr->read_data_fn != NULL)
|
||||||
}
|
{
|
||||||
}
|
png_ptr->read_data_fn = NULL;
|
||||||
|
png_warning(png_ptr,
|
||||||
#if defined(USE_FAR_KEYWORD)
|
"Attempted to set both read_data_fn and write_data_fn in");
|
||||||
#if defined(_MSC_VER)
|
png_warning(png_ptr,
|
||||||
void *png_far_to_near(png_structp png_ptr,png_voidp ptr, int check)
|
"the same structure. Resetting read_data_fn to NULL.");
|
||||||
{
|
}
|
||||||
void *near_ptr;
|
}
|
||||||
void FAR *far_ptr;
|
|
||||||
FP_OFF(near_ptr) = FP_OFF(ptr);
|
#if defined(USE_FAR_KEYWORD)
|
||||||
far_ptr = (void FAR *)near_ptr;
|
#if defined(_MSC_VER)
|
||||||
if(check != 0)
|
void *png_far_to_near(png_structp png_ptr,png_voidp ptr, int check)
|
||||||
if(FP_SEG(ptr) != FP_SEG(far_ptr))
|
{
|
||||||
png_error(png_ptr,"segment lost in conversion");
|
void *near_ptr;
|
||||||
return(near_ptr);
|
void FAR *far_ptr;
|
||||||
}
|
FP_OFF(near_ptr) = FP_OFF(ptr);
|
||||||
# else
|
far_ptr = (void FAR *)near_ptr;
|
||||||
void *png_far_to_near(png_structp png_ptr,png_voidp ptr, int check)
|
if(check != 0)
|
||||||
{
|
if(FP_SEG(ptr) != FP_SEG(far_ptr))
|
||||||
void *near_ptr;
|
png_error(png_ptr,"segment lost in conversion");
|
||||||
void FAR *far_ptr;
|
return(near_ptr);
|
||||||
near_ptr = (void FAR *)ptr;
|
}
|
||||||
far_ptr = (void FAR *)near_ptr;
|
# else
|
||||||
if(check != 0)
|
void *png_far_to_near(png_structp png_ptr,png_voidp ptr, int check)
|
||||||
if(far_ptr != ptr)
|
{
|
||||||
png_error(png_ptr,"segment lost in conversion");
|
void *near_ptr;
|
||||||
return(near_ptr);
|
void FAR *far_ptr;
|
||||||
}
|
near_ptr = (void FAR *)ptr;
|
||||||
# endif
|
far_ptr = (void FAR *)near_ptr;
|
||||||
# endif
|
if(check != 0)
|
||||||
#endif /* PNG_WRITE_SUPPORTED */
|
if(far_ptr != ptr)
|
||||||
|
png_error(png_ptr,"segment lost in conversion");
|
||||||
|
return(near_ptr);
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
#endif /* PNG_WRITE_SUPPORTED */
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -38,7 +38,7 @@
|
||||||
See also SystemStats::getJUCEVersion() for a string version.
|
See also SystemStats::getJUCEVersion() for a string version.
|
||||||
*/
|
*/
|
||||||
#define JUCE_MAJOR_VERSION 1
|
#define JUCE_MAJOR_VERSION 1
|
||||||
#define JUCE_MINOR_VERSION 44
|
#define JUCE_MINOR_VERSION 45
|
||||||
|
|
||||||
/** Current Juce version number.
|
/** Current Juce version number.
|
||||||
|
|
||||||
|
|
@ -93,6 +93,10 @@
|
||||||
#include <libkern/OSAtomic.h>
|
#include <libkern/OSAtomic.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if JUCE_LINUX
|
||||||
|
#include <signal.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#if JUCE_MSVC && JUCE_DEBUG
|
#if JUCE_MSVC && JUCE_DEBUG
|
||||||
#include <crtdbg.h>
|
#include <crtdbg.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue