]> granicus.if.org Git - openjpeg/commitdiff
[trunk] Another round of fixes for sign conversion warnings.
authorMathieu Malaterre <mathieu.malaterre@gmail.com>
Fri, 7 Mar 2014 13:40:54 +0000 (13:40 +0000)
committerMathieu Malaterre <mathieu.malaterre@gmail.com>
Fri, 7 Mar 2014 13:40:54 +0000 (13:40 +0000)
Update issue 256

src/lib/openjp2/phix_manager.c

index b4d5a40d7fed9f518aa6df297b7251dc163a24b3..8346e69d4c7d9a04624aa8692c509fd6c4098b11 100644 (file)
@@ -52,11 +52,11 @@ int opj_write_phix( int coff, opj_codestream_info_t cstr_info, OPJ_BOOL EPHused,
               opj_event_mgr_t * p_manager )
 {
   OPJ_BYTE l_data_header [8];
-  int len, compno, i;
+  OPJ_UINT32 len, compno, i;
   opj_jp2_box_t *box;
   OPJ_OFF_T lenp = 0;
 
-  box = (opj_jp2_box_t *)opj_calloc( cstr_info.numcomps, sizeof(opj_jp2_box_t));
+  box = (opj_jp2_box_t *)opj_calloc( (size_t)cstr_info.numcomps, sizeof(opj_jp2_box_t));
   
   for( i=0;i<2;i++){
     if (i)
@@ -67,10 +67,10 @@ int opj_write_phix( int coff, opj_codestream_info_t cstr_info, OPJ_BOOL EPHused,
     opj_write_bytes(l_data_header,JPIP_PHIX,4); /* PHIX */
     opj_stream_write_data(cio,l_data_header,4,p_manager);
       
-    opj_write_manf( i, cstr_info.numcomps, box, cio, p_manager );
+    opj_write_manf( (int)i, cstr_info.numcomps, box, cio, p_manager );
 
-    for( compno=0; compno<cstr_info.numcomps; compno++){       
-      box[compno].length = opj_write_phixfaix( coff, compno, cstr_info, EPHused, j2klen, cio,p_manager);
+    for( compno=0; compno<(OPJ_UINT32)cstr_info.numcomps; compno++){       
+      box[compno].length = (OPJ_UINT32)opj_write_phixfaix( coff, (int)compno, cstr_info, EPHused, j2klen, cio,p_manager);
       box[compno].type = JPIP_FAIX;
     }
 
@@ -83,17 +83,18 @@ int opj_write_phix( int coff, opj_codestream_info_t cstr_info, OPJ_BOOL EPHused,
 
   opj_free(box);
 
-  return len;
+  return (int)len;
 }
 
 
 int opj_write_phixfaix( int coff, int compno, opj_codestream_info_t cstr_info, OPJ_BOOL EPHused, int j2klen, opj_stream_private_t *cio,
               opj_event_mgr_t * p_manager )
 {
-  int tileno, version, i, nmax, size_of_coding; /* 4 or 8 */
+  OPJ_UINT32 tileno, version, i, nmax, size_of_coding; /* 4 or 8 */
   opj_tile_info_t *tile_Idx;
   opj_packet_info_t packet;
-  int resno, precno, layno, num_packet;
+  int resno, precno, layno;
+  OPJ_UINT32 num_packet;
   int numOfres, numOfprec, numOflayers;
   OPJ_BYTE l_data_header [8];
   OPJ_OFF_T lenp;
@@ -120,15 +121,15 @@ int opj_write_phixfaix( int coff, int compno, opj_codestream_info_t cstr_info, O
   opj_stream_write_data(cio,l_data_header,1,p_manager);
 
   nmax = 0;
-  for( i=0; i<=cstr_info.numdecompos[compno]; i++)
-    nmax += cstr_info.tile[0].ph[i] * cstr_info.tile[0].pw[i] * cstr_info.numlayers;
+  for( i=0; i<=(OPJ_UINT32)cstr_info.numdecompos[compno]; i++)
+    nmax += (OPJ_UINT32)(cstr_info.tile[0].ph[i] * cstr_info.tile[0].pw[i] * cstr_info.numlayers);
   
   opj_write_bytes(l_data_header,nmax,size_of_coding);         /* NMAX           */
   opj_stream_write_data(cio,l_data_header,size_of_coding,p_manager);
-  opj_write_bytes(l_data_header,cstr_info.tw*cstr_info.th,size_of_coding);  /* M              */
+  opj_write_bytes(l_data_header,(OPJ_UINT32)(cstr_info.tw*cstr_info.th),size_of_coding);  /* M              */
   opj_stream_write_data(cio,l_data_header,size_of_coding,p_manager);
   
-  for( tileno=0; tileno<cstr_info.tw*cstr_info.th; tileno++){
+  for( tileno=0; tileno<(OPJ_UINT32)(cstr_info.tw*cstr_info.th); tileno++){
     tile_Idx = &cstr_info.tile[ tileno];
     
     num_packet = 0;
@@ -186,5 +187,5 @@ int opj_write_phixfaix( int coff, int compno, opj_codestream_info_t cstr_info, O
   opj_stream_write_data(cio,l_data_header,4,p_manager);
   opj_stream_seek(cio, lenp+len,p_manager);
 
-  return len;
+  return (int)len;
 }