summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--libopenjpeg/openjpeg.c4
-rw-r--r--libopenjpeg/opj_malloc.h17
3 files changed, 13 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index b6f2db1e..a37ef984 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,12 @@ What's New for OpenJPEG
+ : added
February 28, 2008
+* [FOD] Fixed openjpeg.c for proper initialization of codec context structures (dinfo in opj_create_compress()
+ and opj_create_decompress(). Bug fix suggested by Andrey V. Kiselev
+* [FOD] Clean up of opj_aligned_malloc(), to just forgo the use of posix_memalign(),
+ as apparently memalign() is what is working better for everyone. Patch by Callum.
+
+February 28, 2008
- [FOD] Removed the J2KViewer module, which has been replaced by OPJViewer
* [FOD] Fixed the error handling of j2k_decode in jp2.c, thanks to Robin Cornelius
diff --git a/libopenjpeg/openjpeg.c b/libopenjpeg/openjpeg.c
index 96fa0ad5..b0cd9e36 100644
--- a/libopenjpeg/openjpeg.c
+++ b/libopenjpeg/openjpeg.c
@@ -58,7 +58,7 @@ const char* OPJ_CALLCONV opj_version(void) {
}
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));
+ opj_dinfo_t *dinfo = (opj_dinfo_t*)opj_calloc(sizeof(opj_dinfo_t));
if(!dinfo) return NULL;
dinfo->is_decompressor = true;
switch(format) {
@@ -169,7 +169,7 @@ opj_image_t* OPJ_CALLCONV opj_decode_with_info(opj_dinfo_t *dinfo, opj_cio_t *ci
}
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));
+ opj_cinfo_t *cinfo = (opj_cinfo_t*)opj_calloc(sizeof(opj_cinfo_t));
if(!cinfo) return NULL;
cinfo->is_decompressor = false;
switch(format) {
diff --git a/libopenjpeg/opj_malloc.h b/libopenjpeg/opj_malloc.h
index 1f117b6a..9b48c256 100644
--- a/libopenjpeg/opj_malloc.h
+++ b/libopenjpeg/opj_malloc.h
@@ -74,21 +74,14 @@ Allocate memory aligned to a 16 byte boundry
#endif
#else /* Not WIN32 */
#if defined(__sun)
- #define HAVE_MEMALIGN
- #elif defined(__GNUC__)
- #ifndef __APPLE__
- #define HAVE_MEMALIGN
- #include <malloc.h>
- #endif
- /* Linux x86_64 and OSX always align allocations to 16 bytes */
- #elif !defined(__amd64__) && !defined(__APPLE__)
- /* FIXME: Yes, this is a big assumption */
- #define HAVE_POSIX_MEMALIGN
+ #define HAVE_MEMALIGN
+ /* Linux x86_64 and OSX always align allocations to 16 bytes */
+ #elif !defined(__amd64__) && !defined(__APPLE__)
+ #define HAVE_MEMALIGN
+ #include <malloc.h>
#endif
#endif
-
-
#define opj_aligned_malloc(size) malloc(size)
#define opj_aligned_free(m) free(m)