From f222743e195963bd2db85627405f0f50102fe5b6 Mon Sep 17 00:00:00 2001 From: Mathieu Malaterre Date: Fri, 21 Jul 2006 21:00:19 +0000 Subject: [PATCH] ENH: Better solution: using the opj_version function to stay up to date --- codec/image_to_j2k.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/codec/image_to_j2k.c b/codec/image_to_j2k.c index 4a28ba07..38514b10 100644 --- a/codec/image_to_j2k.c +++ b/codec/image_to_j2k.c @@ -665,9 +665,12 @@ int main(int argc, char **argv) { } if(parameters.cp_comment == NULL) { - const char comment[] = "Created by OpenJPEG version 1.0"; - parameters.cp_comment = (char*)malloc(strlen(comment)+1); - strcpy(parameters.cp_comment, comment); + const char comment[] = "Created by OpenJPEG version "; + const size_t clen = strlen(comment); + const char *version = opj_version(); + parameters.cp_comment = (char*)malloc(clen+strlen(version)+1); + strncpy(parameters.cp_comment, comment, clen); /* clen bytes */ + strcpy(parameters.cp_comment+clen, version); /* strlen(version) + \0 */ } /* decode the source image */