ENH: Cannot assign const char* into a char*. At same time upgrade OpenJPEG version to proper one

This commit is contained in:
Mathieu Malaterre 2006-07-21 20:03:07 +00:00
parent 817681fb98
commit d55af7fe7e
1 changed files with 4 additions and 7 deletions

View File

@ -631,7 +631,6 @@ void info_callback(const char *msg, void *client_data) {
int main(int argc, char **argv) { int main(int argc, char **argv) {
bool bSuccess; bool bSuccess;
bool delete_comment = true;
opj_cparameters_t parameters; /* compression parameters */ opj_cparameters_t parameters; /* compression parameters */
opj_event_mgr_t event_mgr; /* event manager */ opj_event_mgr_t event_mgr; /* event manager */
opj_image_t *image = NULL; opj_image_t *image = NULL;
@ -654,9 +653,9 @@ int main(int argc, char **argv) {
} }
if(parameters.cp_comment == NULL) { if(parameters.cp_comment == NULL) {
parameters.cp_comment = "Created by OpenJPEG version 0.9"; const char comment[] = "Created by OpenJPEG version 1.0";
/* no need to delete parameters.cp_comment on exit */ parameters.cp_comment = (char*)malloc(strlen(comment)+1);
delete_comment = false; strcpy(parameters.cp_comment, comment);
} }
/* decode the source image */ /* decode the source image */
@ -778,9 +777,7 @@ int main(int argc, char **argv) {
} }
/* free user parameters structure */ /* free user parameters structure */
if(delete_comment) {
if(parameters.cp_comment) free(parameters.cp_comment); if(parameters.cp_comment) free(parameters.cp_comment);
}
if(parameters.cp_matrice) free(parameters.cp_matrice); if(parameters.cp_matrice) free(parameters.cp_matrice);
/* free image data */ /* free image data */