[trunk] fix warnings when printing large integers
authorJulien Malik <julien.malik@paraiso.me>
Thu, 1 Dec 2011 10:50:14 +0000 (10:50 +0000)
committerJulien Malik <julien.malik@paraiso.me>
Thu, 1 Dec 2011 10:50:14 +0000 (10:50 +0000)
CHANGES
applications/codec/index.c
libopenjpeg/j2k.c
libopenjpeg/openjpeg.h

diff --git a/CHANGES b/CHANGES
index d8e93471db30177d48091537e614ab2f7b59bfc0..6ca91d31011cb40cc391f636d27ecd1b8f5961c1 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -7,6 +7,7 @@ What's New for OpenJPEG
 
 December 1, 2011
 * [mickael] fix a warning about a recent commit (1104)
+* [jmalik]  fix warnings when printing large integers
 
 November 30, 2011
 * [jmalik] implement Large File support in the library :
index d500ce5e93830fe68cbc82a5471b1688fa8af9c1..b53d04175dea1df789913885561c038879bd48a0 100644 (file)
@@ -383,7 +383,7 @@ int write_index_file(opj_codestream_info_t *cstr_info, char *index) {
                fprintf(stream, "%d\n", cstr_info->marknum);\r
                fprintf(stream, "type\tstart_pos    length\n");\r
                for (x = 0; x < cstr_info->marknum; x++)\r
-                       fprintf(stream, "%X\t%9d %9d\n", cstr_info->marker[x].type, cstr_info->marker[x].pos, cstr_info->marker[x].len);\r
+                       fprintf(stream, "%X\t%9" OPJ_OFF_F "d %9d\n", cstr_info->marker[x].type, cstr_info->marker[x].pos, cstr_info->marker[x].len);\r
        }\r
 /* <<UniPG */\r
        fclose(stream);\r
index 8795395f47d7ca258607b7566ce7e81d927deecb..660e91b09bc7072e27957de48b14f5598800175c 100644 (file)
@@ -7735,14 +7735,15 @@ void j2k_dump_MH_index(opj_j2k_v2_t* p_j2k, FILE* out_stream)
 
        fprintf(out_stream, "Codestream index from main header: {\n");
 
-       fprintf(out_stream, "\t Main header start position=%d\n\t Main header end position=%d\n",
+       fprintf(out_stream, "\t Main header start position=%" OPJ_OFF_F "d\n"
+                                   "\t Main header end position=%" OPJ_OFF_F "d\n",
                        cstr_index->main_head_start, cstr_index->main_head_end);
 
        fprintf(out_stream, "\t Marker list: {\n");
 
        if (cstr_index->marker){
                for (it_marker=0; it_marker < cstr_index->marknum ; it_marker++){
-                       fprintf(out_stream, "\t\t type=%#x, pos=%d, len=%d\n",
+                       fprintf(out_stream, "\t\t type=%#x, pos=%" OPJ_OFF_F "d, len=%d\n",
                                        cstr_index->marker[it_marker].type,
                                        cstr_index->marker[it_marker].pos,
                                        cstr_index->marker[it_marker].len );
@@ -7762,7 +7763,7 @@ void j2k_dump_MH_index(opj_j2k_v2_t* p_j2k, FILE* out_stream)
 
                        if (cstr_index->tile_index[it_tile].tp_index){
                                for (it_tile_part =0; it_tile_part < nb_of_tile_part; it_tile_part++){
-                                       fprintf(out_stream, "\t\t\t tile-part[%d]: star_pos=%d, end_header=%d, end_pos=%d.\n",
+                                       fprintf(out_stream, "\t\t\t tile-part[%d]: star_pos=%" OPJ_OFF_F "d, end_header=%" OPJ_OFF_F "d, end_pos=%" OPJ_OFF_F "d.\n",
                                                        it_tile_part,
                                                        cstr_index->tile_index[it_tile].tp_index[it_tile_part].start_pos,
                                                        cstr_index->tile_index[it_tile].tp_index[it_tile_part].end_header,
@@ -7772,7 +7773,7 @@ void j2k_dump_MH_index(opj_j2k_v2_t* p_j2k, FILE* out_stream)
 
                        if (cstr_index->tile_index[it_tile].marker){
                                for (it_marker=0; it_marker < cstr_index->tile_index[it_tile].marknum ; it_marker++){
-                                       fprintf(out_stream, "\t\t type=%#x, pos=%d, len=%d\n",
+                                       fprintf(out_stream, "\t\t type=%#x, pos=%" OPJ_OFF_F "d, len=%d\n",
                                                        cstr_index->tile_index[it_tile].marker[it_marker].type,
                                                        cstr_index->tile_index[it_tile].marker[it_marker].pos,
                                                        cstr_index->tile_index[it_tile].marker[it_marker].len );
index d8a332b3c78c8d8965e049989b80ba6c567c5552..90de1d27e4c76c4f4700382d189f20c63b6e286a 100644 (file)
@@ -76,7 +76,7 @@ typedef int opj_bool; /*FIXME it should be to follow the name of others OPJ_TYPE
 #define OPJ_TRUE 1
 #define OPJ_FALSE 0
 
-// FIXME : should be better defined by configure/CMake test
+/* FIXME : should be better defined by configure/CMake test */
 typedef unsigned int   OPJ_UINT32;
 typedef int                            OPJ_INT32;
 typedef unsigned short OPJ_UINT16;
@@ -88,17 +88,27 @@ typedef double                      OPJ_FLOAT64;
 typedef float                  OPJ_FLOAT32;
 
 #if (defined(WIN32) || defined(WIN64)) && !defined(__MINGW32__)
+
 typedef signed __int64     OPJ_INT64;
+#define OPJ_INT64_F "I64"
 typedef unsigned __int64   OPJ_UINT64;
+#define OPJ_UINT64_F "I64"
+
 #else
+
 typedef long long          OPJ_INT64;
+#define OPJ_INT64_F "ll"
+
 typedef unsigned long long OPJ_UINT64;
+#define OPJ_UINT64_F "ll"
+
 #endif
 
-/* 64-bit file and blob offset type */
+/* 64-bit file offset type */
 typedef OPJ_INT64 OPJ_OFF_T;
+#define OPJ_OFF_F OPJ_INT64_F
 
-// Avoid compile-time warning because parameter is not used
+/* Avoid compile-time warning because parameter is not used */
 #define OPJ_ARG_NOT_USED(x) (void)(x)
 
 /*