bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSString patches


From: Alexander Malmberg
Subject: Re: NSString patches
Date: Mon, 18 Mar 2002 03:44:21 +0100

> Hi,
> 
> The recent changes in the string encoding code broke a few things. I've
> attached a patch that fixes the ones I spotted, and things seem to work
> now.

Missed a few, so I've attached some more patches. I also wrote a quick
and dirty test file for string encoding/decoding. With all these patches
it passes.

- Alexander Malmberg
Index: Unicode.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/base/Source/Unicode.m,v
retrieving revision 1.40
diff -u -r1.40 Unicode.m
--- Unicode.m   16 Mar 2002 09:54:50 -0000      1.40
+++ Unicode.m   18 Mar 2002 02:28:36 -0000
@@ -348,7 +348,7 @@
 GSIsByteEncoding(NSStringEncoding encoding)
 {
   GetAvailableEncodings();
-  if (encoding == 0 || encoding >= encTableSize || encodingTable[encoding] == 
0)
+  if (encoding == 0 || encoding > encTableSize || encodingTable[encoding] == 0)
     {
       return NO;
     }
@@ -359,7 +359,7 @@
 GSEncodingName(NSStringEncoding encoding)
 {
   GetAvailableEncodings();
-  if (encoding == 0 || encoding >= encTableSize || encodingTable[encoding] == 
0)
+  if (encoding == 0 || encoding > encTableSize || encodingTable[encoding] == 0)
     {
       return @"Unknown encoding";
     }
@@ -376,10 +376,12 @@
 iconv_stringforencoding(NSStringEncoding encoding)
 {
   GetAvailableEncodings();
-  if (encoding == 0 || encoding >= encTableSize || encodingTable[encoding] == 
0)
+  if (encoding == 0 || encoding > encTableSize || encodingTable[encoding] == 0)
     {
       return "";
     }
+  if (!encodingTable[encoding]->iconv)
+    return "";
   return encodingTable[encoding]->iconv;
 }
 
@@ -1896,7 +1897,7 @@
                  {
                    GROW();
                  }
-               if (u < 128)
+               if (u < base)
                  {
                    ptr[dpos++] = (char)u;
                  }
@@ -1920,7 +1921,7 @@
                  {
                    GROW();
                  }
-               if (u < 128)
+               if (u < base)
                  {
                    ptr[dpos++] = (char)u;
                  }

Attachment: test04.scm
Description: Lotus Screencam


reply via email to

[Prev in Thread] Current Thread [Next in Thread]