<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Dec 5, 2019 at 1:45 PM Nikolay Sivov <<a href="mailto:nsivov@codeweavers.com">nsivov@codeweavers.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF">
    <tt>Do we need to unescape if it's not a <a>file://</a> url?</tt><tt> I was
      hoping we could find some IUri/path API flags to do what we need
      for us.</tt><br>
    <br></div></blockquote><div><br></div><div>The CreateUri() function called at the end of create_uri() does its own unescaping, which is why I didn't pass it the unescaped URL, but left it with the original URL. My unescaping is done for the benefit of the earlier function, PathIsURLW(), which doesn't unescape internally, and for PathSearchAndQualifyW() and UrlCreateFromPathW(), which require paths not URLs, and paths are always unescaped.<br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div bgcolor="#FFFFFF">
    <tt>Another concern is path/url max lengths are used seemingly
      randomly, and it's not a problem with your change, but with
      existing code.</tt><tt> I think asking for required length and
      allocating it is better.</tt><br>
    <br></div></blockquote><div><br></div><div>Sure.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div bgcolor="#FFFFFF">
    <blockquote type="cite">
      <pre style="color:rgb(0,0,0);font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial;white-space:pre-wrap">+    /* Regular local path with some URL encoded characters. */
+    strcpy(path2, path);
+    n = strlen(path2);
+    path2[n-1] = '%';
+    path2[n] = '6';
+    path2[n+1] = 'C';
+    path2[n+2] = '\0';   /* C:\path\to\winetest.xm%6C */
+    test_doc_load_from_path(doc, path2);</pre>
    </blockquote>
    <tt>Could you make this more readable? Maybe strcat-ing escaped file
      name as string literal instead.</tt></div></blockquote><div><br></div><div>Will do.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div bgcolor="#FFFFFF"><br>
    <blockquote type="cite">
      <pre style="color:rgb(0,0,0);font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial;white-space:pre-wrap">+    /* Regular local path with all URL encoded characters. */
+    percent_path = HeapAlloc(GetProcessHeap(), 0, 3*n + 1);
+    for (i = 0; i < n; i++)
+    {
+        static char hex_tab[] = "0123456789ABCDEF";
+        percent_path[3*i] = '%';
+        percent_path[3*i + 1] = hex_tab[path[i] >> 4];
+        percent_path[3*i + 2] = hex_tab[path[i] & 0xF];
+    }
+    percent_path[3*n] = '\0';
+    test_doc_load_from_path(doc, percent_path);
+    HeapFree(GetProcessHeap(), 0, percent_path);</pre>
    </blockquote>
    <tt>Couple of cases would be enough, like you did earlier for "l"
      -> %6c, and another one for " " -> %20. Space is actually
      not tested by this patch, and that's what application is using. If
      you still want to encode it entirely, please add a helper
      function.</tt><br></div></blockquote><div><br></div><div>Agreed. It would actually be good to test with both a space and %20.<br></div><div> </div><div><br></div></div></div>