2002-09-19 Martin Baulig <martin@gnome.org>
authorMartin Baulig <martin@novell.com>
Thu, 19 Sep 2002 00:40:39 +0000 (00:40 -0000)
committerMartin Baulig <martin@novell.com>
Thu, 19 Sep 2002 00:40:39 +0000 (00:40 -0000)
* debug-mono-symfile.c (read_string, write_string): Reflect latest
changes in the symbol file format.

svn path=/trunk/mono/; revision=7598

mono/metadata/ChangeLog
mono/metadata/debug-mono-symfile.c

index 64216d0fb0266182488a418888d814591f6be073..14f9b1700e03745ea4ad82fe5563258af7f972c7 100644 (file)
@@ -1,3 +1,8 @@
+2002-09-19  Martin Baulig  <martin@gnome.org>
+
+       * debug-mono-symfile.c (read_string, write_string): Reflect latest
+       changes in the symbol file format.
+
 2002-09-18  Martin Baulig  <martin@gnome.org>
 
        * debug-mono-symfile.c: Set version number to 21.
index 74b5610ce7b4edb44442fd5f72d1cbbff1ce4703..19e827c29a86adcc2d4bcac17dc3bd74e1305332 100644 (file)
@@ -236,45 +236,12 @@ mono_debug_close_mono_symbol_file (MonoSymbolFile *symfile)
        g_free (symfile);
 }
 
-static int
-read_7bit_encoded_int (const char **ptr)
-{
-       int ret = 0;
-       int shift = 0;
-       char b;
-
-       do {
-               b = *(*ptr)++;
-                               
-               ret = ret | ((b & 0x7f) << shift);
-               shift += 7;
-       } while ((b & 0x80) == 0x80);
-
-       return ret;
-}
-
-static int
-write_7bit_encoded_int (int fd, int value)
-{
-       do {
-               int high = (value >> 7) & 0x01ffffff;
-               char b = (char)(value & 0x7f);
-
-               if (high != 0)
-                       b = (char)(b | 0x80);
-
-               if (write (fd, &b, 1) < 0)
-                       return FALSE;
-
-               value = high;
-       } while (value != 0);
-       return TRUE;
-}
-
 static int
 write_string (int fd, const char *string)
 {
-       if (!write_7bit_encoded_int (fd, strlen (string)))
+       guint32 length = strlen (string);
+
+       if (write (fd, &length, sizeof (length)) < 0)
                return FALSE;
 
        if (write (fd, string, strlen (string)) < 0)
@@ -286,12 +253,10 @@ write_string (int fd, const char *string)
 static gchar *
 read_string (const char *ptr)
 {
-       int len = read_7bit_encoded_int (&ptr);
+       int len = *((guint32 *) ptr)++;
        gchar *retval;
 
-       retval = g_malloc0 (len+1);
-       memcpy (retval, ptr, len);
-       return retval;
+       return g_filename_from_utf8 (ptr, len, NULL, NULL, NULL);
 }
 
 gchar *