Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(355)

Side by Side Diff: core/src/fxcodec/fx_libopenjpeg/libopenjpeg20/j2k.c

Issue 372473003: Remove custom memory manager (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Change malloc to calloc Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * The copyright in this software is being made available under the 2-clauses 2 * The copyright in this software is being made available under the 2-clauses
3 * BSD License, included below. This software may be subject to other third 3 * BSD License, included below. This software may be subject to other third
4 * party and contributor rights, including patent rights, and no such rights 4 * party and contributor rights, including patent rights, and no such rights
5 * are granted under this license. 5 * are granted under this license.
6 * 6 *
7 * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium 7 * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
8 * Copyright (c) 2002-2014, Professor Benoit Macq 8 * Copyright (c) 2002-2014, Professor Benoit Macq
9 * Copyright (c) 2001-2003, David Janssens 9 * Copyright (c) 2001-2003, David Janssens
10 * Copyright (c) 2002-2003, Yannick Verschueren 10 * Copyright (c) 2002-2003, Yannick Verschueren
(...skipping 10235 matching lines...) Expand 10 before | Expand all | Expand 10 after
10246 } 10246 }
10247 else { 10247 else {
10248 if (! opj_j2k_post_write_tile(p_j2k,p_data,p_data_size,p_stream, p_manager)) { 10248 if (! opj_j2k_post_write_tile(p_j2k,p_data,p_data_size,p_stream, p_manager)) {
10249 opj_event_msg(p_manager, EVT_ERROR, "Error while opj_j2k _post_write_tile with tile index = %d\n", p_tile_index); 10249 opj_event_msg(p_manager, EVT_ERROR, "Error while opj_j2k _post_write_tile with tile index = %d\n", p_tile_index);
10250 return OPJ_FALSE; 10250 return OPJ_FALSE;
10251 } 10251 }
10252 } 10252 }
10253 10253
10254 return OPJ_TRUE; 10254 return OPJ_TRUE;
10255 } 10255 }
10256
10257 #ifdef _FOXIT_MEM_MANAGER_
10258 /** Allocate number of bytes */
10259 void* FXMEM_DefaultAlloc(int byte_size, int flags);
10260 void* FXMEM_DefaultRealloc(void* pointer, int new_size, int flags);
10261 void FXMEM_DefaultFree(void* pointer, int flags);
10262
10263 void* opj_malloc(size_t size)
10264 {
10265 if (size >= (size_t)-0x100 || (int)size < 0) return NULL;
10266
10267 return FXMEM_DefaultAlloc(size, 0);
10268 }
10269
10270 void* opj_calloc(size_t _NumOfElements, size_t _SizeOfElements)
10271 {
10272 void* buffer = NULL;
10273
10274 if (_NumOfElements != 0 && _NumOfElements >= (size_t)-0x100 / _SizeOfEle ments) return NULL;
10275 if ((int)_NumOfElements < 0 || (int)_SizeOfElements < 0) return NULL;
10276
10277 buffer = FXMEM_DefaultAlloc(_NumOfElements * _SizeOfElements, 0);
10278 if (!buffer) return 0;
10279
10280 memset(buffer, 0, _NumOfElements * _SizeOfElements);
10281 return buffer;
10282 }
10283
10284 void* opj_realloc(void * m, size_t s)
10285 {
10286 if (s >= (size_t)-0x100 || (int)s < 0) return NULL;
10287 return FXMEM_DefaultRealloc(m, s, 0);
10288 }
10289
10290 void opj_free(void * m)
10291 {
10292 FXMEM_DefaultFree(m, 0);
10293 }
10294
10295 #endif
OLDNEW
« no previous file with comments | « core/src/fxcodec/fx_libopenjpeg/libopenjpeg20/dwt.c ('k') | core/src/fxcodec/fx_libopenjpeg/libopenjpeg20/opj_malloc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698