Minor modifications from jpeg-8d
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@879 632fc199-4ca6-4c93-a231-07263d6284db
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* This file was part of the Independent JPEG Group's software:
|
* This file was part of the Independent JPEG Group's software:
|
||||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||||
* Modified 2009 by Guido Vollbeding.
|
* Modified 2009-2012 by Guido Vollbeding.
|
||||||
* Modifications:
|
* Modifications:
|
||||||
* Copyright (C) 2011, D. R. Commander.
|
* Copyright (C) 2011, D. R. Commander.
|
||||||
* For conditions of distribution and use, see the accompanying README file.
|
* For conditions of distribution and use, see the accompanying README file.
|
||||||
@@ -93,7 +93,7 @@ empty_mem_output_buffer (j_compress_ptr cinfo)
|
|||||||
|
|
||||||
/* Try to allocate new buffer with double size */
|
/* Try to allocate new buffer with double size */
|
||||||
nextsize = dest->bufsize * 2;
|
nextsize = dest->bufsize * 2;
|
||||||
nextbuffer = malloc(nextsize);
|
nextbuffer = (JOCTET *) malloc(nextsize);
|
||||||
|
|
||||||
if (nextbuffer == NULL)
|
if (nextbuffer == NULL)
|
||||||
ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, 10);
|
ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, 10);
|
||||||
@@ -177,7 +177,7 @@ jpeg_mem_dest_tj (j_compress_ptr cinfo,
|
|||||||
if (*outbuffer == NULL || *outsize == 0) {
|
if (*outbuffer == NULL || *outsize == 0) {
|
||||||
if (alloc) {
|
if (alloc) {
|
||||||
/* Allocate initial buffer */
|
/* Allocate initial buffer */
|
||||||
dest->newbuffer = *outbuffer = malloc(OUTPUT_BUF_SIZE);
|
dest->newbuffer = *outbuffer = (unsigned char *) malloc(OUTPUT_BUF_SIZE);
|
||||||
if (dest->newbuffer == NULL)
|
if (dest->newbuffer == NULL)
|
||||||
ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, 10);
|
ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, 10);
|
||||||
*outsize = OUTPUT_BUF_SIZE;
|
*outsize = OUTPUT_BUF_SIZE;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* jdatadst.c
|
* jdatadst.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||||
* Modified 2009 by Guido Vollbeding.
|
* Modified 2009-2012 by Guido Vollbeding.
|
||||||
* This file is part of the Independent JPEG Group's software.
|
* This file is part of the Independent JPEG Group's software.
|
||||||
* For conditions of distribution and use, see the accompanying README file.
|
* For conditions of distribution and use, see the accompanying README file.
|
||||||
*
|
*
|
||||||
@@ -133,7 +133,7 @@ empty_mem_output_buffer (j_compress_ptr cinfo)
|
|||||||
|
|
||||||
/* Try to allocate new buffer with double size */
|
/* Try to allocate new buffer with double size */
|
||||||
nextsize = dest->bufsize * 2;
|
nextsize = dest->bufsize * 2;
|
||||||
nextbuffer = malloc(nextsize);
|
nextbuffer = (JOCTET *) malloc(nextsize);
|
||||||
|
|
||||||
if (nextbuffer == NULL)
|
if (nextbuffer == NULL)
|
||||||
ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, 10);
|
ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, 10);
|
||||||
@@ -265,7 +265,7 @@ jpeg_mem_dest (j_compress_ptr cinfo,
|
|||||||
|
|
||||||
if (*outbuffer == NULL || *outsize == 0) {
|
if (*outbuffer == NULL || *outsize == 0) {
|
||||||
/* Allocate initial buffer */
|
/* Allocate initial buffer */
|
||||||
dest->newbuffer = *outbuffer = malloc(OUTPUT_BUF_SIZE);
|
dest->newbuffer = *outbuffer = (unsigned char *) malloc(OUTPUT_BUF_SIZE);
|
||||||
if (dest->newbuffer == NULL)
|
if (dest->newbuffer == NULL)
|
||||||
ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, 10);
|
ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, 10);
|
||||||
*outsize = OUTPUT_BUF_SIZE;
|
*outsize = OUTPUT_BUF_SIZE;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* This file was part of the Independent JPEG Group's software:
|
* This file was part of the Independent JPEG Group's software:
|
||||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||||
* Modified 2009-2010 by Guido Vollbeding.
|
* Modified 2009-2011 by Guido Vollbeding.
|
||||||
* Modifications:
|
* Modifications:
|
||||||
* Copyright (C) 2011, D. R. Commander.
|
* Copyright (C) 2011, D. R. Commander.
|
||||||
* For conditions of distribution and use, see the accompanying README file.
|
* For conditions of distribution and use, see the accompanying README file.
|
||||||
@@ -71,16 +71,17 @@ init_mem_source (j_decompress_ptr cinfo)
|
|||||||
METHODDEF(boolean)
|
METHODDEF(boolean)
|
||||||
fill_mem_input_buffer (j_decompress_ptr cinfo)
|
fill_mem_input_buffer (j_decompress_ptr cinfo)
|
||||||
{
|
{
|
||||||
static JOCTET mybuffer[4];
|
static const JOCTET mybuffer[4] = {
|
||||||
|
(JOCTET) 0xFF, (JOCTET) JPEG_EOI, 0, 0
|
||||||
|
};
|
||||||
|
|
||||||
/* The whole JPEG data is expected to reside in the supplied memory
|
/* The whole JPEG data is expected to reside in the supplied memory
|
||||||
* buffer, so any request for more data beyond the given buffer size
|
* buffer, so any request for more data beyond the given buffer size
|
||||||
* is treated as an error.
|
* is treated as an error.
|
||||||
*/
|
*/
|
||||||
WARNMS(cinfo, JWRN_JPEG_EOF);
|
WARNMS(cinfo, JWRN_JPEG_EOF);
|
||||||
|
|
||||||
/* Insert a fake EOI marker */
|
/* Insert a fake EOI marker */
|
||||||
mybuffer[0] = (JOCTET) 0xFF;
|
|
||||||
mybuffer[1] = (JOCTET) JPEG_EOI;
|
|
||||||
|
|
||||||
cinfo->src->next_input_byte = mybuffer;
|
cinfo->src->next_input_byte = mybuffer;
|
||||||
cinfo->src->bytes_in_buffer = 2;
|
cinfo->src->bytes_in_buffer = 2;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* jdatasrc.c
|
* jdatasrc.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||||
* Modified 2009-2010 by Guido Vollbeding.
|
* Modified 2009-2011 by Guido Vollbeding.
|
||||||
* This file is part of the Independent JPEG Group's software.
|
* This file is part of the Independent JPEG Group's software.
|
||||||
* For conditions of distribution and use, see the accompanying README file.
|
* For conditions of distribution and use, see the accompanying README file.
|
||||||
*
|
*
|
||||||
@@ -124,16 +124,17 @@ fill_input_buffer (j_decompress_ptr cinfo)
|
|||||||
METHODDEF(boolean)
|
METHODDEF(boolean)
|
||||||
fill_mem_input_buffer (j_decompress_ptr cinfo)
|
fill_mem_input_buffer (j_decompress_ptr cinfo)
|
||||||
{
|
{
|
||||||
static JOCTET mybuffer[4];
|
static const JOCTET mybuffer[4] = {
|
||||||
|
(JOCTET) 0xFF, (JOCTET) JPEG_EOI, 0, 0
|
||||||
|
};
|
||||||
|
|
||||||
/* The whole JPEG data is expected to reside in the supplied memory
|
/* The whole JPEG data is expected to reside in the supplied memory
|
||||||
* buffer, so any request for more data beyond the given buffer size
|
* buffer, so any request for more data beyond the given buffer size
|
||||||
* is treated as an error.
|
* is treated as an error.
|
||||||
*/
|
*/
|
||||||
WARNMS(cinfo, JWRN_JPEG_EOF);
|
WARNMS(cinfo, JWRN_JPEG_EOF);
|
||||||
|
|
||||||
/* Insert a fake EOI marker */
|
/* Insert a fake EOI marker */
|
||||||
mybuffer[0] = (JOCTET) 0xFF;
|
|
||||||
mybuffer[1] = (JOCTET) JPEG_EOI;
|
|
||||||
|
|
||||||
cinfo->src->next_input_byte = mybuffer;
|
cinfo->src->next_input_byte = mybuffer;
|
||||||
cinfo->src->bytes_in_buffer = 2;
|
cinfo->src->bytes_in_buffer = 2;
|
||||||
|
|||||||
Reference in New Issue
Block a user