On 1/14/2017 7:01 AM, Daniel Stenberg wrote:
> Anyone wants to take a look and send us a patch/pull-request to fix
> these three outstanding and rather annoying schannel warnings?
>
> https://curl.haxx.se/dev/log.cgi?id=20170114055957-14009#prob1

So they are all "warning: assignment discards 'const' qualifier from
pointer target type [enabled by default]"

That is because the conversion function-like macros may return the
original passed-in string instead of converting and returning a copy. I
think that is bad practice and we should be making a copy of it in any
case. I suggest something simple like strdup, for example

#ifdef UNICODE

#define Curl_convert_UTF8_to_tchar(ptr) Curl_convert_UTF8_to_wchar((ptr))
#define Curl_convert_tchar_to_UTF8(ptr) Curl_convert_wchar_to_UTF8((ptr))
...
#else

-#define Curl_convert_UTF8_to_tchar(ptr) (ptr)
-#define Curl_convert_tchar_to_UTF8(ptr) (ptr)
+#define Curl_convert_UTF8_to_tchar(ptr) strdup(ptr)
+#define Curl_convert_tchar_to_UTF8(ptr) strdup(ptr)
...
#endif



-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:  https://curl.haxx.se/mail/etiquette.html

Reply via email to