hunspell (1.2.11-1) 16_1.2.4-2

Summary

 src/hunspell/affixmgr.cxx |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

    
download this patch

Patch contents

#! /bin/sh /usr/share/dpatch/dpatch-run
## 16_2.4.1-2.dpatch by  <rene@frodo>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: get 1.2.4-2 changes. ChangeLog says (not patched here):
## DP 2008-06-18 Németh László <nemeth at OOo>:
## DP         * src/hunspell/affixmgr.cxx: fix GCC compiler warnings
## DP           (comparisons with string literal results in unspecified behaviour).
## DP           The problem reported by Ladislav Michnovič.

@DPATCH@
--- hunspell-1.2.6.orig/src/hunspell/affixmgr.cxx
+++ hunspell-1.2.6/src/hunspell/affixmgr.cxx
@@ -148,11 +148,11 @@
        sStart[j] = NULL;
   }
 
-  if (keystring) free(keystring);
+  if (keystring && keystring != SPELL_KEYSTRING) free(keystring);
   keystring=NULL;
   if (trystring) free(trystring);
   trystring=NULL;
-  if (encoding) free(encoding);
+  if (encoding && encoding != SPELL_ENCODING) free(encoding);
   encoding=NULL;
   if (maptable) {  
      for (int j=0; j < nummap; j++) {
@@ -2971,7 +2971,9 @@
 // return text encoding of dictionary
 char * AffixMgr::get_encoding()
 {
-  if (! encoding ) encoding = mystrdup(SPELL_ENCODING);
+  if (! encoding ) {
+      encoding = SPELL_ENCODING;
+  }
   return mystrdup(encoding);
 }
 
@@ -3020,7 +3022,7 @@
 // return the keyboard string for suggestions
 char * AffixMgr::get_key_string()
 {
-  if (! keystring ) keystring = mystrdup(SPELL_KEYSTRING);
+  if (! keystring ) keystring = SPELL_KEYSTRING;
   return mystrdup(keystring);
 }