harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r509502 - /harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/unix/hyfiletext.c
Date Tue, 20 Feb 2007 10:40:52 GMT
Author: hindessm
Date: Tue Feb 20 02:40:51 2007
New Revision: 509502

URL: http://svn.apache.org/viewvc?view=rev&rev=509502
Log:
Since the "Applied HARMONY-3026 [drlvm] Add Internationalization support
to the drlvm." change (r506992) the -DHYVM_USE_ICONV mode doesn't compile.
This should fix it so it at least compiles.  It might even work.

Modified:
    harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/unix/hyfiletext.c

Modified: harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/unix/hyfiletext.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/unix/hyfiletext.c?view=diff&rev=509502&r1=509501&r2=509502
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/unix/hyfiletext.c
(original)
+++ harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/unix/hyfiletext.c
Tue Feb 20 02:40:51 2007
@@ -428,7 +428,7 @@
 
 #define CDEV_CURRENT_FUNCTION buf_write_using_iconv
 #if (defined(HYVM_USE_ICONV))
-static IDATA
+static char*
 buf_write_using_iconv (struct HyPortLibrary *portLibrary,
                         const char *buf, IDATA nbytes)
 {
@@ -436,6 +436,8 @@
     iconv_t converter;
     size_t inbytesleft, outbytesleft;
     char *inbuf;
+    char *outbuf;
+    char *bufStart;
     /* iconv_open is not an a2e function, so we need to pass it honest-to-goodness EBCDIC
strings */
     converter = iconv_open (nl_langinfo (CODESET), "UTF-8");
     if (converter == (iconv_t) - 1)
@@ -443,14 +445,14 @@
         /* no converter available for this code set. Just dump the UTF-8 chars */
         outbuf = portLibrary->mem_allocate_memory (portLibrary, nbytes + 1);
         memcpy(outbuf, buf, nbytes);
-        outBuf[nbytes] = '\0';
+        outbuf[nbytes] = '\0';
         return  outbuf;
     }
-    char *bufStart = portLibrary->mem_allocate_memory (portLibrary, 512);
-    char *outbuf = bufStart;
+    bufStart = portLibrary->mem_allocate_memory (portLibrary, outBufLen);
+    outbuf = bufStart;
     inbuf = (char *) buf;         /* for some reason this argument isn't const */
     inbytesleft = nbytes;
-    outbytesleft = sizeof (stackBuf);
+    outbytesleft = outBufLen;
     while ((size_t) - 1 ==
         iconv (converter, &inbuf, &inbytesleft, &outbuf, &outbytesleft))
     {
@@ -477,7 +479,7 @@
             iconv_close (converter);
             outbuf = portLibrary->mem_allocate_memory (portLibrary, nbytes + 1);
             memcpy(outbuf, buf, nbytes);
-            outBuf[nbytes] = '\0';
+            outbuf[nbytes] = '\0';
             portLibrary->mem_free_memory (portLibrary, bufStart);
             return  outbuf;
         }
@@ -485,7 +487,7 @@
     iconv_close (converter);
     outbuf = portLibrary->mem_allocate_memory (portLibrary, outbuf - bufStart + 1);
     memcpy(outbuf, buf, outbuf - bufStart);
-    outBuf[outbuf - bufStart] = '\0';
+    outbuf[outbuf - bufStart] = '\0';
     portLibrary->mem_free_memory (portLibrary, bufStart);
     return outbuf;
 }



Mime
View raw message