diff options
author | Sebastian Geerken <devnull@localhost> | 2013-09-06 17:34:53 +0200 |
---|---|---|
committer | Sebastian Geerken <devnull@localhost> | 2013-09-06 17:34:53 +0200 |
commit | 008f56f94c4ad36b5fa6fe337ab0a0d622600b50 (patch) | |
tree | 1055f0008024d69a06131872f83acc1357495cdc | |
parent | 5768a90c1502da9324fe35246bf1ed743a17c68d (diff) |
Fix for recent replace.
-rw-r--r-- | dw/hyphenator.cc | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/dw/hyphenator.cc b/dw/hyphenator.cc index 3402a88f..5a75a61e 100644 --- a/dw/hyphenator.cc +++ b/dw/hyphenator.cc @@ -49,8 +49,9 @@ Hyphenator::Hyphenator (const char *patFile, const char *excFile, int pack) { trie = NULL; // As long we are not sure whether a pattern file can be read. - char *buf = new char[strlen (patFile) + 5 + 1]; - snprintf(buf, sizeof (buf), "%s.trie", patFile); + int bufLen = strlen (patFile) + 5 + 1; + char *buf = new char[bufLen]; + snprintf(buf, bufLen, "%s.trie", patFile); FILE *trieF = fopen (buf, "r"); delete[] buf; @@ -119,13 +120,13 @@ Hyphenator *Hyphenator::getHyphenator (const char *lang) if (hyphenator) delete langString; else { - char *patFile = - new char[strlen (DILLO_LIBDIR) + 13 + strlen (lang) + 4 + 1]; - snprintf (patFile, sizeof (patFile), "%s/hyphenation/%s.pat", + int patFileLen = strlen (DILLO_LIBDIR) + 13 + strlen (lang) + 4 + 1; + char *patFile = new char[patFileLen]; + snprintf (patFile, patFileLen, "%s/hyphenation/%s.pat", DILLO_LIBDIR, lang); - char *excFile = - new char[strlen (DILLO_LIBDIR) + 13 + strlen (lang) + 4 + 1]; - snprintf (excFile, sizeof(excFile), "%s/hyphenation/%s.exc", + int excFileLen = strlen (DILLO_LIBDIR) + 13 + strlen (lang) + 4 + 1; + char *excFile = new char[excFileLen]; + snprintf (excFile, excFileLen, "%s/hyphenation/%s.exc", DILLO_LIBDIR, lang); //printf ("Loading hyphenation patterns for language '%s' from '%s' and " |