bug 797445 - remove prmem.h from imagelib r=joe

This commit is contained in:
Trevor Saunders 2012-10-03 14:10:31 -04:00
parent a3cbc34a3a
commit 05978c735c
7 changed files with 14 additions and 20 deletions

View File

@ -39,7 +39,6 @@ mailing address.
*/
#include <stddef.h>
#include "prmem.h"
#include "nsGIFDecoder2.h"
#include "nsIInputStream.h"

View File

@ -5,7 +5,6 @@
#include "nsCRT.h"
#include "EndianMacros.h"
#include "nsBMPEncoder.h"
#include "prmem.h"
#include "prprf.h"
#include "nsString.h"
#include "nsStreamUtils.h"

View File

@ -7,7 +7,6 @@
#include "nsBMPEncoder.h"
#include "nsPNGEncoder.h"
#include "nsICOEncoder.h"
#include "prmem.h"
#include "prprf.h"
#include "nsString.h"
#include "nsStreamUtils.h"

View File

@ -4,7 +4,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsJPEGEncoder.h"
#include "prmem.h"
#include "prprf.h"
#include "nsString.h"
#include "nsStreamUtils.h"
@ -35,7 +34,7 @@ nsJPEGEncoder::nsJPEGEncoder() : mFinished(false),
nsJPEGEncoder::~nsJPEGEncoder()
{
if (mImageBuffer) {
PR_Free(mImageBuffer);
moz_free(mImageBuffer);
mImageBuffer = nullptr;
}
}
@ -226,7 +225,7 @@ NS_IMETHODIMP nsJPEGEncoder::EndImageEncode()
NS_IMETHODIMP nsJPEGEncoder::Close()
{
if (mImageBuffer != nullptr) {
PR_Free(mImageBuffer);
moz_free(mImageBuffer);
mImageBuffer = nullptr;
mImageBufferSize = 0;
mImageBufferUsed = 0;
@ -373,7 +372,7 @@ nsJPEGEncoder::initDestination(jpeg_compress_struct* cinfo)
NS_ASSERTION(! that->mImageBuffer, "Image buffer already initialized");
that->mImageBufferSize = 8192;
that->mImageBuffer = (uint8_t*)PR_Malloc(that->mImageBufferSize);
that->mImageBuffer = (uint8_t*)moz_malloc(that->mImageBufferSize);
that->mImageBufferUsed = 0;
cinfo->dest->next_output_byte = that->mImageBuffer;
@ -407,11 +406,11 @@ nsJPEGEncoder::emptyOutputBuffer(jpeg_compress_struct* cinfo)
// expand buffer, just double size each time
that->mImageBufferSize *= 2;
uint8_t* newBuf = (uint8_t*)PR_Realloc(that->mImageBuffer,
that->mImageBufferSize);
uint8_t* newBuf = (uint8_t*)moz_realloc(that->mImageBuffer,
that->mImageBufferSize);
if (! newBuf) {
// can't resize, just zero (this will keep us from writing more)
PR_Free(that->mImageBuffer);
moz_free(that->mImageBuffer);
that->mImageBuffer = nullptr;
that->mImageBufferSize = 0;
that->mImageBufferUsed = 0;

View File

@ -5,7 +5,6 @@
#include "nsCRT.h"
#include "nsPNGEncoder.h"
#include "prmem.h"
#include "prprf.h"
#include "nsString.h"
#include "nsStreamUtils.h"
@ -28,7 +27,7 @@ nsPNGEncoder::nsPNGEncoder() : mPNG(nullptr), mPNGinfo(nullptr),
nsPNGEncoder::~nsPNGEncoder()
{
if (mImageBuffer) {
PR_Free(mImageBuffer);
moz_free(mImageBuffer);
mImageBuffer = nullptr;
}
// don't leak if EndImageEncode wasn't called
@ -133,7 +132,7 @@ NS_IMETHODIMP nsPNGEncoder::StartImageEncode(uint32_t aWidth,
// estimated size. Note: we don't have to worry about freeing this data
// in this function. It will be freed on object destruction.
mImageBufferSize = 8192;
mImageBuffer = (uint8_t*)PR_Malloc(mImageBufferSize);
mImageBuffer = (uint8_t*)moz_malloc(mImageBufferSize);
if (!mImageBuffer) {
png_destroy_write_struct(&mPNG, &mPNGinfo);
return NS_ERROR_OUT_OF_MEMORY;
@ -482,7 +481,7 @@ nsPNGEncoder::ParseOptions(const nsAString& aOptions,
NS_IMETHODIMP nsPNGEncoder::Close()
{
if (mImageBuffer != nullptr) {
PR_Free(mImageBuffer);
moz_free(mImageBuffer);
mImageBuffer = nullptr;
mImageBufferSize = 0;
mImageBufferUsed = 0;
@ -679,11 +678,11 @@ nsPNGEncoder::WriteCallback(png_structp png, png_bytep data,
// expand buffer, just double each time
that->mImageBufferSize *= 2;
uint8_t* newBuf = (uint8_t*)PR_Realloc(that->mImageBuffer,
that->mImageBufferSize);
uint8_t* newBuf = (uint8_t*)moz_realloc(that->mImageBuffer,
that->mImageBufferSize);
if (! newBuf) {
// can't resize, just zero (this will keep us from writing more)
PR_Free(that->mImageBuffer);
moz_free(that->mImageBuffer);
that->mImageBuffer = nullptr;
that->mImageBufferSize = 0;
that->mImageBufferUsed = 0;

View File

@ -15,7 +15,6 @@
#include "nsIInterfaceRequestorUtils.h"
#include "nsAutoPtr.h"
#include "nsStringStream.h"
#include "prmem.h"
#include "prenv.h"
#include "ImageContainer.h"
#include "Layers.h"

View File

@ -9,7 +9,6 @@
#include <limits.h>
#include "prmem.h"
#include "prenv.h"
#include "gfxPlatform.h"
@ -132,7 +131,8 @@ imgFrame::imgFrame() :
imgFrame::~imgFrame()
{
PR_FREEIF(mPalettedImageData);
moz_free(mPalettedImageData);
mPalettedImageData = nullptr;
#ifdef USE_WIN_SURFACE
if (mIsDDBSurface) {
gTotalDDBs--;