~noskcaj/ubuntu/trusty/libpng/libpng

« back to all changes in this revision

Viewing changes to pngrio.c

  • Committer: Bazaar Package Importer
  • Author(s): Anibal Monsalve Salazar
  • Date: 2009-12-04 11:23:50 UTC
  • mfrom: (1.1.10 upstream) (15.2.3 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091204112350-ln22xyakgn9bh39k
Tags: 1.2.41-1
* New upstream release
* Debian source format is 3.0 (quilt)
* Update debian/watch
* Add 02-export-png_set_strip_error_numbers.patch
  Define PNG_ERROR_NUMBERS_SUPPORTED
  Upstream doesn't define PNG_ERROR_NUMBERS_SUPPORTED since 1.2.41. As
  a consecuence, the symbol png_set_strip_error_numbe@@PNG12_0 wasn't
  exported.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
 
2
2
/* pngrio.c - functions for data input
3
3
 *
4
 
 * Last changed in libpng 1.2.37 [June 4, 2009]
 
4
 * Last changed in libpng 1.2.41 [December 3, 2009]
5
5
 * Copyright (c) 1998-2009 Glenn Randers-Pehrson
6
6
 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
7
7
 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
19
19
 */
20
20
 
21
21
#define PNG_INTERNAL
 
22
#define PNG_NO_PEDANTIC_WARNINGS
22
23
#include "png.h"
23
 
#if defined(PNG_READ_SUPPORTED)
 
24
#ifdef PNG_READ_SUPPORTED
24
25
 
25
26
/* Read the data from whatever input you are using.  The default routine
26
27
 * reads from a file pointer.  Note that this routine sometimes gets called
32
33
png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
33
34
{
34
35
   png_debug1(4, "reading %d bytes", (int)length);
 
36
 
35
37
   if (png_ptr->read_data_fn != NULL)
36
38
      (*(png_ptr->read_data_fn))(png_ptr, data, length);
37
39
   else
38
40
      png_error(png_ptr, "Call to NULL read function");
39
41
}
40
42
 
41
 
#if !defined(PNG_NO_STDIO)
 
43
#ifdef PNG_STDIO_SUPPORTED
42
44
/* This is the function that does the actual reading of data.  If you are
43
45
 * not reading from a standard C stream, you should create a replacement
44
46
 * read_data function and use it at run time with png_set_read_fn(), rather
55
57
   /* fread() returns 0 on error, so it is OK to store this in a png_size_t
56
58
    * instead of an int, which is what fread() actually returns.
57
59
    */
58
 
#if defined(_WIN32_WCE)
 
60
#ifdef _WIN32_WCE
59
61
   if ( !ReadFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) )
60
62
      check = 0;
61
63
#else
89
91
   io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr);
90
92
   if ((png_bytep)n_data == data)
91
93
   {
92
 
#if defined(_WIN32_WCE)
 
94
#ifdef _WIN32_WCE
93
95
      if ( !ReadFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) )
94
96
         check = 0;
95
97
#else
105
107
      do
106
108
      {
107
109
         read = MIN(NEAR_BUF_SIZE, remaining);
108
 
#if defined(_WIN32_WCE)
 
110
#ifdef _WIN32_WCE
109
111
         if ( !ReadFile((HANDLE)(io_ptr), buf, read, &err, NULL) )
110
112
            err = 0;
111
113
#else
151
153
      return;
152
154
   png_ptr->io_ptr = io_ptr;
153
155
 
154
 
#if !defined(PNG_NO_STDIO)
 
156
#ifdef PNG_STDIO_SUPPORTED
155
157
   if (read_data_fn != NULL)
156
158
      png_ptr->read_data_fn = read_data_fn;
157
159
   else
170
172
         "same structure.  Resetting write_data_fn to NULL.");
171
173
   }
172
174
 
173
 
#if defined(PNG_WRITE_FLUSH_SUPPORTED)
 
175
#ifdef PNG_WRITE_FLUSH_SUPPORTED
174
176
   png_ptr->output_flush_fn = NULL;
175
177
#endif
176
178
}