Skip to content

Commit

Permalink
WinHTTP A version
Browse files Browse the repository at this point in the history
  • Loading branch information
plzombie committed Dec 26, 2022
1 parent 8f91b31 commit 1a13a0a
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions fastimage.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 1a13a0a

Please sign in to comment.