diff options
| author | Freeimage <freeimage@aliceadsl.fr> | 2006-01-31 21:26:11 +0000 |
|---|---|---|
| committer | Freeimage <freeimage@aliceadsl.fr> | 2006-01-31 21:26:11 +0000 |
| commit | 355b88c15d2dcafe4074b725e2165511df02f2dd (patch) | |
| tree | a02e55bae93e0403ab99c168dd1a2f34d8894e00 /libopenjpeg | |
| parent | 74c1b3637e922cac859dbda5cfefee4dc4f365e1 (diff) | |
fixed various minor warnings occuring under icc9 and bcc32, added MSVC project and compiler directives to build a 'standard' WIN32 DLL
Diffstat (limited to 'libopenjpeg')
| -rw-r--r-- | libopenjpeg/cio.c | 8 | ||||
| -rw-r--r-- | libopenjpeg/event.c | 2 | ||||
| -rw-r--r-- | libopenjpeg/image.c | 4 | ||||
| -rw-r--r-- | libopenjpeg/openjpeg.c | 52 | ||||
| -rw-r--r-- | libopenjpeg/openjpeg.h | 57 | ||||
| -rw-r--r-- | libopenjpeg/t2.c | 4 | ||||
| -rw-r--r-- | libopenjpeg/tcd.c | 2 |
7 files changed, 90 insertions, 39 deletions
diff --git a/libopenjpeg/cio.c b/libopenjpeg/cio.c index c9c59bc2..d8e0105d 100644 --- a/libopenjpeg/cio.c +++ b/libopenjpeg/cio.c @@ -32,7 +32,7 @@ /* ----------------------------------------------------------------------- */ -opj_cio_t* opj_cio_open(opj_common_ptr cinfo, unsigned char *buffer, int length) { +opj_cio_t* OPJ_CALLCONV opj_cio_open(opj_common_ptr cinfo, unsigned char *buffer, int length) { opj_cp_t *cp = NULL; opj_cio_t *cio = (opj_cio_t*)opj_malloc(sizeof(opj_cio_t)); if(!cio) return NULL; @@ -77,7 +77,7 @@ opj_cio_t* opj_cio_open(opj_common_ptr cinfo, unsigned char *buffer, int length) return cio; } -void opj_cio_close(opj_cio_t *cio) { +void OPJ_CALLCONV opj_cio_close(opj_cio_t *cio) { if(cio) { if(cio->openmode == OPJ_STREAM_WRITE) { /* destroy the allocated buffer */ @@ -94,7 +94,7 @@ void opj_cio_close(opj_cio_t *cio) { /* * Get position in byte stream. */ -int cio_tell(opj_cio_t *cio) { +int OPJ_CALLCONV cio_tell(opj_cio_t *cio) { return cio->bp - cio->start; } @@ -103,7 +103,7 @@ int cio_tell(opj_cio_t *cio) { * * pos : position, in number of bytes, from the beginning of the stream */ -void cio_seek(opj_cio_t *cio, int pos) { +void OPJ_CALLCONV cio_seek(opj_cio_t *cio, int pos) { cio->bp = cio->start + pos; } diff --git a/libopenjpeg/event.c b/libopenjpeg/event.c index bdf326a0..183931d1 100644 --- a/libopenjpeg/event.c +++ b/libopenjpeg/event.c @@ -61,7 +61,7 @@ _itoa(int i, char *a, int r) { /* ----------------------------------------------------------------------- */ -opj_event_mgr_t* opj_set_event_mgr(opj_common_ptr cinfo, opj_event_mgr_t *event_mgr, void *context) { +opj_event_mgr_t* OPJ_CALLCONV opj_set_event_mgr(opj_common_ptr cinfo, opj_event_mgr_t *event_mgr, void *context) { if(cinfo) { opj_event_mgr_t *previous = cinfo->event_mgr; cinfo->event_mgr = event_mgr; diff --git a/libopenjpeg/image.c b/libopenjpeg/image.c index 6159b639..84664e9a 100644 --- a/libopenjpeg/image.c +++ b/libopenjpeg/image.c @@ -31,7 +31,7 @@ opj_image_t* opj_image_create0() { return image; } -opj_image_t *opj_image_create(int numcmpts, opj_image_cmptparm_t *cmptparms, OPJ_COLOR_SPACE clrspc) { +opj_image_t* OPJ_CALLCONV opj_image_create(int numcmpts, opj_image_cmptparm_t *cmptparms, OPJ_COLOR_SPACE clrspc) { int compno; opj_image_t *image = NULL; @@ -68,7 +68,7 @@ opj_image_t *opj_image_create(int numcmpts, opj_image_cmptparm_t *cmptparms, OPJ return image; } -void opj_image_destroy(opj_image_t *image) { +void OPJ_CALLCONV opj_image_destroy(opj_image_t *image) { int i; if(image) { if(image->comps) { diff --git a/libopenjpeg/openjpeg.c b/libopenjpeg/openjpeg.c index b90eca6f..5c6cee7b 100644 --- a/libopenjpeg/openjpeg.c +++ b/libopenjpeg/openjpeg.c @@ -24,13 +24,40 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#ifdef WIN32 +#include <windows.h> +#endif /* WIN32 */ + #include "opj_includes.h" -const char * opj_version() { +/* ---------------------------------------------------------------------- */ +#ifdef WIN32 +#ifndef OPJ_STATIC +BOOL APIENTRY +DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { + switch (ul_reason_for_call) { + case DLL_PROCESS_ATTACH : + break; + case DLL_PROCESS_DETACH : + break; + case DLL_THREAD_ATTACH : + case DLL_THREAD_DETACH : + break; + } + + return TRUE; +} +#endif /* OPJ_STATIC */ +#endif /* WIN32 */ + +/* ---------------------------------------------------------------------- */ + + +const char* OPJ_CALLCONV opj_version() { return OPENJPEG_VERSION; } -opj_dinfo_t* opj_create_decompress(OPJ_CODEC_FORMAT format) { +opj_dinfo_t* OPJ_CALLCONV opj_create_decompress(OPJ_CODEC_FORMAT format) { opj_dinfo_t *dinfo = (opj_dinfo_t*)opj_malloc(sizeof(opj_dinfo_t)); if(!dinfo) return NULL; dinfo->is_decompressor = true; @@ -63,7 +90,7 @@ opj_dinfo_t* opj_create_decompress(OPJ_CODEC_FORMAT format) { return dinfo; } -void opj_destroy_decompress(opj_dinfo_t *dinfo) { +void OPJ_CALLCONV opj_destroy_decompress(opj_dinfo_t *dinfo) { if(dinfo) { /* destroy the codec */ switch(dinfo->codec_format) { @@ -83,7 +110,7 @@ void opj_destroy_decompress(opj_dinfo_t *dinfo) { } } -void opj_set_default_decoder_parameters(opj_dparameters_t *parameters) { +void OPJ_CALLCONV opj_set_default_decoder_parameters(opj_dparameters_t *parameters) { if(parameters) { memset(parameters, 0, sizeof(opj_dparameters_t)); /* default decoding parameters */ @@ -95,7 +122,7 @@ void opj_set_default_decoder_parameters(opj_dparameters_t *parameters) { } } -void opj_setup_decoder(opj_dinfo_t *dinfo, opj_dparameters_t *parameters) { +void OPJ_CALLCONV opj_setup_decoder(opj_dinfo_t *dinfo, opj_dparameters_t *parameters) { if(dinfo && parameters) { switch(dinfo->codec_format) { case CODEC_J2K: @@ -112,7 +139,7 @@ void opj_setup_decoder(opj_dinfo_t *dinfo, opj_dparameters_t *parameters) { } } -opj_image_t* opj_decode(opj_dinfo_t *dinfo, opj_cio_t *cio) { +opj_image_t* OPJ_CALLCONV opj_decode(opj_dinfo_t *dinfo, opj_cio_t *cio) { if(dinfo && cio) { switch(dinfo->codec_format) { case CODEC_J2K: @@ -121,13 +148,16 @@ opj_image_t* opj_decode(opj_dinfo_t *dinfo, opj_cio_t *cio) { return j2k_decode_jpt_stream((opj_j2k_t*)dinfo->j2k_handle, cio); case CODEC_JP2: return jp2_decode((opj_jp2_t*)dinfo->jp2_handle, cio); + case CODEC_UNKNOWN: + default: + break; } } return NULL; } -opj_cinfo_t* opj_create_compress(OPJ_CODEC_FORMAT format) { +opj_cinfo_t* OPJ_CALLCONV opj_create_compress(OPJ_CODEC_FORMAT format) { opj_cinfo_t *cinfo = (opj_cinfo_t*)opj_malloc(sizeof(opj_cinfo_t)); if(!cinfo) return NULL; cinfo->is_decompressor = false; @@ -160,7 +190,7 @@ opj_cinfo_t* opj_create_compress(OPJ_CODEC_FORMAT format) { return cinfo; } -void opj_destroy_compress(opj_cinfo_t *cinfo) { +void OPJ_CALLCONV opj_destroy_compress(opj_cinfo_t *cinfo) { if(cinfo) { /* destroy the codec */ switch(cinfo->codec_format) { @@ -180,7 +210,7 @@ void opj_destroy_compress(opj_cinfo_t *cinfo) { } } -void opj_set_default_encoder_parameters(opj_cparameters_t *parameters) { +void OPJ_CALLCONV opj_set_default_encoder_parameters(opj_cparameters_t *parameters) { if(parameters) { memset(parameters, 0, sizeof(opj_cparameters_t)); /* default coding parameters */ @@ -197,7 +227,7 @@ void opj_set_default_encoder_parameters(opj_cparameters_t *parameters) { } } -void opj_setup_encoder(opj_cinfo_t *cinfo, opj_cparameters_t *parameters, opj_image_t *image) { +void OPJ_CALLCONV opj_setup_encoder(opj_cinfo_t *cinfo, opj_cparameters_t *parameters, opj_image_t *image) { if(cinfo && parameters && image) { switch(cinfo->codec_format) { case CODEC_J2K: @@ -214,7 +244,7 @@ void opj_setup_encoder(opj_cinfo_t *cinfo, opj_cparameters_t *parameters, opj_im } } -bool opj_encode(opj_cinfo_t *cinfo, opj_cio_t *cio, opj_image_t *image, char *index) { +bool OPJ_CALLCONV opj_encode(opj_cinfo_t *cinfo, opj_cio_t *cio, opj_image_t *image, char *index) { if(cinfo && cio && image) { switch(cinfo->codec_format) { case CODEC_J2K: diff --git a/libopenjpeg/openjpeg.h b/libopenjpeg/openjpeg.h index ad2c4d6a..6c6ea4df 100644 --- a/libopenjpeg/openjpeg.h +++ b/libopenjpeg/openjpeg.h @@ -37,6 +37,27 @@ Compiler directives ========================================================== */ + +#if defined(OPJ_STATIC) || !(defined(WIN32) || defined(__WIN32__)) +#define OPJ_API +#define OPJ_CALLCONV +#else +#define OPJ_CALLCONV __stdcall +/* +The following ifdef block is the standard way of creating macros which make exporting +from a DLL simpler. All files within this DLL are compiled with the OPJ_EXPORTS +symbol defined on the command line. this symbol should not be defined on any project +that uses this DLL. This way any other project whose source files include this file see +OPJ_API functions as being imported from a DLL, wheras this DLL sees symbols +defined with this macro as being exported. +*/ +#ifdef OPJ_EXPORTS +#define OPJ_API __declspec(dllexport) +#else +#define OPJ_API __declspec(dllimport) +#endif /* OPJ_EXPORTS */ +#endif /* !OPJ_STATIC || !WIN32 */ + #ifndef __cplusplus #if defined(HAVE_STDBOOL_H) /* @@ -446,7 +467,7 @@ extern "C" { ========================================================== */ -const char * opj_version(); +OPJ_API const char * OPJ_CALLCONV opj_version(); /* ========================================================== @@ -461,13 +482,13 @@ Create an image @param clrspc image color space @return returns a new image structure if successful, returns NULL otherwise */ -opj_image_t *opj_image_create(int numcmpts, opj_image_cmptparm_t *cmptparms, OPJ_COLOR_SPACE clrspc); +OPJ_API opj_image_t* OPJ_CALLCONV opj_image_create(int numcmpts, opj_image_cmptparm_t *cmptparms, OPJ_COLOR_SPACE clrspc); /** Deallocate any resources associated with an image @param image image to be destroyed */ -void opj_image_destroy(opj_image_t *image); +OPJ_API void OPJ_CALLCONV opj_image_destroy(opj_image_t *image); /* ========================================================== @@ -486,26 +507,26 @@ to contain encoded data. @param length Reading: buffer length. Writing: 0 @return Returns a CIO handle if successful, returns NULL otherwise */ -opj_cio_t* opj_cio_open(opj_common_ptr cinfo, unsigned char *buffer, int length); +OPJ_API opj_cio_t* OPJ_CALLCONV opj_cio_open(opj_common_ptr cinfo, unsigned char *buffer, int length); /** Close and free a CIO handle @param cio CIO handle to free */ -void opj_cio_close(opj_cio_t *cio); +OPJ_API void OPJ_CALLCONV opj_cio_close(opj_cio_t *cio); /** Get position in byte stream @param cio CIO handle @return Returns the position in bytes */ -int cio_tell(opj_cio_t *cio); +OPJ_API int OPJ_CALLCONV cio_tell(opj_cio_t *cio); /** Set position in byte stream @param cio CIO handle @param pos Position, in number of bytes, from the beginning of the stream */ -void cio_seek(opj_cio_t *cio, int pos); +OPJ_API void OPJ_CALLCONV cio_seek(opj_cio_t *cio, int pos); /* ========================================================== @@ -513,7 +534,7 @@ void cio_seek(opj_cio_t *cio, int pos); ========================================================== */ -opj_event_mgr_t* opj_set_event_mgr(opj_common_ptr cinfo, opj_event_mgr_t *event_mgr, void *context); +OPJ_API opj_event_mgr_t* OPJ_CALLCONV opj_set_event_mgr(opj_common_ptr cinfo, opj_event_mgr_t *event_mgr, void *context); /* ========================================================== @@ -525,42 +546,42 @@ Creates a J2K/JPT/JP2 decompression structure @param format Decoder to select @return Returns a handle to a decompressor if successful, returns NULL otherwise */ -opj_dinfo_t* opj_create_decompress(OPJ_CODEC_FORMAT format); +OPJ_API opj_dinfo_t* OPJ_CALLCONV opj_create_decompress(OPJ_CODEC_FORMAT format); /** Destroy a decompressor handle @param dinfo decompressor handle to destroy */ -void opj_destroy_decompress(opj_dinfo_t *dinfo); +OPJ_API void OPJ_CALLCONV opj_destroy_decompress(opj_dinfo_t *dinfo); /** Set decoding parameters to default values @param parameters Decompression parameters */ -void opj_set_default_decoder_parameters(opj_dparameters_t *parameters); +OPJ_API void OPJ_CALLCONV opj_set_default_decoder_parameters(opj_dparameters_t *parameters); /** Setup the decoder decoding parameters using user parameters. Decoding parameters are returned in j2k->cp. @param dinfo decompressor handle @param parameters decompression parameters */ -void opj_setup_decoder(opj_dinfo_t *dinfo, opj_dparameters_t *parameters); +OPJ_API void OPJ_CALLCONV opj_setup_decoder(opj_dinfo_t *dinfo, opj_dparameters_t *parameters); /** Decode an image from a JPEG-2000 codestream @param dinfo decompressor handle @param cio Input buffer stream @return Returns a decoded image if successful, returns NULL otherwise */ -opj_image_t* opj_decode(opj_dinfo_t *dinfo, opj_cio_t *cio); +OPJ_API opj_image_t* OPJ_CALLCONV opj_decode(opj_dinfo_t *dinfo, opj_cio_t *cio); /** Creates a J2K/JP2 compression structure @param format Coder to select @return Returns a handle to a compressor if successful, returns NULL otherwise */ -opj_cinfo_t* opj_create_compress(OPJ_CODEC_FORMAT format); +OPJ_API opj_cinfo_t* OPJ_CALLCONV opj_create_compress(OPJ_CODEC_FORMAT format); /** Destroy a compressor handle @param cinfo compressor handle to destroy */ -void opj_destroy_compress(opj_cinfo_t *cinfo); +OPJ_API void OPJ_CALLCONV opj_destroy_compress(opj_cinfo_t *cinfo); /** Set encoding parameters to default values, that means : <ul> @@ -582,14 +603,14 @@ Set encoding parameters to default values, that means : </ul> @param parameters Compression parameters */ -void opj_set_default_encoder_parameters(opj_cparameters_t *parameters); +OPJ_API void OPJ_CALLCONV opj_set_default_encoder_parameters(opj_cparameters_t *parameters); /** Setup the encoder parameters using the current image and using user parameters. @param cinfo compressor handle @param parameters compression parameters @param image input filled image */ -void opj_setup_encoder(opj_cinfo_t *cinfo, opj_cparameters_t *parameters, opj_image_t *image); +OPJ_API void OPJ_CALLCONV opj_setup_encoder(opj_cinfo_t *cinfo, opj_cparameters_t *parameters, opj_image_t *image); /** Encode an image into a JPEG-2000 codestream @param cinfo compressor handle @@ -598,7 +619,7 @@ Encode an image into a JPEG-2000 codestream @param index Name of the index file if required, NULL otherwise @return Returns true if successful, returns false otherwise */ -bool opj_encode(opj_cinfo_t *cinfo, opj_cio_t *cio, opj_image_t *image, char *index); +OPJ_API bool OPJ_CALLCONV opj_encode(opj_cinfo_t *cinfo, opj_cio_t *cio, opj_image_t *image, char *index); #ifdef __cplusplus } diff --git a/libopenjpeg/t2.c b/libopenjpeg/t2.c index dda0efca..43e1fe24 100644 --- a/libopenjpeg/t2.c +++ b/libopenjpeg/t2.c @@ -73,7 +73,7 @@ Decode a packet of a tile from a source buffer @param pi Packet identity @return */ -int t2_decode_packet(opj_t2_t* t2, unsigned char *src, int len, opj_tcd_tile_t *tile, opj_tcp_t *tcp, opj_pi_iterator_t *pi); +static int t2_decode_packet(opj_t2_t* t2, unsigned char *src, int len, opj_tcd_tile_t *tile, opj_tcp_t *tcp, opj_pi_iterator_t *pi); /*@}*/ @@ -308,7 +308,7 @@ static void t2_init_seg(opj_tcd_seg_t * seg, int cblksty, int first) { } } -int t2_decode_packet(opj_t2_t* t2, unsigned char *src, int len, opj_tcd_tile_t *tile, opj_tcp_t *tcp, opj_pi_iterator_t *pi) { +static int t2_decode_packet(opj_t2_t* t2, unsigned char *src, int len, opj_tcd_tile_t *tile, opj_tcp_t *tcp, opj_pi_iterator_t *pi) { int bandno, cblkno; unsigned char *c = src; diff --git a/libopenjpeg/tcd.c b/libopenjpeg/tcd.c index 77fca831..82340207 100644 --- a/libopenjpeg/tcd.c +++ b/libopenjpeg/tcd.c @@ -945,7 +945,7 @@ void tcd_makelayer(opj_tcd_t *tcd, int layno, double thresh, int final) { dd = pass->distortiondec - cblk->passes[n - 1].distortiondec; } if (!dr) { - if (dd) + if (dd != 0) n = passno + 1; continue; } |
