diff options
author | Didier Raboud <odyx@debian.org> | 2012-10-25 21:01:59 +0200 |
---|---|---|
committer | Didier Raboud <odyx@debian.org> | 2012-10-25 21:01:59 +0200 |
commit | b1469ea9a3a5b5b652dcd733f7d419dd1fdfe844 (patch) | |
tree | 5531f93b7c293790552944e6981a1745baaf7226 /locale/po2strings.c | |
parent | 4ddc0bb6de85d409501de745bf1d3df896b15c02 (diff) | |
download | cups-b1469ea9a3a5b5b652dcd733f7d419dd1fdfe844.tar.gz |
Imported Upstream version 1.5.3upstream/1.5.3
Diffstat (limited to 'locale/po2strings.c')
-rw-r--r-- | locale/po2strings.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/locale/po2strings.c b/locale/po2strings.c index 5c9c4421..70b7fd04 100644 --- a/locale/po2strings.c +++ b/locale/po2strings.c @@ -1,9 +1,9 @@ /* - * "$Id: po2strings.c 9637 2011-03-21 23:03:22Z mike $" + * "$Id: po2strings.c 10379 2012-03-23 22:16:22Z mike $" * * Convert a GNU gettext .po file to an Apple .strings file. * - * Copyright 2007-2010 by Apple Inc. + * Copyright 2007-2012 by Apple Inc. * * These coded instructions, statements, and computer programs are the * property of Apple Inc. and are protected by Federal copyright @@ -175,7 +175,7 @@ main(int argc, /* I - Number of command-line args */ /* * Find start of value... */ - + if ((ptr = strchr(s, '\"')) == NULL) continue; @@ -196,15 +196,18 @@ main(int argc, /* I - Number of command-line args */ if (*msgid) cupsFilePrintf(strings, "\"%s\" = \"%s\";\n", msgid, (use_msgid || !*msgstr) ? msgid : msgstr); + } + if (msgid) free(msgid); + + if (msgstr) free(msgstr); - } msgid = strdup(ptr); msgstr = NULL; } - else if (s[0] == '\"' ) + else if (s[0] == '\"' && (msgid || msgstr)) { /* * Append to current string... @@ -215,6 +218,9 @@ main(int argc, /* I - Number of command-line args */ if ((temp = realloc(msgstr ? msgstr : msgid, length + strlen(ptr) + 1)) == NULL) { + free(msgid); + if (msgstr) + free(msgstr); perror("Unable to allocate string"); return (1); } @@ -250,8 +256,12 @@ main(int argc, /* I - Number of command-line args */ * Set the string... */ + if (msgstr) + free(msgstr); + if ((msgstr = strdup(ptr)) == NULL) { + free(msgid); perror("Unable to allocate msgstr"); return (1); } @@ -264,10 +274,13 @@ main(int argc, /* I - Number of command-line args */ if (*msgid) cupsFilePrintf(strings, "\"%s\" = \"%s\";\n", msgid, (use_msgid || !*msgstr) ? msgid : msgstr); + } + if (msgid) free(msgid); + + if (msgstr) free(msgstr); - } cupsFileClose(po); cupsFileClose(strings); @@ -277,5 +290,5 @@ main(int argc, /* I - Number of command-line args */ /* - * End of "$Id: po2strings.c 9637 2011-03-21 23:03:22Z mike $". + * End of "$Id: po2strings.c 10379 2012-03-23 22:16:22Z mike $". */ |