mirror of
https://github.com/dhewm/dhewm3.git
synced 2025-02-16 17:21:21 +00:00
Remove jpeg_memory_src hack that worked around old libjpeg versions
Because Debian Squeeze's libjpeg6 didn't have jpeg_mem_src(), we added jpeg_memory_src() to provide the functionality. This shouldn't be needed anymore and without it we can drop libjpeg code from our repo. Fixes #110
This commit is contained in:
parent
555d233867
commit
657ad99bf1
6 changed files with 8 additions and 158 deletions
35
README.md
35
README.md
|
@ -136,41 +136,6 @@ ADDITIONAL TERMS: The Doom 3 GPL Source Code is also subject to certain additio
|
|||
|
||||
EXCLUDED CODE: The code described below and contained in the Doom 3 GPL Source Code release is not part of the Program covered by the GPL and is expressly excluded from its terms. You are solely responsible for obtaining from the copyright holder a license for such code and complying with the applicable license terms.
|
||||
|
||||
## JPEG library
|
||||
|
||||
neo/renderer/jpeg_memory_src.*
|
||||
|
||||
This software is copyright (C) 1991-2011, Thomas G. Lane, Guido Vollbeding.
|
||||
|
||||
All Rights Reserved except as specified below.
|
||||
|
||||
Permission is hereby granted to use, copy, modify, and distribute this
|
||||
software (or portions thereof) for any purpose, without fee, subject to these
|
||||
conditions:
|
||||
(1) If any part of the source code for this software is distributed, then this
|
||||
README file must be included, with this copyright and no-warranty notice
|
||||
unaltered; and any additions, deletions, or changes to the original files
|
||||
must be clearly indicated in accompanying documentation.
|
||||
(2) If only executable code is distributed, then the accompanying
|
||||
documentation must state that "this software is based in part on the work of
|
||||
the Independent JPEG Group".
|
||||
(3) Permission for use of this software is granted only if the user accepts
|
||||
full responsibility for any undesirable consequences; the authors accept
|
||||
NO LIABILITY for damages of any kind.
|
||||
|
||||
These conditions apply to any software derived from or based on the IJG code,
|
||||
not just to the unmodified library. If you use our work, you ought to
|
||||
acknowledge us.
|
||||
|
||||
Permission is NOT granted for the use of any IJG author's name or company name
|
||||
in advertising or publicity relating to this software or products derived from
|
||||
it. This software may be referred to only as "the Independent JPEG Group's
|
||||
software".
|
||||
|
||||
We specifically permit and encourage the use of this software as the basis of
|
||||
commercial products, provided that all warranty or liability claims are
|
||||
assumed by the product vendor.
|
||||
|
||||
## PropTree
|
||||
|
||||
neo/tools/common/PropTree/*
|
||||
|
|
|
@ -86,7 +86,6 @@ include_directories(${JPEG_INCLUDE_DIR})
|
|||
|
||||
set(CMAKE_REQUIRED_INCLUDES ${JPEG_INCLUDE_DIR})
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${JPEG_LIBRARY})
|
||||
CHECK_FUNCTION_EXISTS("jpeg_mem_src" HAVE_JPEG_MEM_SRC)
|
||||
|
||||
find_package(OGG REQUIRED)
|
||||
include_directories(${OGG_INCLUDE_DIR})
|
||||
|
@ -279,7 +278,6 @@ if(NOT APPLE AND NOT WIN32)
|
|||
endif()
|
||||
|
||||
set(src_renderer
|
||||
renderer/jpeg_memory_src.cpp
|
||||
renderer/Cinematic.cpp
|
||||
renderer/GuiModel.cpp
|
||||
renderer/Image_files.cpp
|
||||
|
|
|
@ -29,12 +29,14 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "sys/platform.h"
|
||||
|
||||
#include "framework/FileSystem.h"
|
||||
#include "renderer/jpeg_memory_src.h"
|
||||
#include "renderer/tr_local.h"
|
||||
#include "sound/sound.h"
|
||||
|
||||
#include "renderer/Cinematic.h"
|
||||
|
||||
#include <jpeglib.h>
|
||||
#include <jerror.h>
|
||||
|
||||
#define CIN_system 1
|
||||
#define CIN_loop 2
|
||||
#define CIN_hold 4
|
||||
|
@ -1309,7 +1311,7 @@ int JPEGBlit( byte *wStatus, byte *data, int datasize )
|
|||
|
||||
/* Step 2: specify data source (eg, a file) */
|
||||
|
||||
jpeg_memory_src(&cinfo, data, datasize);
|
||||
jpeg_mem_src(&cinfo, data, datasize);
|
||||
|
||||
/* Step 3: read file parameters with jpeg_read_header() */
|
||||
|
||||
|
|
|
@ -28,11 +28,13 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "sys/platform.h"
|
||||
|
||||
#include "renderer/jpeg_memory_src.h"
|
||||
#include "renderer/tr_local.h"
|
||||
|
||||
#include "renderer/Image.h"
|
||||
|
||||
#include <jpeglib.h>
|
||||
#include <jerror.h>
|
||||
|
||||
/*
|
||||
|
||||
This file only has a single entry point:
|
||||
|
@ -824,7 +826,7 @@ static void LoadJPG( const char *filename, unsigned char **pic, int *width, int
|
|||
|
||||
/* Step 2: specify data source (eg, a file) */
|
||||
|
||||
jpeg_memory_src(&cinfo, fbuffer, len);
|
||||
jpeg_mem_src(&cinfo, fbuffer, len);
|
||||
|
||||
/* Step 3: read file parameters with jpeg_read_header() */
|
||||
|
||||
|
|
|
@ -1,93 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||
* Modified 2009-2010 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
* This file contains decompression data source routines for the case of
|
||||
* reading JPEG data from memory or from a file (or any stdio stream).
|
||||
* While these routines are sufficient for most applications,
|
||||
* some will want to use a different source manager.
|
||||
* IMPORTANT: we assume that fread() will correctly transcribe an array of
|
||||
* JOCTETs from 8-bit-wide elements on external storage. If char is wider
|
||||
* than 8 bits on your machine, you may need to do some tweaking.
|
||||
*/
|
||||
|
||||
#include "sys/platform.h"
|
||||
|
||||
#include "renderer/jpeg_memory_src.h"
|
||||
|
||||
#ifdef HAVE_JPEG_MEM_SRC
|
||||
void jpeg_memory_src(j_decompress_ptr cinfo, unsigned char *inbuffer, unsigned long insize) {
|
||||
jpeg_mem_src(cinfo, inbuffer, insize);
|
||||
}
|
||||
#else
|
||||
static void init_mem_source(j_decompress_ptr cinfo) {
|
||||
/* no work necessary here */
|
||||
}
|
||||
|
||||
static boolean fill_mem_input_buffer(j_decompress_ptr cinfo) {
|
||||
static JOCTET mybuffer[4];
|
||||
|
||||
/* The whole JPEG data is expected to reside in the supplied memory
|
||||
* buffer, so any request for more data beyond the given buffer size
|
||||
* is treated as an error.
|
||||
*/
|
||||
WARNMS(cinfo, JWRN_JPEG_EOF);
|
||||
/* Insert a fake EOI marker */
|
||||
mybuffer[0] = (JOCTET) 0xFF;
|
||||
mybuffer[1] = (JOCTET) JPEG_EOI;
|
||||
|
||||
cinfo->src->next_input_byte = mybuffer;
|
||||
cinfo->src->bytes_in_buffer = 2;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void skip_input_data(j_decompress_ptr cinfo, long num_bytes) {
|
||||
struct jpeg_source_mgr *src = cinfo->src;
|
||||
|
||||
if (num_bytes > 0) {
|
||||
while (num_bytes > (long)src->bytes_in_buffer) {
|
||||
num_bytes -= (long)src->bytes_in_buffer;
|
||||
(void)(*src->fill_input_buffer) (cinfo);
|
||||
/* note we assume that fill_input_buffer will never return FALSE,
|
||||
* so suspension need not be handled.
|
||||
*/
|
||||
}
|
||||
src->next_input_byte += (size_t)num_bytes;
|
||||
src->bytes_in_buffer -= (size_t)num_bytes;
|
||||
}
|
||||
}
|
||||
|
||||
static void term_source(j_decompress_ptr cinfo)
|
||||
{
|
||||
/* no work necessary here */
|
||||
}
|
||||
|
||||
void jpeg_memory_src(j_decompress_ptr cinfo, unsigned char *inbuffer, unsigned long insize) {
|
||||
struct jpeg_source_mgr *src;
|
||||
|
||||
if (inbuffer == NULL || insize == 0) /* Treat empty input as fatal error */
|
||||
ERREXIT(cinfo, JERR_INPUT_EMPTY);
|
||||
|
||||
/* The source object is made permanent so that a series of JPEG images
|
||||
* can be read from the same buffer by calling jpeg_mem_src only before
|
||||
* the first one.
|
||||
*/
|
||||
if (cinfo->src == NULL) { /* first time for this JPEG object? */
|
||||
cinfo->src = (struct jpeg_source_mgr *)
|
||||
(*cinfo->mem->alloc_small)((j_common_ptr)cinfo, JPOOL_PERMANENT,
|
||||
sizeof(struct jpeg_source_mgr));
|
||||
}
|
||||
|
||||
src = cinfo->src;
|
||||
src->init_source = init_mem_source;
|
||||
src->fill_input_buffer = fill_mem_input_buffer;
|
||||
src->skip_input_data = skip_input_data;
|
||||
src->resync_to_restart = jpeg_resync_to_restart; /* use default method */
|
||||
src->term_source = term_source;
|
||||
src->bytes_in_buffer = (size_t)insize;
|
||||
src->next_input_byte = (JOCTET *)inbuffer;
|
||||
}
|
||||
#endif
|
|
@ -1,24 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||
* Modified 2009-2010 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
* This file contains decompression data source routines for the case of
|
||||
* reading JPEG data from memory or from a file (or any stdio stream).
|
||||
* While these routines are sufficient for most applications,
|
||||
* some will want to use a different source manager.
|
||||
* IMPORTANT: we assume that fread() will correctly transcribe an array of
|
||||
* JOCTETs from 8-bit-wide elements on external storage. If char is wider
|
||||
* than 8 bits on your machine, you may need to do some tweaking.
|
||||
*/
|
||||
|
||||
#ifndef __JPEG_MEMORY_SRC_H__
|
||||
#define __JPEG_MEMORY_SRC_H__
|
||||
|
||||
#include <jpeglib.h>
|
||||
#include <jerror.h>
|
||||
|
||||
void jpeg_memory_src(j_decompress_ptr cinfo, unsigned char *inbuffer, unsigned long insize);
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue