mirror of https://github.com/stella-emu/stella.git
TIA position counters (POSP0, POSM0, etc) in the debugger now show values
in decimal, not hex. All DataGridWidgets (ie, most of the inputs in the debugger) have more strict input filtering, allowing to use $,#,\ specifiers for different bases, as well as restricting input based on the specifier used (ie, if you've entered a '\', only '0' and '1' are allowed, etc). Updated libpng to latest version. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2767 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
04f6a16f97
commit
13c3ca9964
|
@ -18,6 +18,12 @@
|
||||||
PC didn't match the mirror for the current bank. In this case, the
|
PC didn't match the mirror for the current bank. In this case, the
|
||||||
disassembler became confused and didn't properly track the PC address.
|
disassembler became confused and didn't properly track the PC address.
|
||||||
|
|
||||||
|
* Changed display for various TIA position counters to decimal
|
||||||
|
(from hex) in the debugger TIA tab. Related to this, all data input
|
||||||
|
widgets in the debugger UI now have the ability to enter binary,
|
||||||
|
decimal or hex values by using the proper leading character (\, #, $,
|
||||||
|
respectively).
|
||||||
|
|
||||||
* Added ability to modify 'tiadriven' commandline argument to the
|
* Added ability to modify 'tiadriven' commandline argument to the
|
||||||
debugger 'TIA' tab, and 'ramrandom' to the debugger 'I/O' tab. These
|
debugger 'TIA' tab, and 'ramrandom' to the debugger 'I/O' tab. These
|
||||||
options were available for quite some time, but they weren't exposed
|
options were available for quite some time, but they weren't exposed
|
||||||
|
@ -27,6 +33,8 @@
|
||||||
present in the window title bar. Stella could not be expanded in
|
present in the window title bar. Stella could not be expanded in
|
||||||
this way, so the button was removed.
|
this way, so the button was removed.
|
||||||
|
|
||||||
|
* Updated included PNG library to latest stable version.
|
||||||
|
|
||||||
-Have fun!
|
-Have fun!
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -175,7 +175,7 @@ void DebuggerParser::getCompletions(const char* in, StringList& completions) con
|
||||||
// they're valid, or -1 if they're not.
|
// they're valid, or -1 if they're not.
|
||||||
// decipher_arg may be called by the GUI as needed. It is also called
|
// decipher_arg may be called by the GUI as needed. It is also called
|
||||||
// internally by DebuggerParser::run()
|
// internally by DebuggerParser::run()
|
||||||
int DebuggerParser::decipher_arg(const string &str)
|
int DebuggerParser::decipher_arg(const string& str)
|
||||||
{
|
{
|
||||||
bool derefByte=false, derefWord=false, lobyte=false, hibyte=false, bin=false, dec=false;
|
bool derefByte=false, derefWord=false, lobyte=false, hibyte=false, bin=false, dec=false;
|
||||||
int result;
|
int result;
|
||||||
|
@ -205,7 +205,7 @@ int DebuggerParser::decipher_arg(const string &str)
|
||||||
arg.erase(0, 1);
|
arg.erase(0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(arg.substr(0, 1) == "%") {
|
if(arg.substr(0, 1) == "\\") {
|
||||||
bin = true;
|
bin = true;
|
||||||
dec = false;
|
dec = false;
|
||||||
arg.erase(0, 1);
|
arg.erase(0, 1);
|
||||||
|
|
|
@ -306,6 +306,7 @@ bool DataGridWidget::handleKeyDown(StellaKey key, StellaMod mod, char ascii)
|
||||||
switch(key)
|
switch(key)
|
||||||
{
|
{
|
||||||
case KBDK_RETURN:
|
case KBDK_RETURN:
|
||||||
|
case KBDK_KP_ENTER:
|
||||||
if (_currentRow >= 0 && _currentCol >= 0)
|
if (_currentRow >= 0 && _currentCol >= 0)
|
||||||
{
|
{
|
||||||
dirty = true;
|
dirty = true;
|
||||||
|
@ -649,10 +650,33 @@ void DataGridWidget::endEditMode()
|
||||||
if (!_editMode)
|
if (!_editMode)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// send a message that editing finished with a return/enter key press
|
|
||||||
_editMode = false;
|
_editMode = false;
|
||||||
|
|
||||||
// Update the both the string representation and the real data
|
// Update the both the string representation and the real data
|
||||||
|
if(_editString.size() > 0 && !(_editString[0] == '$' ||
|
||||||
|
_editString[0] == '#' || _editString[0] == '\\'))
|
||||||
|
{
|
||||||
|
switch(_base)
|
||||||
|
{
|
||||||
|
case kBASE_16:
|
||||||
|
case kBASE_16_1:
|
||||||
|
case kBASE_16_2:
|
||||||
|
case kBASE_16_4:
|
||||||
|
case kBASE_16_8:
|
||||||
|
_editString.insert(0, 1, '$');
|
||||||
|
break;
|
||||||
|
case kBASE_2:
|
||||||
|
case kBASE_2_8:
|
||||||
|
case kBASE_2_16:
|
||||||
|
_editString.insert(0, 1, '\\');
|
||||||
|
break;
|
||||||
|
case kBASE_10:
|
||||||
|
_editString.insert(0, 1, '#');
|
||||||
|
break;
|
||||||
|
case kBASE_DEFAULT:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
int value = instance().debugger().stringToValue(_editString);
|
int value = instance().debugger().stringToValue(_editString);
|
||||||
if(value < _lowerBound || value >= _upperBound)
|
if(value < _lowerBound || value >= _upperBound)
|
||||||
{
|
{
|
||||||
|
@ -674,16 +698,34 @@ void DataGridWidget::abortEditMode()
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool DataGridWidget::tryInsertChar(char c, int pos)
|
bool DataGridWidget::tryInsertChar(char c, int pos)
|
||||||
{
|
{
|
||||||
// Not sure how efficient this is, or should we even care?
|
// Input is very strict here, to eliminate time-consuming error checking
|
||||||
|
// elsewhere, and includes the following restrictions:
|
||||||
|
// Cannot contain spaces
|
||||||
|
// Starts with leading specifier ($, #, \), or with a base character
|
||||||
|
// Only one specifier is allowed
|
||||||
|
// If starting with a specifier, only allow numbers applicable to that
|
||||||
|
// base to follow
|
||||||
|
|
||||||
c = tolower(c);
|
c = tolower(c);
|
||||||
if((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') ||
|
bool isBin = c == '0' || c == '1',
|
||||||
c == '\\' || c == '#' || c == '$')
|
isDec = c >= '0' && c <= '9',
|
||||||
{
|
isHex = isDec || (c >= 'a' && c <= 'f'),
|
||||||
|
isOp = c == '$' || c == '#' || c == '\\',
|
||||||
|
insert = false;
|
||||||
|
|
||||||
|
if(BSPF_startsWithIgnoreCase(_editString, "$"))
|
||||||
|
insert = isHex && pos > 0;
|
||||||
|
else if(BSPF_startsWithIgnoreCase(_editString, "#"))
|
||||||
|
insert = isDec && pos > 0;
|
||||||
|
else if(BSPF_startsWithIgnoreCase(_editString, "\\"))
|
||||||
|
insert = isBin && pos > 0;
|
||||||
|
else
|
||||||
|
insert = isHex || isDec || isBin || isOp;
|
||||||
|
|
||||||
|
if(insert)
|
||||||
_editString.insert(pos, 1, c);
|
_editString.insert(pos, 1, c);
|
||||||
return true;
|
|
||||||
}
|
return insert;
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -147,6 +147,7 @@ bool PromptWidget::handleKeyDown(StellaKey key, StellaMod mod, char ascii)
|
||||||
switch(key)
|
switch(key)
|
||||||
{
|
{
|
||||||
case KBDK_RETURN:
|
case KBDK_RETURN:
|
||||||
|
case KBDK_KP_ENTER:
|
||||||
{
|
{
|
||||||
nextLine();
|
nextLine();
|
||||||
|
|
||||||
|
|
|
@ -196,13 +196,14 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
// posP0
|
// posP0
|
||||||
xpos += myGRP0->getWidth() + 8;
|
xpos += myGRP0->getWidth() + 8;
|
||||||
t = new StaticTextWidget(boss, font, xpos, ypos+2,
|
t = new StaticTextWidget(boss, font, xpos, ypos+2,
|
||||||
4*fontWidth, fontHeight,
|
6*fontWidth, fontHeight,
|
||||||
"Pos:", kTextAlignLeft);
|
"Pos: #", kTextAlignLeft);
|
||||||
xpos += 4*fontWidth + 5;
|
xpos += t->getWidth() + 2;
|
||||||
myPosP0 = new DataGridWidget(boss, font, xpos, ypos,
|
myPosP0 = new DataGridWidget(boss, font, xpos, ypos,
|
||||||
1, 1, 2, 8, kBASE_16);
|
1, 1, 3, 8, kBASE_10);
|
||||||
myPosP0->setTarget(this);
|
myPosP0->setTarget(this);
|
||||||
myPosP0->setID(kPosP0ID);
|
myPosP0->setID(kPosP0ID);
|
||||||
|
myPosP0->setRange(0, 160);
|
||||||
addFocusWidget(myPosP0);
|
addFocusWidget(myPosP0);
|
||||||
|
|
||||||
// hmP0
|
// hmP0
|
||||||
|
@ -264,13 +265,14 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
|
|
||||||
// posP1
|
// posP1
|
||||||
xpos += myGRP1->getWidth() + 8;
|
xpos += myGRP1->getWidth() + 8;
|
||||||
t = new StaticTextWidget(boss, font, xpos, ypos+2, 4*fontWidth, fontHeight,
|
t = new StaticTextWidget(boss, font, xpos, ypos+2, 6*fontWidth, fontHeight,
|
||||||
"Pos:", kTextAlignLeft);
|
"Pos: #", kTextAlignLeft);
|
||||||
xpos += 4*fontWidth + 5;
|
xpos += t->getWidth() + 2;
|
||||||
myPosP1 = new DataGridWidget(boss, font, xpos, ypos,
|
myPosP1 = new DataGridWidget(boss, font, xpos, ypos,
|
||||||
1, 1, 2, 8, kBASE_16);
|
1, 1, 3, 8, kBASE_10);
|
||||||
myPosP1->setTarget(this);
|
myPosP1->setTarget(this);
|
||||||
myPosP1->setID(kPosP1ID);
|
myPosP1->setID(kPosP1ID);
|
||||||
|
myPosP1->setRange(0, 160);
|
||||||
addFocusWidget(myPosP1);
|
addFocusWidget(myPosP1);
|
||||||
|
|
||||||
// hmP1
|
// hmP1
|
||||||
|
@ -331,13 +333,14 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
|
|
||||||
// posM0
|
// posM0
|
||||||
xpos += myEnaM0->getWidth() + 12;
|
xpos += myEnaM0->getWidth() + 12;
|
||||||
t = new StaticTextWidget(boss, font, xpos, ypos+2, 4*fontWidth, fontHeight,
|
t = new StaticTextWidget(boss, font, xpos, ypos+2, 6*fontWidth, fontHeight,
|
||||||
"Pos:", kTextAlignLeft);
|
"Pos: #", kTextAlignLeft);
|
||||||
xpos += 4*fontWidth + 5;
|
xpos += t->getWidth() + 2;
|
||||||
myPosM0 = new DataGridWidget(boss, font, xpos, ypos,
|
myPosM0 = new DataGridWidget(boss, font, xpos, ypos,
|
||||||
1, 1, 2, 8, kBASE_16);
|
1, 1, 3, 8, kBASE_10);
|
||||||
myPosM0->setTarget(this);
|
myPosM0->setTarget(this);
|
||||||
myPosM0->setID(kPosM0ID);
|
myPosM0->setID(kPosM0ID);
|
||||||
|
myPosM0->setRange(0, 160);
|
||||||
addFocusWidget(myPosM0);
|
addFocusWidget(myPosM0);
|
||||||
|
|
||||||
// hmM0
|
// hmM0
|
||||||
|
@ -386,13 +389,14 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
|
|
||||||
// posM0
|
// posM0
|
||||||
xpos += myEnaM1->getWidth() + 12;
|
xpos += myEnaM1->getWidth() + 12;
|
||||||
t = new StaticTextWidget(boss, font, xpos, ypos+2, 4*fontWidth, fontHeight,
|
t = new StaticTextWidget(boss, font, xpos, ypos+2, 6*fontWidth, fontHeight,
|
||||||
"Pos:", kTextAlignLeft);
|
"Pos: #", kTextAlignLeft);
|
||||||
xpos += 4*fontWidth + 5;
|
xpos += t->getWidth() + 2;
|
||||||
myPosM1 = new DataGridWidget(boss, font, xpos, ypos,
|
myPosM1 = new DataGridWidget(boss, font, xpos, ypos,
|
||||||
1, 1, 2, 8, kBASE_16);
|
1, 1, 3, 8, kBASE_10);
|
||||||
myPosM1->setTarget(this);
|
myPosM1->setTarget(this);
|
||||||
myPosM1->setID(kPosM1ID);
|
myPosM1->setID(kPosM1ID);
|
||||||
|
myPosM1->setRange(0, 160);
|
||||||
addFocusWidget(myPosM1);
|
addFocusWidget(myPosM1);
|
||||||
|
|
||||||
// hmM0
|
// hmM0
|
||||||
|
@ -441,13 +445,14 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
|
|
||||||
// posBL
|
// posBL
|
||||||
xpos += myEnaBL->getWidth() + 12;
|
xpos += myEnaBL->getWidth() + 12;
|
||||||
t = new StaticTextWidget(boss, font, xpos, ypos+2, 4*fontWidth, fontHeight,
|
t = new StaticTextWidget(boss, font, xpos, ypos+2, 6*fontWidth, fontHeight,
|
||||||
"Pos:", kTextAlignLeft);
|
"Pos: #", kTextAlignLeft);
|
||||||
xpos += 4*fontWidth + 5;
|
xpos += t->getWidth() + 2;
|
||||||
myPosBL = new DataGridWidget(boss, font, xpos, ypos,
|
myPosBL = new DataGridWidget(boss, font, xpos, ypos,
|
||||||
1, 1, 2, 8, kBASE_16);
|
1, 1, 3, 8, kBASE_10);
|
||||||
myPosBL->setTarget(this);
|
myPosBL->setTarget(this);
|
||||||
myPosBL->setID(kPosBLID);
|
myPosBL->setID(kPosBLID);
|
||||||
|
myPosBL->setRange(0, 160);
|
||||||
addFocusWidget(myPosBL);
|
addFocusWidget(myPosBL);
|
||||||
|
|
||||||
// hmBL
|
// hmBL
|
||||||
|
|
|
@ -107,6 +107,7 @@ bool ToggleWidget::handleKeyDown(StellaKey key, StellaMod mod, char ascii)
|
||||||
switch(key)
|
switch(key)
|
||||||
{
|
{
|
||||||
case KBDK_RETURN:
|
case KBDK_RETURN:
|
||||||
|
case KBDK_KP_ENTER:
|
||||||
if (_currentRow >= 0 && _currentCol >= 0)
|
if (_currentRow >= 0 && _currentCol >= 0)
|
||||||
{
|
{
|
||||||
dirty = true;
|
dirty = true;
|
||||||
|
|
|
@ -145,7 +145,8 @@ void CompuMate::update()
|
||||||
lp.myDigitalPinState[Controller::Six] = false;
|
lp.myDigitalPinState[Controller::Six] = false;
|
||||||
}
|
}
|
||||||
if (myKeyTable[KBDK_p]) rp.myDigitalPinState[Controller::Three] = false;
|
if (myKeyTable[KBDK_p]) rp.myDigitalPinState[Controller::Three] = false;
|
||||||
if (myKeyTable[KBDK_RETURN]) rp.myDigitalPinState[Controller::Six] = false;
|
if (myKeyTable[KBDK_RETURN] || myKeyTable[KBDK_KP_ENTER])
|
||||||
|
rp.myDigitalPinState[Controller::Six] = false;
|
||||||
if (myKeyTable[KBDK_SPACE]) rp.myDigitalPinState[Controller::Four] = false;
|
if (myKeyTable[KBDK_SPACE]) rp.myDigitalPinState[Controller::Four] = false;
|
||||||
// Emulate Ctrl-space (aka backspace) with the actual Backspace key
|
// Emulate Ctrl-space (aka backspace) with the actual Backspace key
|
||||||
if (myKeyTable[KBDK_BACKSPACE])
|
if (myKeyTable[KBDK_BACKSPACE])
|
||||||
|
|
|
@ -102,6 +102,7 @@ bool EditableWidget::handleKeyDown(StellaKey key, StellaMod mod, char ascii)
|
||||||
switch(key)
|
switch(key)
|
||||||
{
|
{
|
||||||
case KBDK_RETURN:
|
case KBDK_RETURN:
|
||||||
|
case KBDK_KP_ENTER:
|
||||||
// confirm edit and exit editmode
|
// confirm edit and exit editmode
|
||||||
endEditMode();
|
endEditMode();
|
||||||
sendCommand(EditableWidget::kAcceptCmd, 0, _id);
|
sendCommand(EditableWidget::kAcceptCmd, 0, _id);
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
#include "pngpriv.h"
|
#include "pngpriv.h"
|
||||||
|
|
||||||
/* Generate a compiler error if there is an old png.h in the search path. */
|
/* Generate a compiler error if there is an old png.h in the search path. */
|
||||||
typedef png_libpng_version_1_6_2 Your_png_h_is_not_version_1_6_2;
|
typedef png_libpng_version_1_6_3 Your_png_h_is_not_version_1_6_3;
|
||||||
|
|
||||||
/* Tells libpng that we have already handled the first "num_bytes" bytes
|
/* Tells libpng that we have already handled the first "num_bytes" bytes
|
||||||
* of the PNG file signature. If the PNG data is embedded into another
|
* of the PNG file signature. If the PNG data is embedded into another
|
||||||
|
@ -768,13 +768,13 @@ png_get_copyright(png_const_structrp png_ptr)
|
||||||
#else
|
#else
|
||||||
# ifdef __STDC__
|
# ifdef __STDC__
|
||||||
return PNG_STRING_NEWLINE \
|
return PNG_STRING_NEWLINE \
|
||||||
"libpng version 1.6.2 - April 25, 2013" PNG_STRING_NEWLINE \
|
"libpng version 1.6.3 - July 18, 2013" PNG_STRING_NEWLINE \
|
||||||
"Copyright (c) 1998-2013 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
|
"Copyright (c) 1998-2013 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
|
||||||
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
|
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
|
||||||
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
|
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
|
||||||
PNG_STRING_NEWLINE;
|
PNG_STRING_NEWLINE;
|
||||||
# else
|
# else
|
||||||
return "libpng version 1.6.2 - April 25, 2013\
|
return "libpng version 1.6.3 - July 18, 2013\
|
||||||
Copyright (c) 1998-2013 Glenn Randers-Pehrson\
|
Copyright (c) 1998-2013 Glenn Randers-Pehrson\
|
||||||
Copyright (c) 1996-1997 Andreas Dilger\
|
Copyright (c) 1996-1997 Andreas Dilger\
|
||||||
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
|
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
/* png.h - header file for PNG reference library
|
/* png.h - header file for PNG reference library
|
||||||
*
|
*
|
||||||
* libpng version 1.6.2 - April 25, 2013
|
* libpng version 1.6.3 - July 18, 2013
|
||||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2013 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.)
|
||||||
|
@ -11,7 +11,7 @@
|
||||||
* Authors and maintainers:
|
* Authors and maintainers:
|
||||||
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
|
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
|
||||||
* libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
|
* libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
|
||||||
* libpng versions 0.97, January 1998, through 1.6.2 - April 25, 2013: Glenn
|
* libpng versions 0.97, January 1998, through 1.6.3 - July 18, 2013: Glenn
|
||||||
* See also "Contributing Authors", below.
|
* See also "Contributing Authors", below.
|
||||||
*
|
*
|
||||||
* Note about libpng version numbers:
|
* Note about libpng version numbers:
|
||||||
|
@ -175,6 +175,9 @@
|
||||||
* 1.6.2beta01 16 10602 16.so.16.2[.0]
|
* 1.6.2beta01 16 10602 16.so.16.2[.0]
|
||||||
* 1.6.2rc01-06 16 10602 16.so.16.2[.0]
|
* 1.6.2rc01-06 16 10602 16.so.16.2[.0]
|
||||||
* 1.6.2 16 10602 16.so.16.2[.0]
|
* 1.6.2 16 10602 16.so.16.2[.0]
|
||||||
|
* 1.6.3beta01-11 16 10603 16.so.16.3[.0]
|
||||||
|
* 1.6.3rc01 16 10603 16.so.16.3[.0]
|
||||||
|
* 1.6.3 16 10603 16.so.16.3[.0]
|
||||||
*
|
*
|
||||||
* Henceforth the source version will match the shared-library major
|
* Henceforth the source version will match the shared-library major
|
||||||
* and minor numbers; the shared-library major version number will be
|
* and minor numbers; the shared-library major version number will be
|
||||||
|
@ -206,7 +209,7 @@
|
||||||
*
|
*
|
||||||
* This code is released under the libpng license.
|
* This code is released under the libpng license.
|
||||||
*
|
*
|
||||||
* libpng versions 1.2.6, August 15, 2004, through 1.6.2, April 25, 2013, are
|
* libpng versions 1.2.6, August 15, 2004, through 1.6.3, July 18, 2013, are
|
||||||
* Copyright (c) 2004, 2006-2013 Glenn Randers-Pehrson, and are
|
* Copyright (c) 2004, 2006-2013 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:
|
||||||
|
@ -318,13 +321,13 @@
|
||||||
* Y2K compliance in libpng:
|
* Y2K compliance in libpng:
|
||||||
* =========================
|
* =========================
|
||||||
*
|
*
|
||||||
* April 25, 2013
|
* July 18, 2013
|
||||||
*
|
*
|
||||||
* Since the PNG Development group is an ad-hoc body, we can't make
|
* Since the PNG Development group is an ad-hoc body, we can't make
|
||||||
* an official declaration.
|
* an official declaration.
|
||||||
*
|
*
|
||||||
* This is your unofficial assurance that libpng from version 0.71 and
|
* This is your unofficial assurance that libpng from version 0.71 and
|
||||||
* upward through 1.6.2 are Y2K compliant. It is my belief that
|
* upward through 1.6.3 are Y2K compliant. It is my belief that
|
||||||
* earlier versions were also Y2K compliant.
|
* earlier versions were also Y2K compliant.
|
||||||
*
|
*
|
||||||
* Libpng only has two year fields. One is a 2-byte unsigned integer
|
* Libpng only has two year fields. One is a 2-byte unsigned integer
|
||||||
|
@ -384,9 +387,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Version information for png.h - this should match the version in png.c */
|
/* Version information for png.h - this should match the version in png.c */
|
||||||
#define PNG_LIBPNG_VER_STRING "1.6.2"
|
#define PNG_LIBPNG_VER_STRING "1.6.3"
|
||||||
#define PNG_HEADER_VERSION_STRING \
|
#define PNG_HEADER_VERSION_STRING \
|
||||||
" libpng version 1.6.2 - April 25, 2013\n"
|
" libpng version 1.6.3 - July 18, 2013\n"
|
||||||
|
|
||||||
#define PNG_LIBPNG_VER_SONUM 16
|
#define PNG_LIBPNG_VER_SONUM 16
|
||||||
#define PNG_LIBPNG_VER_DLLNUM 16
|
#define PNG_LIBPNG_VER_DLLNUM 16
|
||||||
|
@ -394,7 +397,7 @@
|
||||||
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
|
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
|
||||||
#define PNG_LIBPNG_VER_MAJOR 1
|
#define PNG_LIBPNG_VER_MAJOR 1
|
||||||
#define PNG_LIBPNG_VER_MINOR 6
|
#define PNG_LIBPNG_VER_MINOR 6
|
||||||
#define PNG_LIBPNG_VER_RELEASE 2
|
#define PNG_LIBPNG_VER_RELEASE 3
|
||||||
|
|
||||||
/* This should match the numeric part of the final component of
|
/* This should match the numeric part of the final component of
|
||||||
* PNG_LIBPNG_VER_STRING, omitting any leading zero:
|
* PNG_LIBPNG_VER_STRING, omitting any leading zero:
|
||||||
|
@ -425,7 +428,7 @@
|
||||||
* version 1.0.0 was mis-numbered 100 instead of 10000). From
|
* version 1.0.0 was mis-numbered 100 instead of 10000). From
|
||||||
* version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release
|
* version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release
|
||||||
*/
|
*/
|
||||||
#define PNG_LIBPNG_VER 10602 /* 1.6.2 */
|
#define PNG_LIBPNG_VER 10603 /* 1.6.3 */
|
||||||
|
|
||||||
/* Library configuration: these options cannot be changed after
|
/* Library configuration: these options cannot be changed after
|
||||||
* the library has been built.
|
* the library has been built.
|
||||||
|
@ -530,7 +533,7 @@ extern "C" {
|
||||||
/* This triggers a compiler error in png.c, if png.c and png.h
|
/* This triggers a compiler error in png.c, if png.c and png.h
|
||||||
* do not agree upon the version number.
|
* do not agree upon the version number.
|
||||||
*/
|
*/
|
||||||
typedef char* png_libpng_version_1_6_2;
|
typedef char* png_libpng_version_1_6_3;
|
||||||
|
|
||||||
/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
|
/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
|
||||||
*
|
*
|
||||||
|
@ -3186,6 +3189,7 @@ PNG_EXPORT(238, void, png_image_free, (png_imagep image));
|
||||||
#endif /* PNG_SIMPLIFIED_READ_SUPPORTED */
|
#endif /* PNG_SIMPLIFIED_READ_SUPPORTED */
|
||||||
|
|
||||||
#ifdef PNG_SIMPLIFIED_WRITE_SUPPORTED
|
#ifdef PNG_SIMPLIFIED_WRITE_SUPPORTED
|
||||||
|
#ifdef PNG_STDIO_SUPPORTED
|
||||||
/* WRITE APIS
|
/* WRITE APIS
|
||||||
* ----------
|
* ----------
|
||||||
* For write you must initialize a png_image structure to describe the image to
|
* For write you must initialize a png_image structure to describe the image to
|
||||||
|
@ -3228,6 +3232,7 @@ PNG_EXPORT(240, int, png_image_write_to_stdio, (png_imagep image, FILE *file,
|
||||||
*
|
*
|
||||||
* Note that the write API does not support interlacing or sub-8-bit pixels.
|
* Note that the write API does not support interlacing or sub-8-bit pixels.
|
||||||
*/
|
*/
|
||||||
|
#endif /* PNG_STDIO_SUPPORTED */
|
||||||
#endif /* PNG_SIMPLIFIED_WRITE_SUPPORTED */
|
#endif /* PNG_SIMPLIFIED_WRITE_SUPPORTED */
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* END OF SIMPLIFIED API
|
* END OF SIMPLIFIED API
|
||||||
|
@ -3267,7 +3272,8 @@ PNG_EXPORT(243, int, png_get_palette_max, (png_const_structp png_ptr,
|
||||||
#ifdef PNG_ARM_NEON_API_SUPPORTED
|
#ifdef PNG_ARM_NEON_API_SUPPORTED
|
||||||
# define PNG_ARM_NEON 0 /* HARDWARE: ARM Neon SIMD instructions supported */
|
# define PNG_ARM_NEON 0 /* HARDWARE: ARM Neon SIMD instructions supported */
|
||||||
#endif
|
#endif
|
||||||
#define PNG_OPTION_NEXT 2 /* Next option - numbers must be even */
|
#define PNG_MAXIMUM_INFLATE_WINDOW 2 /* SOFTWARE: force maximum window */
|
||||||
|
#define PNG_OPTION_NEXT 4 /* Next option - numbers must be even */
|
||||||
|
|
||||||
/* Return values: NOTE: there are four values and 'off' is *not* zero */
|
/* Return values: NOTE: there are four values and 'off' is *not* zero */
|
||||||
#define PNG_OPTION_UNSET 0 /* Unset - defaults to off */
|
#define PNG_OPTION_UNSET 0 /* Unset - defaults to off */
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
/* pngconf.h - machine configurable file for libpng
|
/* pngconf.h - machine configurable file for libpng
|
||||||
*
|
*
|
||||||
* libpng version 1.6.2 - April 25, 2013
|
* libpng version 1.6.3 - July 18, 2013
|
||||||
*
|
*
|
||||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
|
@ -238,6 +238,7 @@
|
||||||
# define PNGAPI _stdcall
|
# define PNGAPI _stdcall
|
||||||
# endif
|
# endif
|
||||||
# endif /* compiler/api */
|
# endif /* compiler/api */
|
||||||
|
|
||||||
/* NOTE: PNGCBAPI always defaults to PNGCAPI. */
|
/* NOTE: PNGCBAPI always defaults to PNGCAPI. */
|
||||||
|
|
||||||
# if defined(PNGAPI) && !defined(PNG_USER_PRIVATEBUILD)
|
# if defined(PNGAPI) && !defined(PNG_USER_PRIVATEBUILD)
|
||||||
|
|
|
@ -151,7 +151,7 @@ png_process_some_data(png_structrp png_ptr, png_inforp info_ptr)
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_push_read_sig(png_structrp png_ptr, png_inforp info_ptr)
|
png_push_read_sig(png_structrp png_ptr, png_inforp info_ptr)
|
||||||
{
|
{
|
||||||
png_size_t num_checked = png_ptr->sig_bytes,
|
png_size_t num_checked = png_ptr->sig_bytes, /* SAFE, does not exceed 8 */
|
||||||
num_to_check = 8 - num_checked;
|
num_to_check = 8 - num_checked;
|
||||||
|
|
||||||
if (png_ptr->buffer_size < num_to_check)
|
if (png_ptr->buffer_size < num_to_check)
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* (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.)
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.6.2 [April 25, 2013]
|
* Last changed in libpng 1.6.3 [July 18, 2013]
|
||||||
*
|
*
|
||||||
* This code is released under the libpng license.
|
* This code is released under the libpng license.
|
||||||
* For conditions of distribution and use, see the disclaimer
|
* For conditions of distribution and use, see the disclaimer
|
||||||
|
@ -88,6 +88,46 @@
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Compile time options.
|
||||||
|
* =====================
|
||||||
|
* In a multi-arch build the compiler may compile the code several times for the
|
||||||
|
* same object module, producing different binaries for different architectures.
|
||||||
|
* When this happens configure-time setting of the target host options cannot be
|
||||||
|
* done and this interferes with the handling of the ARM NEON optimizations, and
|
||||||
|
* possibly other similar optimizations. Put additional tests here; in general
|
||||||
|
* this is needed when the same option can be changed at both compile time and
|
||||||
|
* run time depending on the target OS (i.e. iOS vs Android.)
|
||||||
|
*
|
||||||
|
* NOTE: symbol prefixing does not pass $(CFLAGS) to the preprocessor, because
|
||||||
|
* this is not possible with certain compilers (Oracle SUN OS CC), as a result
|
||||||
|
* it is necessary to ensure that all extern functions that *might* be used
|
||||||
|
* regardless of $(CFLAGS) get declared in this file. The test on __ARM_NEON__
|
||||||
|
* below is one example of this behavior because it is controlled by the
|
||||||
|
* presence or not of -mfpu=neon on the GCC command line, it is possible to do
|
||||||
|
* this in $(CC), e.g. "CC=gcc -mfpu=neon", but people who build libpng rarely
|
||||||
|
* do this.
|
||||||
|
*/
|
||||||
|
#ifndef PNG_ARM_NEON_OPT
|
||||||
|
/* ARM NEON optimizations are being controlled by the compiler settings,
|
||||||
|
* typically the target FPU. If the FPU has been set to NEON (-mfpu=neon
|
||||||
|
* with GCC) then the compiler will define __ARM_NEON__ and we can rely
|
||||||
|
* unconditionally on NEON instructions not crashing, otherwise we must
|
||||||
|
* disable use of NEON instructions:
|
||||||
|
*/
|
||||||
|
# ifdef __ARM_NEON__
|
||||||
|
# define PNG_ARM_NEON_OPT 2
|
||||||
|
# else
|
||||||
|
# define PNG_ARM_NEON_OPT 0
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if PNG_ARM_NEON_OPT > 0
|
||||||
|
/* NEON optimizations are to be at least considered by libpng, so enable the
|
||||||
|
* callbacks to do this.
|
||||||
|
*/
|
||||||
|
# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_neon
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Is this a build of a DLL where compilation of the object modules requires
|
/* Is this a build of a DLL where compilation of the object modules requires
|
||||||
* different preprocessor settings to those required for a simple library? If
|
* different preprocessor settings to those required for a simple library? If
|
||||||
* so PNG_BUILD_DLL must be set.
|
* so PNG_BUILD_DLL must be set.
|
||||||
|
@ -630,37 +670,64 @@
|
||||||
* architectures where (int) is only 16 bits.
|
* architectures where (int) is only 16 bits.
|
||||||
*/
|
*/
|
||||||
#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
|
#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
|
||||||
#define PNG_CHUNK(b1,b2,b3,b4) \
|
#define PNG_U32(b1,b2,b3,b4) \
|
||||||
(PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
|
(PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
|
||||||
|
|
||||||
#define png_IHDR PNG_CHUNK( 73, 72, 68, 82)
|
/* Constants for known chunk types.
|
||||||
#define png_IDAT PNG_CHUNK( 73, 68, 65, 84)
|
*
|
||||||
#define png_IEND PNG_CHUNK( 73, 69, 78, 68)
|
* MAINTAINERS: If you need to add a chunk, define the name here.
|
||||||
#define png_PLTE PNG_CHUNK( 80, 76, 84, 69)
|
* For historical reasons these constants have the form png_<name>; i.e.
|
||||||
#define png_bKGD PNG_CHUNK( 98, 75, 71, 68)
|
* the prefix is lower case. Please use decimal values as the parameters to
|
||||||
#define png_cHRM PNG_CHUNK( 99, 72, 82, 77)
|
* match the ISO PNG specification and to avoid relying on the C locale
|
||||||
#define png_gAMA PNG_CHUNK(103, 65, 77, 65)
|
* interpretation of character values. Please keep the list sorted.
|
||||||
#define png_hIST PNG_CHUNK(104, 73, 83, 84)
|
*
|
||||||
#define png_iCCP PNG_CHUNK(105, 67, 67, 80)
|
* Notice that PNG_U32 is used to define a 32-bit value for the 4 byte chunk
|
||||||
#define png_iTXt PNG_CHUNK(105, 84, 88, 116)
|
* type. In fact the specification does not express chunk types this way,
|
||||||
#define png_oFFs PNG_CHUNK(111, 70, 70, 115)
|
* however using a 32-bit value means that the chunk type can be read from the
|
||||||
#define png_pCAL PNG_CHUNK(112, 67, 65, 76)
|
* stream using exactly the same code as used for a 32-bit unsigned value and
|
||||||
#define png_sCAL PNG_CHUNK(115, 67, 65, 76)
|
* can be examined far more efficiently (using one arithmetic compare).
|
||||||
#define png_pHYs PNG_CHUNK(112, 72, 89, 115)
|
*
|
||||||
#define png_sBIT PNG_CHUNK(115, 66, 73, 84)
|
* Prior to 1.5.6 the chunk type constants were expressed as C strings. The
|
||||||
#define png_sPLT PNG_CHUNK(115, 80, 76, 84)
|
* libpng API still uses strings for 'unknown' chunks and a macro,
|
||||||
#define png_sRGB PNG_CHUNK(115, 82, 71, 66)
|
* PNG_STRING_FROM_CHUNK, allows a string to be generated if required. Notice
|
||||||
#define png_sTER PNG_CHUNK(115, 84, 69, 82)
|
* that for portable code numeric values must still be used; the string "IHDR"
|
||||||
#define png_tEXt PNG_CHUNK(116, 69, 88, 116)
|
* is not portable and neither is PNG_U32('I', 'H', 'D', 'R').
|
||||||
#define png_tIME PNG_CHUNK(116, 73, 77, 69)
|
*
|
||||||
#define png_tRNS PNG_CHUNK(116, 82, 78, 83)
|
* In 1.7.0 the definitions will be made public in png.h to avoid having to
|
||||||
#define png_zTXt PNG_CHUNK(122, 84, 88, 116)
|
* duplicate the same definitions in application code.
|
||||||
|
*/
|
||||||
|
#define png_IDAT PNG_U32( 73, 68, 65, 84)
|
||||||
|
#define png_IEND PNG_U32( 73, 69, 78, 68)
|
||||||
|
#define png_IHDR PNG_U32( 73, 72, 68, 82)
|
||||||
|
#define png_PLTE PNG_U32( 80, 76, 84, 69)
|
||||||
|
#define png_bKGD PNG_U32( 98, 75, 71, 68)
|
||||||
|
#define png_cHRM PNG_U32( 99, 72, 82, 77)
|
||||||
|
#define png_fRAc PNG_U32(102, 82, 65, 99) /* registered, not defined */
|
||||||
|
#define png_gAMA PNG_U32(103, 65, 77, 65)
|
||||||
|
#define png_gIFg PNG_U32(103, 73, 70, 103)
|
||||||
|
#define png_gIFt PNG_U32(103, 73, 70, 116) /* deprecated */
|
||||||
|
#define png_gIFx PNG_U32(103, 73, 70, 120)
|
||||||
|
#define png_hIST PNG_U32(104, 73, 83, 84)
|
||||||
|
#define png_iCCP PNG_U32(105, 67, 67, 80)
|
||||||
|
#define png_iTXt PNG_U32(105, 84, 88, 116)
|
||||||
|
#define png_oFFs PNG_U32(111, 70, 70, 115)
|
||||||
|
#define png_pCAL PNG_U32(112, 67, 65, 76)
|
||||||
|
#define png_pHYs PNG_U32(112, 72, 89, 115)
|
||||||
|
#define png_sBIT PNG_U32(115, 66, 73, 84)
|
||||||
|
#define png_sCAL PNG_U32(115, 67, 65, 76)
|
||||||
|
#define png_sPLT PNG_U32(115, 80, 76, 84)
|
||||||
|
#define png_sRGB PNG_U32(115, 82, 71, 66)
|
||||||
|
#define png_sTER PNG_U32(115, 84, 69, 82)
|
||||||
|
#define png_tEXt PNG_U32(116, 69, 88, 116)
|
||||||
|
#define png_tIME PNG_U32(116, 73, 77, 69)
|
||||||
|
#define png_tRNS PNG_U32(116, 82, 78, 83)
|
||||||
|
#define png_zTXt PNG_U32(122, 84, 88, 116)
|
||||||
|
|
||||||
/* The following will work on (signed char*) strings, whereas the get_uint_32
|
/* The following will work on (signed char*) strings, whereas the get_uint_32
|
||||||
* macro will fail on top-bit-set values because of the sign extension.
|
* macro will fail on top-bit-set values because of the sign extension.
|
||||||
*/
|
*/
|
||||||
#define PNG_CHUNK_FROM_STRING(s)\
|
#define PNG_CHUNK_FROM_STRING(s)\
|
||||||
PNG_CHUNK(0xff&(s)[0], 0xff&(s)[1], 0xff&(s)[2], 0xff&(s)[3])
|
PNG_U32(0xff&(s)[0], 0xff&(s)[1], 0xff&(s)[2], 0xff&(s)[3])
|
||||||
|
|
||||||
/* This uses (char), not (png_byte) to avoid warnings on systems where (char) is
|
/* This uses (char), not (png_byte) to avoid warnings on systems where (char) is
|
||||||
* signed and the argument is a (char[]) This macro will fail miserably on
|
* signed and the argument is a (char[]) This macro will fail miserably on
|
||||||
|
@ -694,6 +761,24 @@
|
||||||
#include "pngstruct.h"
|
#include "pngstruct.h"
|
||||||
#include "pnginfo.h"
|
#include "pnginfo.h"
|
||||||
|
|
||||||
|
/* Validate the include paths - the include path used to generate pnglibconf.h
|
||||||
|
* must match that used in the build, or we must be using pnglibconf.h.prebuilt:
|
||||||
|
*/
|
||||||
|
#if PNG_ZLIB_VERNUM != 0 && PNG_ZLIB_VERNUM != ZLIB_VERNUM
|
||||||
|
# error ZLIB_VERNUM != PNG_ZLIB_VERNUM \
|
||||||
|
"-I (include path) error: see the notes in pngpriv.h"
|
||||||
|
/* This means that when pnglibconf.h was built the copy of zlib.h that it
|
||||||
|
* used is not the same as the one being used here. Because the build of
|
||||||
|
* libpng makes decisions to use inflateInit2 and inflateReset2 based on the
|
||||||
|
* zlib version number and because this affects handling of certain broken
|
||||||
|
* PNG files the -I directives must match.
|
||||||
|
*
|
||||||
|
* The most likely explanation is that you passed a -I in CFLAGS, this will
|
||||||
|
* not work; all the preprocessor directories and in particular all the -I
|
||||||
|
* directives must be in CPPFLAGS.
|
||||||
|
*/
|
||||||
|
#endif
|
||||||
|
|
||||||
/* This is used for 16 bit gamma tables -- only the top level pointers are
|
/* This is used for 16 bit gamma tables -- only the top level pointers are
|
||||||
* const; this could be changed:
|
* const; this could be changed:
|
||||||
*/
|
*/
|
||||||
|
@ -1891,14 +1976,22 @@ PNG_INTERNAL_FUNCTION(void, png_image_free, (png_imagep image), PNG_EMPTY);
|
||||||
|
|
||||||
#endif /* SIMPLIFIED READ/WRITE */
|
#endif /* SIMPLIFIED READ/WRITE */
|
||||||
|
|
||||||
|
/* These are initialization functions for hardware specific PNG filter
|
||||||
|
* optimizations; list these here then select the appropriate one at compile
|
||||||
|
* time using the macro PNG_FILTER_OPTIMIZATIONS. If the macro is not defined
|
||||||
|
* the generic code is used.
|
||||||
|
*/
|
||||||
#ifdef PNG_FILTER_OPTIMIZATIONS
|
#ifdef PNG_FILTER_OPTIMIZATIONS
|
||||||
PNG_INTERNAL_FUNCTION(void, PNG_FILTER_OPTIMIZATIONS, (png_structp png_ptr,
|
PNG_INTERNAL_FUNCTION(void, PNG_FILTER_OPTIMIZATIONS, (png_structp png_ptr,
|
||||||
unsigned int bpp), PNG_EMPTY);
|
unsigned int bpp), PNG_EMPTY);
|
||||||
/* This is the initialization function for hardware specific optimizations,
|
/* Just declare the optimization that will be used */
|
||||||
* one implementation (for ARM NEON machines) is contained in
|
#else
|
||||||
* arm/filter_neon.c. It need not be defined - the generic code will be used
|
/* List *all* the possible optimizations here - this branch is required if
|
||||||
* if not.
|
* the builder of libpng passes the definition of PNG_FILTER_OPTIMIZATIONS in
|
||||||
|
* CFLAGS in place of CPPFLAGS *and* uses symbol prefixing.
|
||||||
*/
|
*/
|
||||||
|
PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_neon,
|
||||||
|
(png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Maintainer: Put new private prototypes here ^ */
|
/* Maintainer: Put new private prototypes here ^ */
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
/* pngrutil.c - utilities to read a PNG file
|
/* pngrutil.c - utilities to read a PNG file
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.6.2 [April 25, 2013]
|
* Last changed in libpng 1.6.3 [July 18, 2013]
|
||||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2013 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.)
|
||||||
|
@ -18,8 +18,6 @@
|
||||||
|
|
||||||
#ifdef PNG_READ_SUPPORTED
|
#ifdef PNG_READ_SUPPORTED
|
||||||
|
|
||||||
#define png_strtod(p,a,b) strtod(a,b)
|
|
||||||
|
|
||||||
png_uint_32 PNGAPI
|
png_uint_32 PNGAPI
|
||||||
png_get_uint_31(png_const_structrp png_ptr, png_const_bytep buf)
|
png_get_uint_31(png_const_structrp png_ptr, png_const_bytep buf)
|
||||||
{
|
{
|
||||||
|
@ -334,7 +332,7 @@ png_read_buffer(png_structrp png_ptr, png_alloc_size_t new_size, int warn)
|
||||||
* chunk apparently owns the stream. Prior to release it does a png_error.
|
* chunk apparently owns the stream. Prior to release it does a png_error.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
png_inflate_claim(png_structrp png_ptr, png_uint_32 owner, int window_bits)
|
png_inflate_claim(png_structrp png_ptr, png_uint_32 owner)
|
||||||
{
|
{
|
||||||
if (png_ptr->zowner != 0)
|
if (png_ptr->zowner != 0)
|
||||||
{
|
{
|
||||||
|
@ -369,6 +367,22 @@ png_inflate_claim(png_structrp png_ptr, png_uint_32 owner, int window_bits)
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
int ret; /* zlib return code */
|
int ret; /* zlib return code */
|
||||||
|
# if PNG_ZLIB_VERNUM >= 0x1240
|
||||||
|
|
||||||
|
# if defined(PNG_SET_OPTION_SUPPORTED) && \
|
||||||
|
defined(PNG_MAXIMUM_INFLATE_WINDOW)
|
||||||
|
int window_bits;
|
||||||
|
|
||||||
|
if (((png_ptr->options >> PNG_MAXIMUM_INFLATE_WINDOW) & 3) ==
|
||||||
|
PNG_OPTION_ON)
|
||||||
|
window_bits = 15;
|
||||||
|
|
||||||
|
else
|
||||||
|
window_bits = 0;
|
||||||
|
# else
|
||||||
|
# define window_bits 0
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
|
||||||
/* Set this for safety, just in case the previous owner left pointers to
|
/* Set this for safety, just in case the previous owner left pointers to
|
||||||
* memory allocations.
|
* memory allocations.
|
||||||
|
@ -380,8 +394,7 @@ png_inflate_claim(png_structrp png_ptr, png_uint_32 owner, int window_bits)
|
||||||
|
|
||||||
if (png_ptr->flags & PNG_FLAG_ZSTREAM_INITIALIZED)
|
if (png_ptr->flags & PNG_FLAG_ZSTREAM_INITIALIZED)
|
||||||
{
|
{
|
||||||
# if ZLIB_VERNUM < 0x1240
|
# if PNG_ZLIB_VERNUM < 0x1240
|
||||||
PNG_UNUSED(window_bits)
|
|
||||||
ret = inflateReset(&png_ptr->zstream);
|
ret = inflateReset(&png_ptr->zstream);
|
||||||
# else
|
# else
|
||||||
ret = inflateReset2(&png_ptr->zstream, window_bits);
|
ret = inflateReset2(&png_ptr->zstream, window_bits);
|
||||||
|
@ -390,7 +403,7 @@ png_inflate_claim(png_structrp png_ptr, png_uint_32 owner, int window_bits)
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
# if ZLIB_VERNUM < 0x1240
|
# if PNG_ZLIB_VERNUM < 0x1240
|
||||||
ret = inflateInit(&png_ptr->zstream);
|
ret = inflateInit(&png_ptr->zstream);
|
||||||
# else
|
# else
|
||||||
ret = inflateInit2(&png_ptr->zstream, window_bits);
|
ret = inflateInit2(&png_ptr->zstream, window_bits);
|
||||||
|
@ -408,6 +421,10 @@ png_inflate_claim(png_structrp png_ptr, png_uint_32 owner, int window_bits)
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ifdef window_bits
|
||||||
|
# undef window_bits
|
||||||
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PNG_READ_COMPRESSED_TEXT_SUPPORTED
|
#ifdef PNG_READ_COMPRESSED_TEXT_SUPPORTED
|
||||||
|
@ -580,14 +597,8 @@ png_decompress_chunk(png_structrp png_ptr,
|
||||||
if (limit < *newlength)
|
if (limit < *newlength)
|
||||||
*newlength = limit;
|
*newlength = limit;
|
||||||
|
|
||||||
/* Now try to claim the stream; the 'warn' setting causes zlib to be told
|
/* Now try to claim the stream. */
|
||||||
* to use the maximum window size during inflate; this hides errors in the
|
ret = png_inflate_claim(png_ptr, png_ptr->chunk_name);
|
||||||
* deflate header window bits value which is used if '0' is passed. In
|
|
||||||
* fact this only has an effect with zlib versions 1.2.4 and later - see
|
|
||||||
* the comments in png_inflate_claim above.
|
|
||||||
*/
|
|
||||||
ret = png_inflate_claim(png_ptr, png_ptr->chunk_name,
|
|
||||||
png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN ? 15 : 0);
|
|
||||||
|
|
||||||
if (ret == Z_OK)
|
if (ret == Z_OK)
|
||||||
{
|
{
|
||||||
|
@ -1357,8 +1368,7 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
||||||
{
|
{
|
||||||
read_length -= keyword_length+2;
|
read_length -= keyword_length+2;
|
||||||
|
|
||||||
if (png_inflate_claim(png_ptr, png_iCCP,
|
if (png_inflate_claim(png_ptr, png_iCCP) == Z_OK)
|
||||||
png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN ? 15 : 0) == Z_OK)
|
|
||||||
{
|
{
|
||||||
Byte profile_header[132];
|
Byte profile_header[132];
|
||||||
Byte local_buffer[PNG_INFLATE_BUF_SIZE];
|
Byte local_buffer[PNG_INFLATE_BUF_SIZE];
|
||||||
|
@ -3684,7 +3694,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
||||||
|
|
||||||
for (i = 0; i < row_info->width; i++)
|
for (i = 0; i < row_info->width; i++)
|
||||||
{
|
{
|
||||||
png_byte v[8];
|
png_byte v[8]; /* SAFE; pixel_depth does not exceed 64 */
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
memcpy(v, sp, pixel_bytes);
|
memcpy(v, sp, pixel_bytes);
|
||||||
|
@ -4454,7 +4464,7 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
|
||||||
* IDAT stream has a bogus deflate header window_bits value, but this should
|
* IDAT stream has a bogus deflate header window_bits value, but this should
|
||||||
* not be happening any longer!)
|
* not be happening any longer!)
|
||||||
*/
|
*/
|
||||||
if (png_inflate_claim(png_ptr, png_IDAT, 0) != Z_OK)
|
if (png_inflate_claim(png_ptr, png_IDAT) != Z_OK)
|
||||||
png_error(png_ptr, png_ptr->zstream.msg);
|
png_error(png_ptr, png_ptr->zstream.msg);
|
||||||
|
|
||||||
png_ptr->flags |= PNG_FLAG_ROW_INIT;
|
png_ptr->flags |= PNG_FLAG_ROW_INIT;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
/* pngset.c - storage of image information into info struct
|
/* pngset.c - storage of image information into info struct
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.6.2 [April 25, 2013]
|
* Last changed in libpng 1.6.3 [July 18, 2013]
|
||||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2013 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.)
|
||||||
|
@ -238,16 +238,7 @@ png_set_IHDR(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
|
|
||||||
info_ptr->pixel_depth = (png_byte)(info_ptr->channels * info_ptr->bit_depth);
|
info_ptr->pixel_depth = (png_byte)(info_ptr->channels * info_ptr->bit_depth);
|
||||||
|
|
||||||
/* Check for potential overflow */
|
info_ptr->rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth, width);
|
||||||
if (width >
|
|
||||||
(PNG_UINT_32_MAX >> 3) /* 8-byte RRGGBBAA pixels */
|
|
||||||
- 48 /* bigrowbuf hack */
|
|
||||||
- 1 /* filter byte */
|
|
||||||
- 7*8 /* rounding of width to multiple of 8 pixels */
|
|
||||||
- 8) /* extra max_pixel_depth pad */
|
|
||||||
info_ptr->rowbytes = 0;
|
|
||||||
else
|
|
||||||
info_ptr->rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth, width);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PNG_oFFs_SUPPORTED
|
#ifdef PNG_oFFs_SUPPORTED
|
||||||
|
|
|
@ -494,51 +494,50 @@ png_create_write_struct_2,(png_const_charp user_png_ver, png_voidp error_ptr,
|
||||||
png_structrp png_ptr = png_create_png_struct(user_png_ver, error_ptr,
|
png_structrp png_ptr = png_create_png_struct(user_png_ver, error_ptr,
|
||||||
error_fn, warn_fn, mem_ptr, malloc_fn, free_fn);
|
error_fn, warn_fn, mem_ptr, malloc_fn, free_fn);
|
||||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||||
|
if (png_ptr != NULL)
|
||||||
|
{
|
||||||
|
/* Set the zlib control values to defaults; they can be overridden by the
|
||||||
|
* application after the struct has been created.
|
||||||
|
*/
|
||||||
|
png_ptr->zbuffer_size = PNG_ZBUF_SIZE;
|
||||||
|
|
||||||
/* Set the zlib control values to defaults; they can be overridden by the
|
/* The 'zlib_strategy' setting is irrelevant because png_default_claim in
|
||||||
* application after the struct has been created.
|
* pngwutil.c defaults it according to whether or not filters will be
|
||||||
*/
|
* used, and ignores this setting.
|
||||||
png_ptr->zbuffer_size = PNG_ZBUF_SIZE;
|
*/
|
||||||
|
png_ptr->zlib_strategy = PNG_Z_DEFAULT_STRATEGY;
|
||||||
/* The 'zlib_strategy' setting is irrelevant because png_default_claim in
|
png_ptr->zlib_level = PNG_Z_DEFAULT_COMPRESSION;
|
||||||
* pngwutil.c defaults it according to whether or not filters will be used,
|
png_ptr->zlib_mem_level = 8;
|
||||||
* and ignores this setting.
|
png_ptr->zlib_window_bits = 15;
|
||||||
*/
|
png_ptr->zlib_method = 8;
|
||||||
png_ptr->zlib_strategy = PNG_Z_DEFAULT_STRATEGY;
|
|
||||||
png_ptr->zlib_level = PNG_Z_DEFAULT_COMPRESSION;
|
|
||||||
png_ptr->zlib_mem_level = 8;
|
|
||||||
png_ptr->zlib_window_bits = 15;
|
|
||||||
png_ptr->zlib_method = 8;
|
|
||||||
|
|
||||||
#ifdef PNG_WRITE_COMPRESSED_TEXT_SUPPORTED
|
#ifdef PNG_WRITE_COMPRESSED_TEXT_SUPPORTED
|
||||||
png_ptr->zlib_text_strategy = PNG_TEXT_Z_DEFAULT_STRATEGY;
|
png_ptr->zlib_text_strategy = PNG_TEXT_Z_DEFAULT_STRATEGY;
|
||||||
png_ptr->zlib_text_level = PNG_TEXT_Z_DEFAULT_COMPRESSION;
|
png_ptr->zlib_text_level = PNG_TEXT_Z_DEFAULT_COMPRESSION;
|
||||||
png_ptr->zlib_text_mem_level = 8;
|
png_ptr->zlib_text_mem_level = 8;
|
||||||
png_ptr->zlib_text_window_bits = 15;
|
png_ptr->zlib_text_window_bits = 15;
|
||||||
png_ptr->zlib_text_method = 8;
|
png_ptr->zlib_text_method = 8;
|
||||||
#endif /* PNG_WRITE_COMPRESSED_TEXT_SUPPORTED */
|
#endif /* PNG_WRITE_COMPRESSED_TEXT_SUPPORTED */
|
||||||
|
|
||||||
/* This is a highly dubious configuration option; by default it is off, but
|
/* This is a highly dubious configuration option; by default it is off,
|
||||||
* it may be appropriate for private builds that are testing extensions not
|
* but it may be appropriate for private builds that are testing
|
||||||
* conformant to the current specification, or of applications that must not
|
* extensions not conformant to the current specification, or of
|
||||||
* fail to write at all costs!
|
* applications that must not fail to write at all costs!
|
||||||
*/
|
*/
|
||||||
# ifdef PNG_BENIGN_WRITE_ERRORS_SUPPORTED
|
#ifdef PNG_BENIGN_WRITE_ERRORS_SUPPORTED
|
||||||
png_ptr->flags |= PNG_FLAG_BENIGN_ERRORS_WARN;
|
png_ptr->flags |= PNG_FLAG_BENIGN_ERRORS_WARN;
|
||||||
/* In stable builds only warn if an application error can be completely
|
/* In stable builds only warn if an application error can be completely
|
||||||
* handled.
|
* handled.
|
||||||
*/
|
*/
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
/* App warnings are warnings in release (or release candidate) builds but
|
/* App warnings are warnings in release (or release candidate) builds but
|
||||||
* are errors during development.
|
* are errors during development.
|
||||||
*/
|
*/
|
||||||
# if PNG_LIBPNG_BUILD_BASE_TYPE >= PNG_LIBPNG_BUILD_RC
|
#if PNG_LIBPNG_BUILD_BASE_TYPE >= PNG_LIBPNG_BUILD_RC
|
||||||
png_ptr->flags |= PNG_FLAG_APP_WARNINGS_WARN;
|
png_ptr->flags |= PNG_FLAG_APP_WARNINGS_WARN;
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
if (png_ptr != NULL)
|
|
||||||
{
|
|
||||||
/* TODO: delay this, it can be done in png_init_io() (if the app doesn't
|
/* TODO: delay this, it can be done in png_init_io() (if the app doesn't
|
||||||
* do it itself) avoiding setting the default function if it is not
|
* do it itself) avoiding setting the default function if it is not
|
||||||
* required.
|
* required.
|
||||||
|
|
Loading…
Reference in New Issue