[redland-dev] Patch for URI parsing on Windows

John C Barstow jbowtie at amathaine.com
Fri Sep 9 11:34:27 BST 2005


Also attaching as a file in case a mail client munges the text. I'm 
uploading new Windows packages as I write this.

--- C:\source\redland\raptor\raptor_uri.c    2005-01-17 
12:03:16.000000000 +-1200
+++ C:\source\sandbox\redland-win\redland\raptor\raptor_uri.c   
 2005-09-06 14:38:43.000000000 +-1200
@@ -491,13 +491,19 @@
 
   /* See raptor_uri_filename_to_uri_string for details of the mapping */
 #ifdef WIN32
   if(ud->authority)
     len+=ud->authority_len+3;
 
-  p=ud->path+1;
+  p=ud->path;
+  /* remove leading slash from path if there is one */
+  if(*p && p[0] == '/') {
+      p++;
+      len--;
+  }
+  /* handle case where path starts with drive letter */
   if(*p && (p[1] == '|' || p[1] == ':')) {
     /* Either  
      *   "a:" like in file://a|/... or file://a:/...  
      * or
      *   "a:." like in file://a:./foo
      * giving device-relative path a:foo
@@ -507,13 +513,12 @@
       p[3]=':';
       p+= 2;
       len-= 2; /* remove 2 for ./ */
     } else
       p[1]=':';
   }
-  len--; /* for removing leading / off path */
 #endif
 
 
   /* add URI-escaped filename length */
   for(from=ud->path; *from ; from++) {
     len++;

-------------- next part --------------
A non-text attachment was scrubbed...
Name: raptor-win.diff
Type: text/x-patch
Size: 1026 bytes
Desc: not available
Url : http://lists.gnomehack.com/pipermail/redland-dev/attachments/20050909/b52e14d7/raptor-win.bin


More information about the redland-dev mailing list