Commit Graph

628 Commits

Author SHA1 Message Date
Antonin Descampe 0febbff19e processed all c/h files through astyle with opj_astyle.cfg 2016-01-25 23:22:06 +01:00
Antonin Descampe 5c5ae1d51a fixed tile numbering
Fixes #245
2016-01-25 17:30:43 +01:00
Antonin Descampe 3767af52de Merge pull request #648 from stweil/alloc
Fix support of posix_memalloc for Linux
2016-01-23 19:43:09 +01:00
Matthieu Darbois a42d03df79 Merge pull request #551 from mayeut/coc-qcc
Add COC/QCC in main header when needed
2016-01-11 00:23:44 +01:00
Even Rouault 6a1974d40d Add comment explaining bj is not use when l_data_size == 0 2016-01-09 14:30:48 +01:00
Even Rouault 87c0d7dc1e [git/2.1 regression] Fix opj_write_tile() failure when numresolutions=1
When trying the GDAL OpenJPEG driver against openjpeg current master HEAD,
I get failures when trying to create .jp2 files. The driver uses
opj_write_tile() and in some tests numresolutions = 1.

In openjp2/dwt.c:410, l_data_size = opj_dwt_max_resolution( tilec->resolutions,tilec->numresolutions) * (OPJ_UINT32)sizeof(OPJ_INT32);
is called and returns l_data_size = 0. Now in git opj_malloc() has a special case
for 0 to return a NULL pointer whereas previously it relied on system malloc(),
which in my case didn't return NULL.

So only test the pointer value if l_data_size != 0. This makes the GDAL
autotest suite to pass again.
2016-01-08 19:38:45 +01:00
Stefan Weil 9cad6bc1f6 Fix fatal crash on 64 bit Linux
By default, OpenJPEG uses the function memalign to allocate aligned
memory on Linux systems. That function needs malloc.h which was
missing. This results in a compiler warning:

openjpeg/src/lib/openjp2/opj_malloc.c:63:3: warning:
 implicit declaration of function ‘memalign’
 [-Wimplicit-function-declaration]

On hosts where sizeof(int) < sizeof(void *) the return value of memalign
will be truncated which results in an invalid pointer.

That caused "make test" to produce lots of segmentation faults when
running on a 64 bit Linux host.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-01-06 21:40:09 +01:00
Stefan Weil 79b1c4cc85 Fix whitespace issues in opj_malloc.c
Some lines ended with spaces. Remove them.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-01-06 21:40:01 +01:00
Stefan Weil c00ee8bff7 Fix support of posix_memalign for Linux
posix_memalign is only declared conditionally in stdlib.h,
so add one of the possible definitions to get the declaration.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-01-06 18:06:45 +01:00
Stefan Weil 99c4f621bd Fix duplicate article in comments
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-01-06 08:55:29 +01:00
Stefan Weil a834ab305f Fix grammar in comment
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2015-12-31 10:13:26 +01:00
Jakub Wilk 4ddc2627dd Fix typos 2015-11-27 21:38:41 +01:00
mayeut fb4be3894e Fix undefined size jp2 box handling
Update #653
2015-11-07 01:35:43 +01:00
Stefan Weil 93a61459cd opj_decompress: Update error message
The png format is also supported, so add it to the message.
Remove also the unneeded blank character before \n.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2015-11-01 21:01:20 +01:00
mayeut 38ffbbe42e Fin compiler warnings 2015-11-01 17:08:47 +01:00
mayeut ce26e523dd Fix compiler warnings 2015-11-01 16:56:50 +01:00
Stefan Weil 7dfcbf9d7b convert: Fix compiler warnings
Fix this and other similar compiler warnings:

src/bin/jp2/convert.c: In function ‘tga_readheader’:
src/bin/jp2/convert.c:595:5: warning:
 dereferencing type-punned pointer will break strict-aliasing rules
 [-Wstrict-aliasing]
     cmap_len = get_ushort(*(unsigned short*)(&tga[5]));

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2015-11-01 16:54:38 +01:00
Stefan Weil 4ac509182a convert: Remove unneeded type casts
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2015-11-01 16:53:55 +01:00
Stefan Weil 9f78c68953 Fix typo in comments
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2015-10-29 20:37:27 +01:00
Matthieu Darbois f080ab8ce0 Merge pull request #638 from stweil/master
Fix format strings and unneeded assignment
2015-10-21 20:53:22 +02:00
mayeut e975ca2832 Merge branch 'master' into coc-qcc 2015-10-21 20:45:50 +02:00
Stephan Mühlstrasser b7a162348d Avoid pointer arithmetic with (void *) pointers. 2015-10-21 09:01:31 +02:00
mayeut d48be27f5a Generic aligned malloc implementation update.
Update #642
2015-10-21 00:09:04 +02:00
Stephan Mühlstrasser eaf55b677c Generic aligned malloc implementation.
Used for platforms where none of posix_memalign(), memalign() and
_aligned_malloc() is available.
2015-10-20 21:34:54 +02:00
Stephan Mühlstrasser a1fc83cc25 Fix HP compiler warning about redeclaration of function (#640)
HP compiler warns:
cc: "dwt.c", line 798: warning 562: Redeclaration of "opj_v4dwt_decode"
with a different storage class specifier: "opj_v4dwt_decode" will have
internal linkage.
cc: "t2.c", line 1341: warning 562: Redeclaration of "opj_t2_init_seg"
with a different storage class specifier: "opj_t2_init_seg" will have
internal linkage.
2015-10-19 12:14:27 +02:00
Stefan Weil ad7eb5630e Fix format strings and unneeded assignment
The static code analyzer cppcheck warns about unsigned integers
which use "%d" in the format string.

It also warns about an unneeded assignment.

Fix both issues.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2015-10-18 19:52:57 +02:00
mayeut 80be580d50 Merge branch 'master' into coc-qcc 2015-10-18 03:23:38 +02:00
Matthieu Darbois 05b3afd28f Merge pull request #636 from uclouvain/opj_malloc-625
Update allocation functions
Fix #625 
Fix #624
Fix #635
2015-10-18 03:14:55 +02:00
mayeut e1122a8f50 Cleanup includes 2015-10-18 02:52:33 +02:00
mayeut f9d47e28b9 Fix _aligned_malloc usage 2015-10-18 02:23:01 +02:00
mayeut 8034ffde8b Fix inconsistent behavior of malloc(0)
Update #635
Update #625
2015-10-17 02:55:09 +02:00
mayeut b3a15954f6 Add missing checks. Fix crash on failed allocation. 2015-10-17 02:16:17 +02:00
mayeut 83249c318f Fixed crash on encoding
Update #624
Update #625
2015-10-17 01:30:23 +02:00
Stephan Mühlstrasser b3c581760f Fix OpenJPEG GitHub issue #633.
"opj_includes.h" must be included before system headers, otherwise
inconsistent definitions of configuration macros lead to build
failures on AIX.
2015-10-15 10:53:33 +02:00
mayeut c8d03fea9b Merge branch 'master' into coc-qcc 2015-10-13 21:57:58 +02:00
Mathieu Malaterre 372fead0d7 Remove the explicit restrict keyword
It would trigger a compiler error on xlc compiler.  Fixes #620
2015-10-13 21:07:11 +02:00
Giuseppe Baruffa 98324bbd6b I do not recall exactly... I would say that the correct version should be
if (!JPWL_ASSUME)
    return false;

meaning that once JPWL_ASSUME=1 the code will pass over such errors and try to decode anyway (just paired with the other JPWL_ASSUME on line 1112).

Fixes #596
2015-10-13 15:20:54 +02:00
Mathieu Malaterre 26dcb7c125 Remove a possible uninitialized variable
Fixes #629
2015-10-12 21:29:12 +02:00
Mathieu Malaterre 51a67a9cbf Minor style fix to remove c++ comments 2015-10-12 21:25:53 +02:00
Mathieu Malaterre dd81b5892d minor tweaks to the code 2015-10-12 21:24:10 +02:00
Mathieu Malaterre ab8929262a Fix an issue with parenthesis 2015-10-10 21:03:44 +02:00
Mathieu Malaterre dc869c2985 Add paranoid sentinels 2015-10-10 18:38:08 +02:00
Mathieu Malaterre d753441028 implement a portable aligned realloc 2015-10-10 17:51:29 +02:00
Mathieu Malaterre 2d410fc74b do not use aligned_alloc since it requires c11 2015-10-10 14:54:21 +02:00
Mathieu Malaterre 0dc4914b4e cleanup header file and move to implementation 2015-10-09 22:04:04 +02:00
mayeut de0a9ed103 Revert "Make sure to allocate on 16bits alignement. Fix issue #624"
This reverts commit 553714a87a.
2015-10-09 21:13:06 +02:00
Mathieu Malaterre 553714a87a Make sure to allocate on 16bits alignement. Fix issue #624 2015-10-09 15:37:09 +02:00
mayeut 3259fe2ff8 Merge branch 'master' into coc-qcc 2015-10-08 19:11:52 +02:00
Stefan Weil c8ae3c5225 Fix warnings for C++
g++ complains about invalid conversions like these ones:

error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
error: invalid conversion from ‘void*’ to ‘opj_precision* {aka opj_prec*}’ [-fpermissive]

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2015-10-07 20:53:57 +02:00
Stephan Mühlstrasser 8414870ca7 Fixed problem that C++ compilation failed because of enum variable.
Replaced usage of an enum typedef for a variable that is used
for bit flags with OPJ_UINT32 type.
2015-10-07 12:28:12 +02:00