about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2021-07-08 09:48:15 +0200
committerptitSeb <sebastien.chev@gmail.com>2021-07-08 09:48:15 +0200
commitdbbda60d9e1a7893628d990a1aa214f1fdfb0528 (patch)
treea5ce83e1f027f4ce3d7457c7018561eaa1ee6cbd /src
parent401071c40a5c9c71c92fea6dfaf7ec321445f6c7 (diff)
downloadbox64-dbbda60d9e1a7893628d990a1aa214f1fdfb0528.tar.gz
box64-dbbda60d9e1a7893628d990a1aa214f1fdfb0528.zip
Added option 20219 to crul wrapped lib (for #21)
Diffstat (limited to 'src')
-rwxr-xr-xsrc/wrapped/wrappedcurl.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/wrapped/wrappedcurl.c b/src/wrapped/wrappedcurl.c
index 59b72b35..8bec144d 100755
--- a/src/wrapped/wrappedcurl.c
+++ b/src/wrapped/wrappedcurl.c
@@ -480,6 +480,28 @@ static void* find_progress_Fct(void* fct)
     return NULL;
 }
 
+// progress_int
+#define GO(A)   \
+static uintptr_t my_progress_int_fct_##A = 0;   \
+static int my_progress_int_##A(void *clientp, uint64_t dltotal, uint64_t dlnow, uint64_t ultotal, uint64_t ulnow)     \
+{                                       \
+    return (int)RunFunction(my_context, my_progress_int_fct_##A, 5, clientp, dltotal, dlnow, ultotal, ulnow);\
+}
+SUPER()
+#undef GO
+static void* find_progress_int_Fct(void* fct)
+{
+    if(!fct) return NULL;
+    if(GetNativeFnc((uintptr_t)fct))  return GetNativeFnc((uintptr_t)fct);
+    #define GO(A) if(my_progress_int_fct_##A == (uintptr_t)fct) return my_progress_int_##A;
+    SUPER()
+    #undef GO
+    #define GO(A) if(my_progress_int_fct_##A == 0) {my_progress_int_fct_##A = (uintptr_t)fct; return my_progress_int_##A; }
+    SUPER()
+    #undef GO
+    printf_log(LOG_NONE, "Warning, no more slot for curl progress_int callback\n");
+    return NULL;
+}
 #undef SUPER
 
 EXPORT uint32_t my_curl_easy_setopt(x64emu_t* emu, void* handle, uint32_t option, void* param)
@@ -512,13 +534,14 @@ EXPORT uint32_t my_curl_easy_setopt(x64emu_t* emu, void* handle, uint32_t option
             return my->curl_easy_setopt(handle, option, param);
         case CURLOPT_PROGRESSFUNCTION:
             return my->curl_easy_setopt(handle, option, find_progress_Fct(param));
+        case CURLOPT_XFERINFOFUNCTION:
+            return my->curl_easy_setopt(handle, option, find_progress_int_Fct(param));
         case CURLOPT_SOCKOPTFUNCTION:
         case CURLOPT_SOCKOPTDATA:
         case CURLOPT_OPENSOCKETFUNCTION:
         case CURLOPT_OPENSOCKETDATA:
         case CURLOPT_CLOSESOCKETFUNCTION:
         case CURLOPT_CLOSESOCKETDATA:
-        case CURLOPT_XFERINFOFUNCTION:
         //case CURLOPT_XFERINFODATA:
         case CURLOPT_DEBUGFUNCTION:
         case CURLOPT_DEBUGDATA: