OSSP CVS Repository

ossp - Check-in [5526]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 5526
Date: 2006-Jul-26 09:15:59 (local)
2006-Jul-26 07:15:59 (UTC)
User:rse
Branch:
Comment: Apply a few more upstream fixes to jsfile.c.
Tickets:
Inspections:
Files:
ossp-pkg/js/ChangeLog      1.9 -> 1.10     5 inserted, 0 deleted
ossp-pkg/js/src/jsfile.c      1.6 -> 1.7     27 inserted, 6 deleted

ossp-pkg/js/ChangeLog 1.9 -> 1.10

--- ChangeLog    2006/07/24 20:12:14     1.9
+++ ChangeLog    2006/07/26 07:15:59     1.10
@@ -11,6 +11,11 @@
 
   This is a list of all changes to OSSP js.
 
+  Changes between 1.6.20060724 and 1.6.20060726 (2006-07-24 to 2006-07-26)
+
+   o Apply a few more upstream fixes to jsfile.c.
+     [Ralf S. Engelschall <rse@engelschall.com>]
+
   Changes between 1.6.20060722 and 1.6.20060724 (2006-07-22 to 2006-07-24)
 
    o Apply multiple code cleanups and bugfixes.


ossp-pkg/js/src/jsfile.c 1.6 -> 1.7

--- jsfile.c     2006/07/24 19:53:01     1.6
+++ jsfile.c     2006/07/26 07:15:59     1.7
@@ -807,7 +807,11 @@
 
 /* Buffered version of PR_Read. Used by js_FileRead */
 static int32
+#ifdef OSSP
+js_BufferedRead(JSFile * f, unsigned char *buf, int32 len)
+#else
 js_BufferedRead(JSFile * f, char *buf, int32 len)
+#endif
 {
     int32 count = 0;
 
@@ -901,7 +905,11 @@
         break;
 
       case UCS2:
+#ifdef OSSP
+        count = js_BufferedRead(file, (unsigned char*)buf, len*2) >> 1;
+#else
         count = js_BufferedRead(file, (char*)buf, len*2) >> 1;
+#endif
         if (count == -1)
             return 0;
 
@@ -2259,8 +2267,15 @@
 file_toString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval*rval)
 {
     JSFile *file = JS_GetInstancePrivate(cx, obj, &file_class, NULL);
+#ifdef OSSP
+    JSString *str;
 
+    if ((str = JS_NewStringCopyZ(cx, file->path)) == NULL)
+        return JS_FALSE;
+    *rval = STRING_TO_JSVAL(str);
+#else
     *rval = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, file->path));
+#endif
     return JS_TRUE;
 }
 
@@ -2270,6 +2285,10 @@
     JSFile *file = JS_GetInstancePrivate(cx, obj, &file_class, NULL);
     char url[MAX_PATH_LENGTH];
     jschar *urlChars;
+#ifdef OSSP
+    size_t len;
+    JSString *str;
+#endif
 
         JSFILE_CHECK_NATIVE("toURL");
 
@@ -2277,12 +2296,14 @@
     /* TODO: js_escape in jsstr.h may go away at some point */
 
 #ifdef OSSP /* BUGFIX */
-{
-    size_t len = strlen(url);
-    urlChars = js_InflateString(cx, url, &len);
-    if (urlChars == NULL) return JS_FALSE;
-    *rval = STRING_TO_JSVAL(js_NewString(cx, urlChars, len, 0));
-}
+    len = strlen(url);
+    if ((urlChars = js_InflateString(cx, url, &len)) == NULL)
+        return JS_FALSE;
+    if ((str = js_NewString(cx, urlChars, len, 0)) == NULL) {
+        JS_free(cx, urlChars);
+        return JS_FALSE;
+    }
+    *rval = STRING_TO_JSVAL(str);
 #else
     urlChars = js_InflateString(cx, url, strlen(url));
     if (urlChars == NULL) return JS_FALSE;

CVSTrac 2.0.1