diff --git a/modules/libpr0n/decoders/gif/nsGIFDecoder2.cpp b/modules/libpr0n/decoders/gif/nsGIFDecoder2.cpp index 79f31945a37..d29b222ab09 100644 --- a/modules/libpr0n/decoders/gif/nsGIFDecoder2.cpp +++ b/modules/libpr0n/decoders/gif/nsGIFDecoder2.cpp @@ -100,15 +100,7 @@ NS_IMETHODIMP nsGIFDecoder2::Init(imgIRequest *aRequest) return NS_OK; } -//****************************************************************************** -/* readonly attribute imgIRequest request; */ -NS_IMETHODIMP nsGIFDecoder2::GetRequest(imgIRequest * *aRequest) -{ - *aRequest = mImageRequest; - NS_IF_ADDREF(*aRequest); - - return NS_OK; -} + //****************************************************************************** diff --git a/modules/libpr0n/decoders/icon/nsIconDecoder.cpp b/modules/libpr0n/decoders/icon/nsIconDecoder.cpp index cfcef93bb9a..58b47045263 100644 --- a/modules/libpr0n/decoders/icon/nsIconDecoder.cpp +++ b/modules/libpr0n/decoders/icon/nsIconDecoder.cpp @@ -65,12 +65,6 @@ NS_IMETHODIMP nsIconDecoder::Init(imgIRequest *aRequest) return NS_OK; } -NS_IMETHODIMP nsIconDecoder::GetRequest(imgIRequest * *aRequest) -{ - *aRequest = mRequest; - NS_ADDREF(*aRequest); - return NS_OK; -} /** nsIOutputStream methods **/ diff --git a/modules/libpr0n/decoders/jpeg/nsJPEGDecoder.cpp b/modules/libpr0n/decoders/jpeg/nsJPEGDecoder.cpp index 5fe4d8c104b..0d4b3319f60 100644 --- a/modules/libpr0n/decoders/jpeg/nsJPEGDecoder.cpp +++ b/modules/libpr0n/decoders/jpeg/nsJPEGDecoder.cpp @@ -161,16 +161,6 @@ NS_IMETHODIMP nsJPEGDecoder::Init(imgIRequest *aRequest) return NS_OK; } -/* readonly attribute imgIRequest request; */ -NS_IMETHODIMP nsJPEGDecoder::GetRequest(imgIRequest * *aRequest) -{ - *aRequest = mRequest; - NS_ADDREF(*aRequest); - return NS_OK; -} - - - @@ -577,7 +567,6 @@ nsJPEGDecoder::OutputScanlines(int num_scanlines) nsRect r(0, mInfo.output_scanline, mInfo.output_width, 1); mObserver->OnDataAvailable(nsnull, nsnull, mFrame, &r); - } return PR_TRUE; diff --git a/modules/libpr0n/decoders/png/nsPNGDecoder.cpp b/modules/libpr0n/decoders/png/nsPNGDecoder.cpp index 86d9f3aa1a8..e4aa1180677 100644 --- a/modules/libpr0n/decoders/png/nsPNGDecoder.cpp +++ b/modules/libpr0n/decoders/png/nsPNGDecoder.cpp @@ -104,17 +104,6 @@ NS_IMETHODIMP nsPNGDecoder::Init(imgIRequest *aRequest) } -/* readonly attribute imgIRequest request; */ -NS_IMETHODIMP nsPNGDecoder::GetRequest(imgIRequest * *aRequest) -{ - *aRequest = mRequest; - NS_ADDREF(*aRequest); - return NS_OK; -} - - - - /** nsIOutputStream methods **/ @@ -153,15 +142,11 @@ static NS_METHOD ReadDataOut(nsIInputStream* in, // we need to do the setjmp here otherwise bad things will happen if (setjmp(decoder->mPNG->jmpbuf)) { png_destroy_read_struct(&decoder->mPNG, &decoder->mInfo, NULL); - // is this NS_ERROR_FAILURE enough? - - decoder->mRequest->Cancel(NS_BINDING_ABORTED); // XXX is this the correct error ? return NS_ERROR_FAILURE; } - nsresult rv = decoder->ProcessData((unsigned char*)fromRawSegment, count, writeCount); - return rv; + return decoder->ProcessData((unsigned char*)fromRawSegment, count, writeCount); } nsresult nsPNGDecoder::ProcessData(unsigned char *data, PRUint32 count, PRUint32 *readCount) @@ -282,8 +267,8 @@ info_callback(png_structp png_ptr, png_infop info_ptr) /* let libpng expand interlaced images */ if (interlace_type == PNG_INTERLACE_ADAM7) { - /* number_passes = */ - png_set_interlace_handling(png_ptr); + /* number_passes = */ + png_set_interlace_handling(png_ptr); } /* now all of those things we set above are used to update various struct @@ -321,8 +306,8 @@ info_callback(png_structp png_ptr, png_infop info_ptr) decoder->mObserver->OnStartDecode(nsnull, nsnull); decoder->mImage = do_CreateInstance("@mozilla.org/image/container;1"); - // XXX should we add code to longjmp out of here in failure cases? - // if (!decoder->mImage) return NS_ERROR_OUT_OF_MEMORY; + if (!decoder->mImage) + longjmp(decoder->mPNG->jmpbuf, 5); // NS_ERROR_OUT_OF_MEMORY decoder->mRequest->SetImage(decoder->mImage); @@ -333,10 +318,8 @@ info_callback(png_structp png_ptr, png_infop info_ptr) decoder->mObserver->OnStartContainer(nsnull, nsnull, decoder->mImage); decoder->mFrame = do_CreateInstance("@mozilla.org/gfx/image/frame;2"); -#if 0 - // XXX should we longjmp to png_ptr->jumpbuf here if we failed? - if (!decoder->mFrame) return NS_ERROR_OUT_OF_MEMORY; -#endif + if (!decoder->mFrame) + longjmp(decoder->mPNG->jmpbuf, 5); // NS_ERROR_OUT_OF_MEMORY gfx_format format; @@ -374,7 +357,7 @@ info_callback(png_structp png_ptr, png_infop info_ptr) decoder->interlacebuf = (PRUint8 *)nsMemory::Alloc(channels*width*height); decoder->ibpr = channels*width; if (!decoder->interlacebuf) { -// return NS_ERROR_FAILURE; + longjmp(decoder->mPNG->jmpbuf, 5); // NS_ERROR_OUT_OF_MEMORY } } @@ -439,11 +422,11 @@ row_callback(png_structp png_ptr, png_bytep new_row, decoder->mFrame->GetFormat(&format); PRUint8 *aptr, *cptr; -// The mac specific ifdefs in the code below are there to make sure we -// always fill in 4 byte pixels right now, which is what the mac always -// allocates for its pixel buffers in true color mode. This will change -// when we start storing images with color palettes when they don't need -// true color support (GIFs). + // The mac specific ifdefs in the code below are there to make sure we + // always fill in 4 byte pixels right now, which is what the mac always + // allocates for its pixel buffers in true color mode. This will change + // when we start storing images with color palettes when they don't need + // true color support (GIFs). switch (format) { case gfxIFormats::RGB: case gfxIFormats::BGR: @@ -550,6 +533,5 @@ end_callback(png_structp png_ptr, png_infop info_ptr) decoder->mObserver->OnStopContainer(nsnull, nsnull, decoder->mImage); decoder->mObserver->OnStopDecode(nsnull, nsnull, NS_OK, nsnull); } - } diff --git a/modules/libpr0n/decoders/ppm/nsPPMDecoder.cpp b/modules/libpr0n/decoders/ppm/nsPPMDecoder.cpp index aa0bbf9108e..195059c126b 100644 --- a/modules/libpr0n/decoders/ppm/nsPPMDecoder.cpp +++ b/modules/libpr0n/decoders/ppm/nsPPMDecoder.cpp @@ -72,15 +72,6 @@ NS_IMETHODIMP nsPPMDecoder::Init(imgIRequest *aRequest) return NS_OK; } -/* readonly attribute imgIRequest request; */ -NS_IMETHODIMP nsPPMDecoder::GetRequest(imgIRequest * *aRequest) -{ - *aRequest = mRequest; - NS_ADDREF(*aRequest); - return NS_OK; -} - - diff --git a/modules/libpr0n/public/imgIDecoder.idl b/modules/libpr0n/public/imgIDecoder.idl index 0cf6d7b8ee3..bc3b834dc19 100644 --- a/modules/libpr0n/public/imgIDecoder.idl +++ b/modules/libpr0n/public/imgIDecoder.idl @@ -47,7 +47,4 @@ interface imgIDecoder : nsIOutputStream * all of the imgIDecoderObserver APIs. */ void init(in imgIRequest aRequest); - - /// allows access to the nsIImage we have to put bits in to. - readonly attribute imgIRequest request; };