ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

pngmem.c
Go to the documentation of this file.
00001 
00002 /* pngmem.c - stub functions for memory allocation
00003  *
00004  * Last changed in libpng 1.5.7 [December 15, 2011]
00005  * Copyright (c) 1998-2011 Glenn Randers-Pehrson
00006  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
00007  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
00008  *
00009  * This code is released under the libpng license.
00010  * For conditions of distribution and use, see the disclaimer
00011  * and license in png.h
00012  *
00013  * This file provides a location for all memory allocation.  Users who
00014  * need special memory handling are expected to supply replacement
00015  * functions for png_malloc() and png_free(), and to use
00016  * png_create_read_struct_2() and png_create_write_struct_2() to
00017  * identify the replacement functions.
00018  */
00019 
00020 #include "pngpriv.h"
00021 
00022 #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
00023 
00024 /* Borland DOS special memory handler */
00025 #if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__)
00026 /* If you change this, be sure to change the one in png.h also */
00027 
00028 /* Allocate memory for a png_struct.  The malloc and memset can be replaced
00029    by a single call to calloc() if this is thought to improve performance. */
00030 PNG_FUNCTION(png_voidp /* PRIVATE */,
00031 png_create_struct,(int type),PNG_ALLOCATED)
00032 {
00033 #  ifdef PNG_USER_MEM_SUPPORTED
00034    return (png_create_struct_2(type, NULL, NULL));
00035 }
00036 
00037 /* Alternate version of png_create_struct, for use with user-defined malloc. */
00038 PNG_FUNCTION(png_voidp /* PRIVATE */,
00039 png_create_struct_2,(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr),
00040    PNG_ALLOCATED)
00041 {
00042 #  endif /* PNG_USER_MEM_SUPPORTED */
00043    png_size_t size;
00044    png_voidp struct_ptr;
00045 
00046    if (type == PNG_STRUCT_INFO)
00047       size = png_sizeof(png_info);
00048 
00049    else if (type == PNG_STRUCT_PNG)
00050       size = png_sizeof(png_struct);
00051 
00052    else
00053       return (png_get_copyright(NULL));
00054 
00055 #  ifdef PNG_USER_MEM_SUPPORTED
00056    if (malloc_fn != NULL)
00057    {
00058       png_struct dummy_struct;
00059       memset(&dummy_struct, 0, sizeof dummy_struct);
00060       dummy_struct.mem_ptr=mem_ptr;
00061       struct_ptr = (*(malloc_fn))(&dummy_struct, (png_alloc_size_t)size);
00062    }
00063 
00064    else
00065 #  endif /* PNG_USER_MEM_SUPPORTED */
00066    struct_ptr = (png_voidp)farmalloc(size);
00067    if (struct_ptr != NULL)
00068       png_memset(struct_ptr, 0, size);
00069 
00070    return (struct_ptr);
00071 }
00072 
00073 /* Free memory allocated by a png_create_struct() call */
00074 void /* PRIVATE */
00075 png_destroy_struct(png_voidp struct_ptr)
00076 {
00077 #  ifdef PNG_USER_MEM_SUPPORTED
00078    png_destroy_struct_2(struct_ptr, NULL, NULL);
00079 }
00080 
00081 /* Free memory allocated by a png_create_struct() call */
00082 void /* PRIVATE */
00083 png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
00084     png_voidp mem_ptr)
00085 {
00086 #  endif
00087    if (struct_ptr != NULL)
00088    {
00089 #  ifdef PNG_USER_MEM_SUPPORTED
00090       if (free_fn != NULL)
00091       {
00092          png_struct dummy_struct;
00093          memset(&dummy_struct, 0, sizeof dummy_struct);
00094          dummy_struct.mem_ptr=mem_ptr;
00095          (*(free_fn))(&dummy_struct, struct_ptr);
00096          return;
00097       }
00098 
00099 #  endif /* PNG_USER_MEM_SUPPORTED */
00100       farfree (struct_ptr);
00101    }
00102 }
00103 
00104 /* Allocate memory.  For reasonable files, size should never exceed
00105  * 64K.  However, zlib may allocate more then 64K if you don't tell
00106  * it not to.  See zconf.h and png.h for more information. zlib does
00107  * need to allocate exactly 64K, so whatever you call here must
00108  * have the ability to do that.
00109  *
00110  * Borland seems to have a problem in DOS mode for exactly 64K.
00111  * It gives you a segment with an offset of 8 (perhaps to store its
00112  * memory stuff).  zlib doesn't like this at all, so we have to
00113  * detect and deal with it.  This code should not be needed in
00114  * Windows or OS/2 modes, and only in 16 bit mode.  This code has
00115  * been updated by Alexander Lehmann for version 0.89 to waste less
00116  * memory.
00117  *
00118  * Note that we can't use png_size_t for the "size" declaration,
00119  * since on some systems a png_size_t is a 16-bit quantity, and as a
00120  * result, we would be truncating potentially larger memory requests
00121  * (which should cause a fatal error) and introducing major problems.
00122  */
00123 PNG_FUNCTION(png_voidp,PNGAPI
00124 png_calloc,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
00125 {
00126    png_voidp ret;
00127 
00128    ret = (png_malloc(png_ptr, size));
00129 
00130    if (ret != NULL)
00131       png_memset(ret,0,(png_size_t)size);
00132 
00133    return (ret);
00134 }
00135 
00136 PNG_FUNCTION(png_voidp,PNGAPI
00137 png_malloc,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
00138 {
00139    png_voidp ret;
00140 
00141    if (png_ptr == NULL || size == 0)
00142       return (NULL);
00143 
00144 #  ifdef PNG_USER_MEM_SUPPORTED
00145    if (png_ptr->malloc_fn != NULL)
00146       ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, size));
00147 
00148    else
00149       ret = (png_malloc_default(png_ptr, size));
00150 
00151    if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
00152        png_error(png_ptr, "Out of memory");
00153 
00154    return (ret);
00155 }
00156 
00157 PNG_FUNCTION(png_voidp,PNGAPI
00158 png_malloc_default,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
00159 {
00160    png_voidp ret;
00161 #  endif /* PNG_USER_MEM_SUPPORTED */
00162 
00163    if (png_ptr == NULL || size == 0)
00164       return (NULL);
00165 
00166 #  ifdef PNG_MAX_MALLOC_64K
00167    if (size > (png_uint_32)65536L)
00168    {
00169       png_warning(png_ptr, "Cannot Allocate > 64K");
00170       ret = NULL;
00171    }
00172 
00173    else
00174 #  endif
00175 
00176    if (size != (size_t)size)
00177       ret = NULL;
00178 
00179    else if (size == (png_uint_32)65536L)
00180    {
00181       if (png_ptr->offset_table == NULL)
00182       {
00183          /* Try to see if we need to do any of this fancy stuff */
00184          ret = farmalloc(size);
00185          if (ret == NULL || ((png_size_t)ret & 0xffff))
00186          {
00187             int num_blocks;
00188             png_uint_32 total_size;
00189             png_bytep table;
00190             int i, mem_level, window_bits;
00191             png_byte huge * hptr;
00192             int window_bits
00193 
00194             if (ret != NULL)
00195             {
00196                farfree(ret);
00197                ret = NULL;
00198             }
00199 
00200             window_bits =
00201                 png_ptr->zlib_window_bits >= png_ptr->zlib_text_window_bits ?
00202                 png_ptr->zlib_window_bits : png_ptr->zlib_text_window_bits;
00203 
00204             if (window_bits > 14)
00205                num_blocks = (int)(1 << (window_bits - 14));
00206 
00207             else
00208                num_blocks = 1;
00209 
00210             mem_level =
00211                 png_ptr->zlib_mem_level >= png_ptr->zlib_text_mem_level ?
00212                 png_ptr->zlib_mem_level : png_ptr->zlib_text_mem_level;
00213 
00214             if (mem_level >= 7)
00215                num_blocks += (int)(1 << (mem_level - 7));
00216 
00217             else
00218                num_blocks++;
00219 
00220             total_size = ((png_uint_32)65536L) * (png_uint_32)num_blocks+16;
00221 
00222             table = farmalloc(total_size);
00223 
00224             if (table == NULL)
00225             {
00226 #  ifndef PNG_USER_MEM_SUPPORTED
00227                if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
00228                   png_error(png_ptr, "Out Of Memory"); /* Note "O", "M" */
00229 
00230                else
00231                   png_warning(png_ptr, "Out Of Memory");
00232 #  endif
00233                return (NULL);
00234             }
00235 
00236             if ((png_size_t)table & 0xfff0)
00237             {
00238 #  ifndef PNG_USER_MEM_SUPPORTED
00239                if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
00240                   png_error(png_ptr,
00241                     "Farmalloc didn't return normalized pointer");
00242 
00243                else
00244                   png_warning(png_ptr,
00245                     "Farmalloc didn't return normalized pointer");
00246 #  endif
00247                return (NULL);
00248             }
00249 
00250             png_ptr->offset_table = table;
00251             png_ptr->offset_table_ptr = farmalloc(num_blocks *
00252                png_sizeof(png_bytep));
00253 
00254             if (png_ptr->offset_table_ptr == NULL)
00255             {
00256 #  ifndef PNG_USER_MEM_SUPPORTED
00257                if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
00258                   png_error(png_ptr, "Out Of memory"); /* Note "O", "m" */
00259 
00260                else
00261                   png_warning(png_ptr, "Out Of memory");
00262 #  endif
00263                return (NULL);
00264             }
00265 
00266             hptr = (png_byte huge *)table;
00267             if ((png_size_t)hptr & 0xf)
00268             {
00269                hptr = (png_byte huge *)((long)(hptr) & 0xfffffff0L);
00270                hptr = hptr + 16L;  /* "hptr += 16L" fails on Turbo C++ 3.0 */
00271             }
00272 
00273             for (i = 0; i < num_blocks; i++)
00274             {
00275                png_ptr->offset_table_ptr[i] = (png_bytep)hptr;
00276                hptr = hptr + (png_uint_32)65536L;  /* "+=" fails on TC++3.0 */
00277             }
00278 
00279             png_ptr->offset_table_number = num_blocks;
00280             png_ptr->offset_table_count = 0;
00281             png_ptr->offset_table_count_free = 0;
00282          }
00283       }
00284 
00285       if (png_ptr->offset_table_count >= png_ptr->offset_table_number)
00286       {
00287 #  ifndef PNG_USER_MEM_SUPPORTED
00288          if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
00289             png_error(png_ptr, "Out of Memory"); /* Note "O" and "M" */
00290 
00291          else
00292             png_warning(png_ptr, "Out of Memory");
00293 #  endif
00294          return (NULL);
00295       }
00296 
00297       ret = png_ptr->offset_table_ptr[png_ptr->offset_table_count++];
00298    }
00299 
00300    else
00301       ret = farmalloc(size);
00302 
00303 #  ifndef PNG_USER_MEM_SUPPORTED
00304    if (ret == NULL)
00305    {
00306       if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
00307          png_error(png_ptr, "Out of memory"); /* Note "o" and "m" */
00308 
00309       else
00310          png_warning(png_ptr, "Out of memory"); /* Note "o" and "m" */
00311    }
00312 #  endif
00313 
00314    return (ret);
00315 }
00316 
00317 /* Free a pointer allocated by png_malloc().  In the default
00318  * configuration, png_ptr is not used, but is passed in case it
00319  * is needed.  If ptr is NULL, return without taking any action.
00320  */
00321 void PNGAPI
00322 png_free(png_structp png_ptr, png_voidp ptr)
00323 {
00324    if (png_ptr == NULL || ptr == NULL)
00325       return;
00326 
00327 #  ifdef PNG_USER_MEM_SUPPORTED
00328    if (png_ptr->free_fn != NULL)
00329    {
00330       (*(png_ptr->free_fn))(png_ptr, ptr);
00331       return;
00332    }
00333 
00334    else
00335       png_free_default(png_ptr, ptr);
00336 }
00337 
00338 void PNGAPI
00339 png_free_default(png_structp png_ptr, png_voidp ptr)
00340 {
00341 #  endif /* PNG_USER_MEM_SUPPORTED */
00342 
00343    if (png_ptr == NULL || ptr == NULL)
00344       return;
00345 
00346    if (png_ptr->offset_table != NULL)
00347    {
00348       int i;
00349 
00350       for (i = 0; i < png_ptr->offset_table_count; i++)
00351       {
00352          if (ptr == png_ptr->offset_table_ptr[i])
00353          {
00354             ptr = NULL;
00355             png_ptr->offset_table_count_free++;
00356             break;
00357          }
00358       }
00359       if (png_ptr->offset_table_count_free == png_ptr->offset_table_count)
00360       {
00361          farfree(png_ptr->offset_table);
00362          farfree(png_ptr->offset_table_ptr);
00363          png_ptr->offset_table = NULL;
00364          png_ptr->offset_table_ptr = NULL;
00365       }
00366    }
00367 
00368    if (ptr != NULL)
00369       farfree(ptr);
00370 }
00371 
00372 #else /* Not the Borland DOS special memory handler */
00373 
00374 /* Allocate memory for a png_struct or a png_info.  The malloc and
00375    memset can be replaced by a single call to calloc() if this is thought
00376    to improve performance noticably. */
00377 PNG_FUNCTION(png_voidp /* PRIVATE */,
00378 png_create_struct,(int type),PNG_ALLOCATED)
00379 {
00380 #  ifdef PNG_USER_MEM_SUPPORTED
00381    return (png_create_struct_2(type, NULL, NULL));
00382 }
00383 
00384 /* Allocate memory for a png_struct or a png_info.  The malloc and
00385    memset can be replaced by a single call to calloc() if this is thought
00386    to improve performance noticably. */
00387 PNG_FUNCTION(png_voidp /* PRIVATE */,
00388 png_create_struct_2,(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr),
00389    PNG_ALLOCATED)
00390 {
00391 #  endif /* PNG_USER_MEM_SUPPORTED */
00392    png_size_t size;
00393    png_voidp struct_ptr;
00394 
00395    if (type == PNG_STRUCT_INFO)
00396       size = png_sizeof(png_info);
00397 
00398    else if (type == PNG_STRUCT_PNG)
00399       size = png_sizeof(png_struct);
00400 
00401    else
00402       return (NULL);
00403 
00404 #  ifdef PNG_USER_MEM_SUPPORTED
00405    if (malloc_fn != NULL)
00406    {
00407       png_struct dummy_struct;
00408       png_structp png_ptr = &dummy_struct;
00409       png_ptr->mem_ptr=mem_ptr;
00410       struct_ptr = (*(malloc_fn))(png_ptr, size);
00411 
00412       if (struct_ptr != NULL)
00413          png_memset(struct_ptr, 0, size);
00414 
00415       return (struct_ptr);
00416    }
00417 #  endif /* PNG_USER_MEM_SUPPORTED */
00418 
00419 #  if defined(__TURBOC__) && !defined(__FLAT__)
00420    struct_ptr = (png_voidp)farmalloc(size);
00421 #  else
00422 #    if defined(_MSC_VER) && defined(MAXSEG_64K)
00423    struct_ptr = (png_voidp)halloc(size, 1);
00424 #    else
00425    struct_ptr = (png_voidp)malloc(size);
00426 #    endif
00427 #  endif
00428 
00429    if (struct_ptr != NULL)
00430       png_memset(struct_ptr, 0, size);
00431 
00432    return (struct_ptr);
00433 }
00434 
00435 
00436 /* Free memory allocated by a png_create_struct() call */
00437 void /* PRIVATE */
00438 png_destroy_struct(png_voidp struct_ptr)
00439 {
00440 #  ifdef PNG_USER_MEM_SUPPORTED
00441    png_destroy_struct_2(struct_ptr, NULL, NULL);
00442 }
00443 
00444 /* Free memory allocated by a png_create_struct() call */
00445 void /* PRIVATE */
00446 png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
00447     png_voidp mem_ptr)
00448 {
00449 #  endif /* PNG_USER_MEM_SUPPORTED */
00450    if (struct_ptr != NULL)
00451    {
00452 #  ifdef PNG_USER_MEM_SUPPORTED
00453       if (free_fn != NULL)
00454       {
00455          png_struct dummy_struct;
00456          png_structp png_ptr = &dummy_struct;
00457          png_ptr->mem_ptr=mem_ptr;
00458          (*(free_fn))(png_ptr, struct_ptr);
00459          return;
00460       }
00461 #  endif /* PNG_USER_MEM_SUPPORTED */
00462 #  if defined(__TURBOC__) && !defined(__FLAT__)
00463       farfree(struct_ptr);
00464 
00465 #  else
00466 #    if defined(_MSC_VER) && defined(MAXSEG_64K)
00467       hfree(struct_ptr);
00468 
00469 #    else
00470       free(struct_ptr);
00471 
00472 #    endif
00473 #  endif
00474    }
00475 }
00476 
00477 /* Allocate memory.  For reasonable files, size should never exceed
00478  * 64K.  However, zlib may allocate more then 64K if you don't tell
00479  * it not to.  See zconf.h and png.h for more information.  zlib does
00480  * need to allocate exactly 64K, so whatever you call here must
00481  * have the ability to do that.
00482  */
00483 
00484 PNG_FUNCTION(png_voidp,PNGAPI
00485 png_calloc,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
00486 {
00487    png_voidp ret;
00488 
00489    ret = (png_malloc(png_ptr, size));
00490 
00491    if (ret != NULL)
00492       png_memset(ret,0,(png_size_t)size);
00493 
00494    return (ret);
00495 }
00496 
00497 PNG_FUNCTION(png_voidp,PNGAPI
00498 png_malloc,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
00499 {
00500    png_voidp ret;
00501 
00502 #  ifdef PNG_USER_MEM_SUPPORTED
00503    if (png_ptr == NULL || size == 0)
00504       return (NULL);
00505 
00506    if (png_ptr->malloc_fn != NULL)
00507       ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, (png_size_t)size));
00508 
00509    else
00510       ret = (png_malloc_default(png_ptr, size));
00511 
00512    if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
00513        png_error(png_ptr, "Out of Memory");
00514 
00515    return (ret);
00516 }
00517 
00518 PNG_FUNCTION(png_voidp,PNGAPI
00519 png_malloc_default,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
00520 {
00521    png_voidp ret;
00522 #  endif /* PNG_USER_MEM_SUPPORTED */
00523 
00524    if (png_ptr == NULL || size == 0)
00525       return (NULL);
00526 
00527 #  ifdef PNG_MAX_MALLOC_64K
00528    if (size > (png_uint_32)65536L)
00529    {
00530 #    ifndef PNG_USER_MEM_SUPPORTED
00531       if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
00532          png_error(png_ptr, "Cannot Allocate > 64K");
00533 
00534       else
00535 #    endif
00536          return NULL;
00537    }
00538 #  endif
00539 
00540    /* Check for overflow */
00541 #  if defined(__TURBOC__) && !defined(__FLAT__)
00542 
00543    if (size != (unsigned long)size)
00544       ret = NULL;
00545 
00546    else
00547       ret = farmalloc(size);
00548 
00549 #  else
00550 #    if defined(_MSC_VER) && defined(MAXSEG_64K)
00551    if (size != (unsigned long)size)
00552       ret = NULL;
00553 
00554    else
00555       ret = halloc(size, 1);
00556 
00557 #    else
00558    if (size != (size_t)size)
00559       ret = NULL;
00560 
00561    else
00562       ret = malloc((size_t)size);
00563 #    endif
00564 #  endif
00565 
00566 #  ifndef PNG_USER_MEM_SUPPORTED
00567    if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
00568       png_error(png_ptr, "Out of Memory");
00569 #  endif
00570 
00571    return (ret);
00572 }
00573 
00574 /* Free a pointer allocated by png_malloc().  If ptr is NULL, return
00575  * without taking any action.
00576  */
00577 void PNGAPI
00578 png_free(png_structp png_ptr, png_voidp ptr)
00579 {
00580    if (png_ptr == NULL || ptr == NULL)
00581       return;
00582 
00583 #  ifdef PNG_USER_MEM_SUPPORTED
00584    if (png_ptr->free_fn != NULL)
00585    {
00586       (*(png_ptr->free_fn))(png_ptr, ptr);
00587       return;
00588    }
00589 
00590    else
00591       png_free_default(png_ptr, ptr);
00592 }
00593 
00594 void PNGAPI
00595 png_free_default(png_structp png_ptr, png_voidp ptr)
00596 {
00597    if (png_ptr == NULL || ptr == NULL)
00598       return;
00599 
00600 #  endif /* PNG_USER_MEM_SUPPORTED */
00601 
00602 #  if defined(__TURBOC__) && !defined(__FLAT__)
00603    farfree(ptr);
00604 
00605 #  else
00606 #    if defined(_MSC_VER) && defined(MAXSEG_64K)
00607    hfree(ptr);
00608 
00609 #    else
00610    free(ptr);
00611 
00612 #    endif
00613 #  endif
00614 }
00615 #endif /* Not Borland DOS special memory handler */
00616 
00617 /* This function was added at libpng version 1.2.3.  The png_malloc_warn()
00618  * function will set up png_malloc() to issue a png_warning and return NULL
00619  * instead of issuing a png_error, if it fails to allocate the requested
00620  * memory.
00621  */
00622 PNG_FUNCTION(png_voidp,PNGAPI
00623 png_malloc_warn,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
00624 {
00625    png_voidp ptr;
00626    png_uint_32 save_flags;
00627    if (png_ptr == NULL)
00628       return (NULL);
00629 
00630    save_flags = png_ptr->flags;
00631    png_ptr->flags|=PNG_FLAG_MALLOC_NULL_MEM_OK;
00632    ptr = (png_voidp)png_malloc((png_structp)png_ptr, size);
00633    png_ptr->flags=save_flags;
00634    return(ptr);
00635 }
00636 
00637 
00638 #ifdef PNG_USER_MEM_SUPPORTED
00639 /* This function is called when the application wants to use another method
00640  * of allocating and freeing memory.
00641  */
00642 void PNGAPI
00643 png_set_mem_fn(png_structp png_ptr, png_voidp mem_ptr, png_malloc_ptr
00644   malloc_fn, png_free_ptr free_fn)
00645 {
00646    if (png_ptr != NULL)
00647    {
00648       png_ptr->mem_ptr = mem_ptr;
00649       png_ptr->malloc_fn = malloc_fn;
00650       png_ptr->free_fn = free_fn;
00651    }
00652 }
00653 
00654 /* This function returns a pointer to the mem_ptr associated with the user
00655  * functions.  The application should free any memory associated with this
00656  * pointer before png_write_destroy and png_read_destroy are called.
00657  */
00658 png_voidp PNGAPI
00659 png_get_mem_ptr(png_const_structp png_ptr)
00660 {
00661    if (png_ptr == NULL)
00662       return (NULL);
00663 
00664    return ((png_voidp)png_ptr->mem_ptr);
00665 }
00666 #endif /* PNG_USER_MEM_SUPPORTED */
00667 #endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */

Generated on Sun May 27 2012 04:19:30 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.