]> granicus.if.org Git - openjpeg/commitdiff
David Fries suggestions. In image_to_j2k and j2k_to_image, strncpy() functions: inste...
authorFrancois-Olivier Devaux <fodevaux@users.noreply.github.com>
Tue, 13 Feb 2007 09:00:37 +0000 (09:00 +0000)
committerFrancois-Olivier Devaux <fodevaux@users.noreply.github.com>
Tue, 13 Feb 2007 09:00:37 +0000 (09:00 +0000)
ChangeLog
codec/image_to_j2k.c
codec/j2k_to_image.c

index d65f5a9ea9e2a654cb4a5a34c33d69a17c6f0cef..42e940f069a410f45b9a347f7167dd757b329975 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,7 +6,8 @@ What's New for OpenJPEG
 + : added
 
 February 13, 2007
-! [FOD] Change file modified. -fPIC flag used for 64-bit compilation. Move operation (rather than copy) for the dist library creation, and -p flag added.
+! [FOD] David Fries suggestions. In image_to_j2k and j2k_to_image, strncpy() functions: instead of specifying the path size macro, let the compiler read the length out of the array entry.
+! [FOD] David Fries suggestions. Makefile modified. -fPIC flag used for 64-bit compilation. Move operation (rather than copy) for the dist library creation, and -p flag added.
 
 January 31, 2007
 ! [FOD] Extra tokens at the end of #endif directive corrected in openjpeg.c, j2k.c and image_to_j2k.c -> no more warnings in linux compilation
index 98745ee6ff018fc0c47c7505b287cc690ad68166..a41f077a8f7b7199a11db027e50325155b4eca8a 100644 (file)
@@ -332,7 +332,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters)
                                                        infile);
                                                return 1;
                                }
-                               strncpy(parameters->infile, infile, OPJ_PATH_LEN);
+                               strncpy(parameters->infile, infile, sizeof(parameters->infile)-1);
                        }
                        break;
 
@@ -350,7 +350,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters)
                                                fprintf(stderr, "Unknown output format image %s [only *.j2k, *.jp2]!! \n", outfile);
                                                return 1;
                                }
-                               strncpy(parameters->outfile, outfile, OPJ_PATH_LEN);
+                               strncpy(parameters->outfile, outfile, sizeof(parameters->outfile)-1);
                        }
                        break;
 
@@ -498,7 +498,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters)
                        case 'x':                       /* creation of index file */
                        {
                                char *index = optarg;
-                               strncpy(parameters->index, index, OPJ_PATH_LEN);
+                               strncpy(parameters->index, index, sizeof(parameters->index)-1);
                                parameters->index_on = 1;
                        }
                        break;
@@ -668,7 +668,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters)
 
                                /* we need to enable indexing */
                                if (!parameters->index_on) {
-                                       strncpy(parameters->index, JPWL_PRIVATEINDEX_NAME, OPJ_PATH_LEN);
+                                       strncpy(parameters->index, JPWL_PRIVATEINDEX_NAME, sizeof(parameters->index)-1);
                                        parameters->index_on = 1;
                                }
 
index 7a75b8d1bd40dfb5510445b0c12211664dcf9ed1..7d8eefd0fbd23e93bd93ae18c72d19d74c0dbab3 100644 (file)
@@ -153,7 +153,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters)
                                                        infile);
                                                return 1;
                                }
-                               strncpy(parameters->infile, infile, OPJ_PATH_LEN);
+                               strncpy(parameters->infile, infile, sizeof(parameters->infile)-1);
                        }
                        break;
                                
@@ -172,7 +172,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters)
                                                fprintf(stderr, "Unknown output format image %s [only *.pnm, *.pgm, *.ppm, *.pgx or *.bmp]!! \n", outfile);
                                                return 1;
                                }
-                               strncpy(parameters->outfile, outfile, OPJ_PATH_LEN);
+                               strncpy(parameters->outfile, outfile, sizeof(parameters->outfile)-1);
                        }
                        break;