From 1a13a0aa41f02859de24b9f901b2d15ba6b9fc3b Mon Sep 17 00:00:00 2001 From: Mikhail Morozov Date: Mon, 26 Dec 2022 21:28:03 +0300 Subject: [PATCH] WinHTTP A version --- fastimage.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/fastimage.c b/fastimage.c index e80ae6e..04acd61 100644 --- a/fastimage.c +++ b/fastimage.c @@ -957,12 +957,24 @@ fastimage_image_t fastimageOpenHttpW(const wchar_t *url, bool support_proxy) fastimage_image_t fastimageOpenHttpA(const char *url, bool support_proxy) { fastimage_image_t image; + wchar_t *wurl; + size_t url_len; - (void)url; - (void)support_proxy; + url_len = strlen(url); + wurl = malloc((url_len+1)*sizeof(wchar_t)); + if(!wurl) { + memset(&image, 0, sizeof(fastimage_image_t)); + image.format = fastimage_error; + + return image; + } + wurl[url_len] = 0; + + mbstowcs(wurl, url, url_len); - memset(&image, 0, sizeof(fastimage_image_t)); - image.format = fastimage_error; + image = fastimageOpenHttpW(wurl, support_proxy); + + free(wurl); return image; }