cURL / Mailing Lists / curl-users / Single Mail

curl-users

Making curl.exe UNICODE aware

From: Gisle Vanem <gvanem_at_yahoo.no>
Date: Tue, 19 Aug 2014 20:51:40 +0200

The libcurl.dll works fine when compiled with -DUNICODE,
but the curl.exe tool doesn't work at all. I was getting
'curl (27): No memory' on all URLs. The easy fix for me was to
explicitly call the ASCII version for the below functions.

Patch:

--- orig/src/tool_homedir.c 2014-04-18 19:21:58 +0000
+++ src/tool_homedir.c 2014-08-19 19:55:07 +0000
@@ -39,14 +39,14 @@
   /* Don't use getenv(); it doesn't find variable added after program was
    * started. Don't accept truncated results (i.e. rc >= sizeof(buf1)). */

- rc = GetEnvironmentVariable(variable, buf1, sizeof(buf1));
+ rc = GetEnvironmentVariableA(variable, buf1, sizeof(buf1));
   if(rc > 0 && rc < sizeof(buf1)) {
     env = buf1;
     variable = buf1;
   }
   if(do_expand && strchr(variable,'%')) {
     /* buf2 == variable if not expanded */
- rc = ExpandEnvironmentStrings (variable, buf2, sizeof(buf2));
+ rc = ExpandEnvironmentStringsA (variable, buf2, sizeof(buf2));
     if(rc > 0 && rc < sizeof(buf2) &&
        !strchr(buf2,'%')) /* no vars still unexpanded */
       env = buf2;
--- orig/src/tool_parsecfg.c 2014-04-18 19:21:58 +0000
+++ src/tool_parsecfg.c 2014-08-19 19:54:44 +0000
@@ -79,7 +79,7 @@
            * already declared via inclusions done in setup header file.
            * We assume that we are using the ASCII version here.
            */
- int n = GetModuleFileName(0, filebuffer, sizeof(filebuffer));
+ int n = GetModuleFileNameA(0, filebuffer, sizeof(filebuffer));
           if(n > 0 && n < (int)sizeof(filebuffer)) {
             /* We got a valid filename - get the directory part */
             char *lastdirchar = strrchr(filebuffer, '\\');

--------------

I have no idea where and why I got this "'curl (27): No memory" before
the above patch. But looks like some failure in tool_parsecfg.c. Although
CURLE_OUT_OF_MEMORY is returned elsewhere.

--gv
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-08-19