summaryrefslogtreecommitdiff
path: root/applications
diff options
context:
space:
mode:
authorMickael Savinaud <savmickael@users.noreply.github.com>2011-07-28 10:45:22 +0000
committerMickael Savinaud <savmickael@users.noreply.github.com>2011-07-28 10:45:22 +0000
commite716a316f60f66cd5a6fb07b88b2cb8b9c815cec (patch)
tree4f7e13104780fa5ac5199111cd64088ada0d9918 /applications
parentc2b0a8101b21babd3e3572c18497df2c9a1f85ac (diff)
manage case 0 frames inside yuv_num_frames function and correct some warnings with gcc4.5 (credit to Winfried)
Diffstat (limited to 'applications')
-rw-r--r--applications/codec/convert.c3
-rw-r--r--applications/codec/j2k_to_image.c2
-rw-r--r--applications/common/getopt.c2
-rw-r--r--applications/jpip/opj_client/opj_dec_server/opj_dec_server.c2
-rw-r--r--applications/mj2/frames_to_mj2.c20
-rw-r--r--applications/mj2/mj2.c14
-rw-r--r--applications/mj2/mj2.h8
-rw-r--r--applications/mj2/mj2_convert.c18
-rw-r--r--applications/mj2/mj2_convert.h2
9 files changed, 32 insertions, 39 deletions
diff --git a/applications/codec/convert.c b/applications/codec/convert.c
index 502539f7..c7adabe9 100644
--- a/applications/codec/convert.c
+++ b/applications/codec/convert.c
@@ -1968,7 +1968,6 @@ int imagetotif(opj_image_t * image, const char *outfile)
int width, height, imgsize;
int bps,index,adjust, sgnd;
int ushift, dshift, has_alpha, force16;
- unsigned int last_i=0;
TIFF *tif;
tdata_t buf;
tstrip_t strip;
@@ -2029,7 +2028,7 @@ int imagetotif(opj_image_t * image, const char *outfile)
for(strip = 0; strip < TIFFNumberOfStrips(tif); strip++)
{
unsigned char *dat8;
- tsize_t i, ssize;
+ tsize_t i, ssize, last_i = 0;
int step, restx;
ssize = TIFFStripSize(tif);
dat8 = (unsigned char*)buf;
diff --git a/applications/codec/j2k_to_image.c b/applications/codec/j2k_to_image.c
index b8f237bd..3da83119 100644
--- a/applications/codec/j2k_to_image.c
+++ b/applications/codec/j2k_to_image.c
@@ -595,7 +595,7 @@ int main(int argc, char **argv) {
file_length = ftell(fsrc);
fseek(fsrc, 0, SEEK_SET);
src = (unsigned char *) malloc(file_length);
- if (fread(src, 1, file_length, fsrc) != file_length)
+ if (fread(src, 1, file_length, fsrc) != (size_t)file_length)
{
free(src);
fclose(fsrc);
diff --git a/applications/common/getopt.c b/applications/common/getopt.c
index 5e444d39..a02dde96 100644
--- a/applications/common/getopt.c
+++ b/applications/common/getopt.c
@@ -129,7 +129,7 @@ int getopt(int nargc, char *const *nargv, const char *ostr) {
int getopt_long(int argc, char * const argv[], const char *optstring,
-struct option *longopts, int totlen) {
+const struct option *longopts, int totlen) {
static int lastidx,lastofs;
char *tmp;
int i,len;
diff --git a/applications/jpip/opj_client/opj_dec_server/opj_dec_server.c b/applications/jpip/opj_client/opj_dec_server/opj_dec_server.c
index e2709797..895ade5c 100644
--- a/applications/jpip/opj_client/opj_dec_server/opj_dec_server.c
+++ b/applications/jpip/opj_client/opj_dec_server/opj_dec_server.c
@@ -144,7 +144,7 @@ int main(int argc, char *argv[]){
int listening_socket = open_listeningsocket();
- int addrlen = sizeof(peer_sin);
+ unsigned int addrlen = sizeof(peer_sin);
cachelist_param_t *cachelist = gene_cachelist();
diff --git a/applications/mj2/frames_to_mj2.c b/applications/mj2/frames_to_mj2.c
index 4e89956f..1e0d29a9 100644
--- a/applications/mj2/frames_to_mj2.c
+++ b/applications/mj2/frames_to_mj2.c
@@ -199,29 +199,29 @@ void help_display()
fprintf(stdout,"TotalDisto\n\n");
}
-int give_progression(char progression[4])
+OPJ_PROG_ORDER give_progression(char progression[5])
{
if (progression[0] == 'L' && progression[1] == 'R'
&& progression[2] == 'C' && progression[3] == 'P') {
- return 0;
+ return LRCP;
} else {
if (progression[0] == 'R' && progression[1] == 'L'
&& progression[2] == 'C' && progression[3] == 'P') {
- return 1;
+ return RLCP;
} else {
if (progression[0] == 'R' && progression[1] == 'P'
&& progression[2] == 'C' && progression[3] == 'L') {
- return 2;
+ return RPCL;
} else {
if (progression[0] == 'P' && progression[1] == 'C'
&& progression[2] == 'R' && progression[3] == 'L') {
- return 3;
+ return PCRL;
} else {
if (progression[0] == 'C' && progression[1] == 'P'
&& progression[2] == 'R' && progression[3] == 'L') {
- return 4;
+ return CPRL;
} else {
- return -1;
+ return PROG_UNKNOWN;
}
}
}
@@ -475,9 +475,9 @@ int main(int argc, char **argv)
/* ----------------------------------------------------- */
case 'p': /* progression order */
{
- char progression[4];
+ char progression[5];
- strncpy(progression, optarg, 4);
+ strncpy(progression, optarg, 5);
j2k_parameters->prog_order = give_progression(progression);
if (j2k_parameters->prog_order == -1) {
fprintf(stderr, "Unrecognized progression order "
@@ -696,7 +696,7 @@ int main(int argc, char **argv)
movie->tk[0].num_samples =
yuv_num_frames(&movie->tk[0],mj2_parameters.infile);
- if (movie->tk[0].num_samples == -1) {
+ if (movie->tk[0].num_samples == 0) {
return 1;
}
diff --git a/applications/mj2/mj2.c b/applications/mj2/mj2.c
index dfab1917..fe48415b 100644
--- a/applications/mj2/mj2.c
+++ b/applications/mj2/mj2.c
@@ -240,9 +240,7 @@ void mj2_tts_decompact(mj2_tk_t * tk)
*/
void mj2_stsc_decompact(mj2_tk_t * tk)
{
- int j, i;
- unsigned int k;
- int sampleno=0;
+ unsigned int i, j, k, sampleno = 0;
if (tk->num_samplestochunk == 1) {
tk->num_chunks =
@@ -283,10 +281,8 @@ void mj2_stsc_decompact(mj2_tk_t * tk)
*/
void mj2_stco_decompact(mj2_tk_t * tk)
{
- int j;
- unsigned int i;
- int k = 0;
- int intra_chunk_offset;
+ unsigned int i, j, k = 0;
+ unsigned int intra_chunk_offset;
for (i = 0; i < tk->num_chunks; i++) {
intra_chunk_offset = 0;
@@ -585,7 +581,7 @@ int mj2_read_stsz(mj2_tk_t * tk, opj_cio_t *cio)
*/
void mj2_write_stsc(mj2_tk_t * tk, opj_cio_t *cio)
{
- int i;
+ unsigned int i;
mj2_box_t box;
box.init_pos = cio_tell(cio);
@@ -617,7 +613,7 @@ void mj2_write_stsc(mj2_tk_t * tk, opj_cio_t *cio)
*/
int mj2_read_stsc(mj2_tk_t * tk, opj_cio_t *cio)
{
- int i;
+ unsigned int i;
mj2_box_t box;
mj2_read_boxhdr(&box, cio); /* Box Size */
diff --git a/applications/mj2/mj2.h b/applications/mj2/mj2.h
index d4f27451..2e3d0b15 100644
--- a/applications/mj2/mj2.h
+++ b/applications/mj2/mj2.h
@@ -103,7 +103,7 @@ typedef struct mj2_tts {
Chunk
*/
typedef struct mj2_chunk {
- int num_samples;
+ unsigned int num_samples;
int sample_descr_idx;
int offset;
} mj2_chunk_t;
@@ -112,8 +112,8 @@ typedef struct mj2_chunk {
Sample to chunk
*/
typedef struct mj2_sampletochunk {
- int first_chunk;
- int samples_per_chunk;
+ unsigned int first_chunk;
+ unsigned int samples_per_chunk;
int sample_descr_idx;
} mj2_sampletochunk_t;
@@ -205,7 +205,7 @@ typedef struct mj2_tk {
mj2_tts_t *tts;
unsigned int num_chunks;
mj2_chunk_t *chunk;
- int num_samplestochunk;
+ unsigned int num_samplestochunk;
mj2_sampletochunk_t *sampletochunk;
char *name;
opj_jp2_t jp2_struct;
diff --git a/applications/mj2/mj2_convert.c b/applications/mj2/mj2_convert.c
index 0f2d975d..3d842883 100644
--- a/applications/mj2/mj2_convert.c
+++ b/applications/mj2/mj2_convert.c
@@ -37,20 +37,20 @@
/* */
/* ----------------------- */
-int yuv_num_frames(mj2_tk_t * tk, char *infile)
+unsigned int yuv_num_frames(mj2_tk_t * tk, char *infile)
{
- int numimages, frame_size, prec_size;
- long end_of_f;
+ unsigned int prec_size;
+ long end_of_f, frame_size;
FILE *f;
f = fopen(infile,"rb");
if (!f) {
fprintf(stderr, "failed to open %s for reading\n",infile);
- return -1;
+ return 0;
}
prec_size = (tk->depth + 7)/8;/* bytes of precision */
- frame_size = (int) (tk->w * tk->h * (1.0 + (double) 2 / (double) (tk->CbCr_subsampling_dx * tk->CbCr_subsampling_dy))); /* Calculate frame size */
+ frame_size = (long) (tk->w * tk->h * (1.0 + (double) 2 / (double) (tk->CbCr_subsampling_dx * tk->CbCr_subsampling_dy))); /* Calculate frame size */
frame_size *= prec_size;
fseek(f, 0, SEEK_END);
@@ -60,13 +60,11 @@ int yuv_num_frames(mj2_tk_t * tk, char *infile)
fprintf(stderr,
"YUV does not contains any frame of %d x %d size\n", tk->w,
tk->h);
- return -1;
+ return 0;
}
+ fclose(f);
- numimages = end_of_f / frame_size; /* Calculate number of images */
- fclose(f);
-
- return numimages;
+ return (unsigned int)(end_of_f / frame_size);
}
// -----------------------
diff --git a/applications/mj2/mj2_convert.h b/applications/mj2/mj2_convert.h
index 78e6c470..19ba99f7 100644
--- a/applications/mj2/mj2_convert.h
+++ b/applications/mj2/mj2_convert.h
@@ -39,7 +39,7 @@ opj_image_t *mj2_image_create(mj2_tk_t * tk, opj_cparameters_t *parameters);
char yuvtoimage(mj2_tk_t * tk, opj_image_t * img, int frame_num, opj_cparameters_t *parameters, char* infile);
-int yuv_num_frames(mj2_tk_t * tk, char *infile);
+unsigned int yuv_num_frames(mj2_tk_t * tk, char *infile);
#endif