diff options
author | Glenn Randers-Pehrson <glennrp at users.sourceforge.net> | 2000-06-09 08:46:21 -0500 |
---|---|---|
committer | Glenn Randers-Pehrson <glennrp at users.sourceforge.net> | 2009-04-06 16:05:16 -0500 |
commit | 1f2d559f70c0aad278aa28bcf723cfd5e00e0825 (patch) | |
tree | c75fc6471938809dd0589ae11da9b6627565aed9 /contrib/visupng | |
parent | db66d448018c031b581702bc8e60788022cfe430 (diff) | |
download | libpng-1f2d559f70c0aad278aa28bcf723cfd5e00e0825.tar.gz |
Imported from libpng-1.0.7rc1.tarv1.0.7rc1
Diffstat (limited to 'contrib/visupng')
-rw-r--r-- | contrib/visupng/PngFile.c | 10 | ||||
-rw-r--r-- | contrib/visupng/README.txt | 15 | ||||
-rw-r--r-- | contrib/visupng/VisualPng.png | bin | 208 -> 0 bytes | |||
-rw-r--r-- | contrib/visupng/cexcept.h | 37 |
4 files changed, 25 insertions, 37 deletions
diff --git a/contrib/visupng/PngFile.c b/contrib/visupng/PngFile.c index a0cd8e5d3..c7ec7ab11 100644 --- a/contrib/visupng/PngFile.c +++ b/contrib/visupng/PngFile.c @@ -228,7 +228,9 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData, if ((pbImageData = (png_byte *) malloc(ulRowBytes * (*piHeight) * sizeof(png_byte))) == NULL) { - png_error(png_ptr, "Visual PNG: out of memory"); + png_destroy_read_struct(&png_ptr, &info_ptr, NULL); + *ppbImageData = pbImageData = NULL; + return FALSE; } *ppbImageData = pbImageData; @@ -237,7 +239,10 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData, if ((ppbRowPointers = (png_bytepp) malloc((*piHeight) * sizeof(png_bytep))) == NULL) { - png_error(png_ptr, "Visual PNG: out of memory"); + png_destroy_read_struct(&png_ptr, &info_ptr, NULL); + free(pbImageData); + *ppbImageData = pbImageData = NULL; + return FALSE; } // set the individual row-pointers to point at the correct offsets @@ -264,7 +269,6 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData, Catch (msg) { png_destroy_read_struct(&png_ptr, &info_ptr, NULL); - *ppbImageData = pbImageData = NULL; if(ppbRowPointers) diff --git a/contrib/visupng/README.txt b/contrib/visupng/README.txt index 7594ec36b..7e5d3cfa3 100644 --- a/contrib/visupng/README.txt +++ b/contrib/visupng/README.txt @@ -4,20 +4,13 @@ Microsoft Developer Studio Build File, Format Version 6.00 for VisualPng Copyright 2000, Willem van Schaik. For conditions of distribution and use, see the copyright/license/disclaimer notice in png.h -As a PNG .dll demo VisualPng is finished. More features would only hinder -the program's objective. However, further extensions (like support for other -graphics formats) are in development. To get these, or for pre-compiled -binaries, go to "http://www.schaik.com/png/visualpng.html". - ------------------------------------------------------------------------- - Assumes that libpng DLLs and LIBs are in ..\..\msvc\win32\libpng - zlib DLLs and LIBs are in ..\..\msvc\win32\zlib - libpng header files are in ..\..\..\libpng - zlib header files are in ..\..\..\zlib - the pngsuite images are in ..\pngsuite + zlib DLLs and LIBs are in ..\..\msvc\win32\zlib + libpng header files are in ..\..\..\libpng + zlib header files are in ..\..\..\zlib + the pngsuite images are in ..\pngsuite To build: diff --git a/contrib/visupng/VisualPng.png b/contrib/visupng/VisualPng.png Binary files differdeleted file mode 100644 index c6aa80a9b..000000000 --- a/contrib/visupng/VisualPng.png +++ /dev/null diff --git a/contrib/visupng/cexcept.h b/contrib/visupng/cexcept.h index 532b23dae..fbe85669d 100644 --- a/contrib/visupng/cexcept.h +++ b/contrib/visupng/cexcept.h @@ -1,5 +1,5 @@ /*=== -cexcept.h 1.0.0 (2000-Jun-21-Wed) +cexcept.h 0.6.1 (2000-Apr-22-Sat) Adam M. Costello <amc@cs.berkeley.edu> An interface for exception-handling in ANSI C, developed jointly with @@ -107,15 +107,14 @@ Catch (expression) statement confusion with the C++ keywords, which have subtly different semantics. - A Try/Catch statement has a syntax similar to an if/else - statement, except that the parenthesized expression goes after - the second keyword rather than the first. As with if/else, - there are two clauses, each of which may be a simple statement - ending with a semicolon or a brace-enclosed compound statement. - But whereas the else clause is optional, the Catch clause is - required. The expression must be a modifiable lvalue (something - capable of being assigned to) of the exact same type passed to - define_exception_type(). + A Try/Catch statement has a syntax similar to an if/else statement, + except that the parenthesized expression goes after the second + keyword rather than the first. As with if/else, there are two + clauses, each of which may be a simple statement ending with a + semicolon or a brace-enclosed compound statement. But whereas + the else clause is optional, the Catch clause is required. The + expression must be an lvalue (something capable of being assigned + to) of the exact same type passed to define_exception_type(). If a Throw that uses the same exception context as the Try/Catch is executed within the Try clause (typically within a function called @@ -136,17 +135,9 @@ Catch (expression) statement return, break, continue, goto, longjmp) is forbidden--the compiler will not complain, but bad things will happen at run-time. Jumping into or out of a Catch clause is okay, and so is jumping around - inside a Try clause. In many cases where one is tempted to return - from a Try clause, it will suffice to use Throw, and then return - from the Catch clause. Another option is to set a flag variable and - use goto to jump to the end of the Try clause, then check the flag - after the Try/Catch statement. - - IMPORTANT: The values of any non-volatile automatic variables - changed within the Try clause are undefined after an exception is - caught. Therefore, variables modified inside the Try block whose - values are needed later outside the Try block must either use static - storage or be declared with the "volatile" type qualifier. + inside a Try clause. Also note that the values of any non-volatile + automatic variables changed within the Try clause are undefined + after an exception is caught. Throw expression; @@ -158,8 +149,8 @@ Throw expression; be compatible with the type passed to define_exception_type(). The exception must be caught, otherwise the program may crash. - Slight limitation: If the expression is a comma-expression it must - be enclosed in parentheses. + Slight limitation: The expression cannot be a comma-expression (but + no one would want to use a comma-expression here anyway). Try statement |