< prev index next >

src/java.desktop/share/native/libsplashscreen/libpng/pngerror.c

Print this page




  12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13  * version 2 for more details (a copy is included in the LICENSE file that
  14  * accompanied this code).
  15  *
  16  * You should have received a copy of the GNU General Public License version
  17  * 2 along with this work; if not, write to the Free Software Foundation,
  18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19  *
  20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  * or visit www.oracle.com if you need additional information or have any
  22  * questions.
  23  */
  24 
  25 /* pngerror.c - stub functions for i/o and memory allocation
  26  *
  27  * This file is available under and governed by the GNU General Public
  28  * License version 2 only, as published by the Free Software Foundation.
  29  * However, the following notice accompanied the original version of this
  30  * file and, per its terms, should not be removed:
  31  *
  32  * Last changed in libpng 1.6.26 [October 20, 2016]
  33  * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
  34  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  35  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  36  *
  37  * This code is released under the libpng license.
  38  * For conditions of distribution and use, see the disclaimer
  39  * and license in png.h
  40  *
  41  * This file provides a location for all error handling.  Users who
  42  * need special error handling are expected to write replacement functions
  43  * and use png_set_error_fn() to use those functions.  See the instructions
  44  * at each function.
  45  */
  46 
  47 #include "pngpriv.h"
  48 
  49 #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
  50 
  51 static PNG_FUNCTION(void, png_default_error,PNGARG((png_const_structrp png_ptr,
  52     png_const_charp error_message)),PNG_NORETURN);
  53 


 174    {
 175 
 176       static const char digits[] = "0123456789ABCDEF";
 177 
 178       switch (format)
 179       {
 180          case PNG_NUMBER_FORMAT_fixed:
 181             /* Needs five digits (the fraction) */
 182             mincount = 5;
 183             if (output != 0 || number % 10 != 0)
 184             {
 185                *--end = digits[number % 10];
 186                output = 1;
 187             }
 188             number /= 10;
 189             break;
 190 
 191          case PNG_NUMBER_FORMAT_02u:
 192             /* Expects at least 2 digits. */
 193             mincount = 2;
 194             /* FALL THROUGH */
 195 
 196          case PNG_NUMBER_FORMAT_u:
 197             *--end = digits[number % 10];
 198             number /= 10;
 199             break;
 200 
 201          case PNG_NUMBER_FORMAT_02x:
 202             /* This format expects at least two digits */
 203             mincount = 2;
 204             /* FALL THROUGH */
 205 
 206          case PNG_NUMBER_FORMAT_x:
 207             *--end = digits[number & 0xf];
 208             number >>= 4;
 209             break;
 210 
 211          default: /* an error */
 212             number = 0;
 213             break;
 214       }
 215 
 216       /* Keep track of the number of digits added */
 217       ++count;
 218 
 219       /* Float a fixed number here: */
 220       if ((format == PNG_NUMBER_FORMAT_fixed) && (count == 5) && (end > start))
 221       {
 222          /* End of the fraction, but maybe nothing was output?  In that case
 223           * drop the decimal point.  If the number is a true zero handle that
 224           * here.




  12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13  * version 2 for more details (a copy is included in the LICENSE file that
  14  * accompanied this code).
  15  *
  16  * You should have received a copy of the GNU General Public License version
  17  * 2 along with this work; if not, write to the Free Software Foundation,
  18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19  *
  20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  * or visit www.oracle.com if you need additional information or have any
  22  * questions.
  23  */
  24 
  25 /* pngerror.c - stub functions for i/o and memory allocation
  26  *
  27  * This file is available under and governed by the GNU General Public
  28  * License version 2 only, as published by the Free Software Foundation.
  29  * However, the following notice accompanied the original version of this
  30  * file and, per its terms, should not be removed:
  31  *
  32  * Last changed in libpng 1.6.31 [July 27, 2017]
  33  * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
  34  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  35  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  36  *
  37  * This code is released under the libpng license.
  38  * For conditions of distribution and use, see the disclaimer
  39  * and license in png.h
  40  *
  41  * This file provides a location for all error handling.  Users who
  42  * need special error handling are expected to write replacement functions
  43  * and use png_set_error_fn() to use those functions.  See the instructions
  44  * at each function.
  45  */
  46 
  47 #include "pngpriv.h"
  48 
  49 #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
  50 
  51 static PNG_FUNCTION(void, png_default_error,PNGARG((png_const_structrp png_ptr,
  52     png_const_charp error_message)),PNG_NORETURN);
  53 


 174    {
 175 
 176       static const char digits[] = "0123456789ABCDEF";
 177 
 178       switch (format)
 179       {
 180          case PNG_NUMBER_FORMAT_fixed:
 181             /* Needs five digits (the fraction) */
 182             mincount = 5;
 183             if (output != 0 || number % 10 != 0)
 184             {
 185                *--end = digits[number % 10];
 186                output = 1;
 187             }
 188             number /= 10;
 189             break;
 190 
 191          case PNG_NUMBER_FORMAT_02u:
 192             /* Expects at least 2 digits. */
 193             mincount = 2;
 194             /* FALLTHROUGH */
 195 
 196          case PNG_NUMBER_FORMAT_u:
 197             *--end = digits[number % 10];
 198             number /= 10;
 199             break;
 200 
 201          case PNG_NUMBER_FORMAT_02x:
 202             /* This format expects at least two digits */
 203             mincount = 2;
 204             /* FALLTHROUGH */
 205 
 206          case PNG_NUMBER_FORMAT_x:
 207             *--end = digits[number & 0xf];
 208             number >>= 4;
 209             break;
 210 
 211          default: /* an error */
 212             number = 0;
 213             break;
 214       }
 215 
 216       /* Keep track of the number of digits added */
 217       ++count;
 218 
 219       /* Float a fixed number here: */
 220       if ((format == PNG_NUMBER_FORMAT_fixed) && (count == 5) && (end > start))
 221       {
 222          /* End of the fraction, but maybe nothing was output?  In that case
 223           * drop the decimal point.  If the number is a true zero handle that
 224           * here.


< prev index next >