Skip to content
This repository was archived by the owner on Dec 12, 2024. It is now read-only.

Commit aa3e61a

Browse files
committed
dev
1 parent 2948785 commit aa3e61a

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

examples/reacurl-get.lua

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
curl = reaper.Curl_EasyInit()
3-
reaper.Curl_EasySetopt(curl, "URL", "https://www.landoleet.org/old/gfx_test.lua")
3+
reaper.Curl_EasySetopt(curl, "URL", "https://www.landoleet.org/whatsnew.txt")
44

55
-- gets url into memory buf
66
retval, buf = reaper.Curl_EasyPerform(curl)
@@ -12,3 +12,5 @@ retval, buf = reaper.Curl_EasyPerform(curl, reaper.GetResourcePath() ..
1212

1313
reaper.Curl_EasyCleanup(curl) -- always cleanup
1414
reaper.ShowConsoleMsg("\nalso downloaded as " .. buf)
15+
16+

source/main.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ static size_t write_callback(
5959

6060
return len;
6161
}
62-
62+
/*
6363
static size_t readfile_callback(
6464
char* ptr,
6565
size_t size,
@@ -77,7 +77,7 @@ static size_t writefile_callback(
7777
{
7878
return fwrite(ptr, size, nmemb, (FILE*)stream);
7979
}
80-
80+
*/
8181
const char* defCurl_EasyInit =
8282
"CURL*\0\0\0returns curl handle\n"
8383
"study include/curl/curl.h"
@@ -195,8 +195,8 @@ int Curl_EasyPerform(
195195
if (fstat(fileno(fp), &file_info) != 0) {
196196
return 1; /* cannot continue */
197197
}
198-
curl_easy_setopt(curl, CURLOPT_READFUNCTION, readfile_callback);
199-
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writefile_callback);
198+
curl_easy_setopt(curl, CURLOPT_READFUNCTION, fread);
199+
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, fwrite);
200200
curl_easy_setopt(curl, CURLOPT_READDATA, fp);
201201
curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
202202
curl_easy_setopt(
@@ -214,7 +214,7 @@ int Curl_EasyPerform(
214214
if (data.sizewrite > 0 && realloc_cmd_ptr(
215215
&bufInOutOptionalNeedBig,
216216
&bufInOutOptionalNeedBig_sz,
217-
(int)data.sizeread)) {
217+
(int)data.sizewrite)) {
218218
memcpy(bufInOutOptionalNeedBig, data.write, data.sizewrite);
219219
}
220220
free(data.write);

0 commit comments

Comments
 (0)