From 78504e75e85e62cb8a4e4d83225205abe855e38f Mon Sep 17 00:00:00 2001 From: "tor%cs.brown.edu" Date: Tue, 27 Jun 2000 23:22:13 +0000 Subject: [PATCH] Update libmng snapshot. Not in default build. git-svn-id: svn://10.0.0.236/trunk@73351 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/modules/libimg/mng/changes.readme | 4 +++- mozilla/modules/libimg/mng/mng_memory.h | 16 +++++++++------- mozilla/modules/libimg/mng/mng_types.h | 10 ++++++++-- mozilla/modules/libimg/mngcom/nsMNGDecoder.cpp | 4 ++-- 4 files changed, 22 insertions(+), 12 deletions(-) diff --git a/mozilla/modules/libimg/mng/changes.readme b/mozilla/modules/libimg/mng/changes.readme index e8b33a41c93..ceefa000c6c 100644 --- a/mozilla/modules/libimg/mng/changes.readme +++ b/mozilla/modules/libimg/mng/changes.readme @@ -57,7 +57,9 @@ core: - fixed problem with cheap transparency for 4-bit gray - fixed display_xxxx routines for interlaced images - added precaution against faulty iCCP chunks from PS -- changed userdata variable to mng_ptr +- changed userdata variable to mng_ptr +- added typedef for mng_size_t +- changed size parameter for memory allocation to mng_size_t samples: diff --git a/mozilla/modules/libimg/mng/mng_memory.h b/mozilla/modules/libimg/mng/mng_memory.h index ae7ba727350..9792688e415 100644 --- a/mozilla/modules/libimg/mng/mng_memory.h +++ b/mozilla/modules/libimg/mng/mng_memory.h @@ -20,6 +20,8 @@ /* * * */ /* * 0.5.3 - 06/12/2000 - G.Juyn * */ /* * - swapped MNG_COPY parameter-names * */ +/* * 0.5.3 - 06/27/2000 - G.Juyn * */ +/* * - changed size parameter to mng_size_t * */ /* * * */ /* ************************************************************************** */ @@ -41,20 +43,20 @@ /* ************************************************************************** */ #ifdef MNG_INTERNAL_MEMMNGMT -#define MNG_ALLOC(H,P,L) { P = calloc (1, L); \ +#define MNG_ALLOC(H,P,L) { P = calloc (1, (mng_size_t)(L)); \ if (P == 0) { MNG_ERROR (H, MNG_OUTOFMEMORY) } } -#define MNG_ALLOCX(H,P,L) { P = calloc (1, L); } +#define MNG_ALLOCX(H,P,L) { P = calloc (1, (mng_size_t)(L)); } #define MNG_FREE(H,P,L) { if (P) { free (P); P = 0; } } #define MNG_FREEX(H,P,L) { if (P) free (P); } #else -#define MNG_ALLOC(H,P,L) { P = H->fMemalloc (L); \ +#define MNG_ALLOC(H,P,L) { P = H->fMemalloc ((mng_size_t)(L)); \ if (P == 0) { MNG_ERROR (H, MNG_OUTOFMEMORY) } } -#define MNG_ALLOCX(H,P,L) { P = H->fMemalloc (L); } -#define MNG_FREE(H,P,L) { if (P) { H->fMemfree (P, L); P = 0; } } -#define MNG_FREEX(H,P,L) { if (P) { H->fMemfree (P, L); } } +#define MNG_ALLOCX(H,P,L) { P = H->fMemalloc ((mng_size_t)(L)); } +#define MNG_FREE(H,P,L) { if (P) { H->fMemfree (P, (mng_size_t)(L)); P = 0; } } +#define MNG_FREEX(H,P,L) { if (P) { H->fMemfree (P, (mng_size_t)(L)); } } #endif /* mng_internal_memmngmt */ -#define MNG_COPY(D,S,L) { memcpy (D, S, L); } +#define MNG_COPY(D,S,L) { memcpy (D, S, (mng_size_t)(L)); } /* ************************************************************************** */ diff --git a/mozilla/modules/libimg/mng/mng_types.h b/mozilla/modules/libimg/mng/mng_types.h index ad60bd75b3e..45a9ddfdaae 100644 --- a/mozilla/modules/libimg/mng/mng_types.h +++ b/mozilla/modules/libimg/mng/mng_types.h @@ -47,6 +47,10 @@ /* * * */ /* * 0.5.3 - 06/21/2000 - G.Juyn * */ /* * - added speedtype to facilitate testing * */ +/* * 0.5.3 - 06/27/2000 - G.Juyn * */ +/* * - added typedef for mng_size_t * */ +/* * - changed size parameter for memory callbacks to * */ +/* * mng_size_t * */ /* * * */ /* ************************************************************************** */ @@ -167,6 +171,8 @@ typedef unsigned char mng_uint8; typedef double mng_float; /* basic float */ +typedef size_t mng_size_t; /* size field for memory allocation */ + typedef char * mng_pchar; /* string */ typedef void * mng_ptr; /* generic pointer */ @@ -280,9 +286,9 @@ typedef enum mng_speedtypes mng_speedtype; /* ************************************************************************** */ /* memory management callbacks */ -typedef mng_ptr MNG_DECL (*mng_memalloc) (mng_uint32 iLen); +typedef mng_ptr MNG_DECL (*mng_memalloc) (mng_size_t iLen); typedef void MNG_DECL (*mng_memfree) (mng_ptr iPtr, - mng_uint32 iLen); + mng_size_t iLen); /* I/O management callbacks */ typedef mng_bool MNG_DECL (*mng_openstream) (mng_handle hHandle); diff --git a/mozilla/modules/libimg/mngcom/nsMNGDecoder.cpp b/mozilla/modules/libimg/mngcom/nsMNGDecoder.cpp index 2dea619f238..a9bb992a6c5 100644 --- a/mozilla/modules/libimg/mngcom/nsMNGDecoder.cpp +++ b/mozilla/modules/libimg/mngcom/nsMNGDecoder.cpp @@ -223,7 +223,7 @@ il_mng_settimer(mng_handle handle, mng_uint32 msec) } static mng_ptr -il_mng_alloc(mng_uint32 size) +il_mng_alloc(mng_size_t size) { // dprintf((stderr, "=== malloc(%d)\n", size)); void *ptr = nsMemory::Alloc(size); @@ -232,7 +232,7 @@ il_mng_alloc(mng_uint32 size) } static void -il_mng_free(mng_ptr ptr, mng_uint32 size) +il_mng_free(mng_ptr ptr, mng_size_t size) { // dprintf((stderr, "=== free(%d)\n", size)); nsMemory::Free(ptr);