diff --git a/project/src/net/curl/CURLBindings.cpp b/project/src/net/curl/CURLBindings.cpp index 2bbb095ea7..861bb8536f 100644 --- a/project/src/net/curl/CURLBindings.cpp +++ b/project/src/net/curl/CURLBindings.cpp @@ -718,7 +718,8 @@ namespace lime { pos->v.i = position; curl_gc_mutex.Unlock (); - length = *((int*)writeCallback->Call (bytes, pos)); + vdynamic* _length = (vdynamic*)writeCallback->Call (bytes, pos); + length = (_length != NULL ? _length->v.i : 0); curl_gc_mutex.Lock (); if (length == CURL_WRITEFUNC_PAUSE) { @@ -749,7 +750,8 @@ namespace lime { ulnow->v.d = progress->ulnow; curl_gc_mutex.Unlock (); - code = *((int*)progressCallback->Call (dltotal, dlnow, ultotal, ulnow)); + vdynamic* _code = (vdynamic*)progressCallback->Call (dltotal, dlnow, ultotal, ulnow); + code = (_code != NULL ? _code->v.i : 0); curl_gc_mutex.Lock (); if (code != 0) { // CURLE_OK @@ -776,7 +778,8 @@ namespace lime { ulnow->v.i = xferInfo->ulnow; curl_gc_mutex.Unlock (); - code = *((int*)xferInfoCallback->Call (dltotal, dlnow, ultotal, ulnow)); + vdynamic* _code = (vdynamic*)xferInfoCallback->Call (dltotal, dlnow, ultotal, ulnow); + code = (_code != NULL ? _code->v.i : 0); curl_gc_mutex.Lock (); if (code != 0) { @@ -1706,7 +1709,7 @@ namespace lime { } - progressCallbacks[handle] = new ValuePointer (parameter);; + progressCallbacks[handle] = new ValuePointer (parameter); progressValues[handle] = new CURL_Progress (); code = curl_easy_setopt (easy_handle, type, progress_callback); diff --git a/src/lime/_internal/backend/native/NativeHTTPRequest.hx b/src/lime/_internal/backend/native/NativeHTTPRequest.hx index f5ecea072d..026d23f963 100644 --- a/src/lime/_internal/backend/native/NativeHTTPRequest.hx +++ b/src/lime/_internal/backend/native/NativeHTTPRequest.hx @@ -377,7 +377,7 @@ class NativeHTTPRequest } } - private function curl_onProgress(curl:CURL, dltotal:Float, dlnow:Float, uptotal:Float, upnow:Float):Void + private function curl_onProgress(curl:CURL, dltotal:Float, dlnow:Float, uptotal:Float, upnow:Float):Int { if (upnow > writeBytesLoaded || dlnow > writeBytesLoaded || uptotal > writeBytesTotal || dltotal > writeBytesTotal) { @@ -389,6 +389,8 @@ class NativeHTTPRequest // Wrong thread // promise.progress (bytesLoaded, bytesTotal); } + + return 0; } private function curl_onWrite(curl:CURL, output:Bytes):Int