From 3a3d13a6c7cac87d786fdbe05f24fee416b76e6d Mon Sep 17 00:00:00 2001 From: Joshua Granick Date: Wed, 20 Aug 2014 14:43:05 -0700 Subject: [PATCH] Compile fix --- include.xml | 1 + lime/net/URLLoader.hx | 8 ++++---- lime/net/URLRequestMethod.hx | 4 ++++ lime/net/curl/CURL.hx | 14 ++++++++------ lime/net/curl/CURLEasy.hx | 34 +++++++++++++++++----------------- 5 files changed, 34 insertions(+), 27 deletions(-) diff --git a/include.xml b/include.xml index 633aac06e..a0bd5d612 100644 --- a/include.xml +++ b/include.xml @@ -44,6 +44,7 @@ + diff --git a/lime/net/URLLoader.hx b/lime/net/URLLoader.hx index 6d45d4ebd..f569740a0 100644 --- a/lime/net/URLLoader.hx +++ b/lime/net/URLLoader.hx @@ -131,7 +131,7 @@ class URLLoader { } - private function requestUrl (url:String, method:String, data:Dynamic, requestHeaders:Array):Void { + private function requestUrl (url:String, method:URLRequestMethod, data:Dynamic, requestHeaders:Array):Void { var xmlHttpRequest:XMLHttpRequest = untyped __new__("XMLHttpRequest"); registerEvents (cast xmlHttpRequest); @@ -171,16 +171,16 @@ class URLLoader { try { - if (method == "GET" && uri != null && uri != "") { + if (method == GET && uri != null && uri != "") { var question = url.split ("?").length <= 1; - xmlHttpRequest.open (method, url + (if (question) "?" else "&") + uri, true); + xmlHttpRequest.open ("GET", url + (if (question) "?" else "&") + uri, true); uri = ""; } else { //js.Lib.alert ("open: " + method + ", " + url + ", true"); - xmlHttpRequest.open (method, url, true); + xmlHttpRequest.open (cast (method, String), url, true); } diff --git a/lime/net/URLRequestMethod.hx b/lime/net/URLRequestMethod.hx index 6a2a0a7a8..14ad5de0b 100644 --- a/lime/net/URLRequestMethod.hx +++ b/lime/net/URLRequestMethod.hx @@ -3,10 +3,14 @@ package lime.net; #if !flash @:enum abstract URLRequestMethod(String) { + #if !console_pc var DELETE = "DELETE"; + #end var GET = "GET"; var HEAD = "HEAD"; + #if !console_pc var OPTIONS = "OPTIONS"; + #end var POST = "POST"; var PUT = "PUT"; diff --git a/lime/net/curl/CURL.hx b/lime/net/curl/CURL.hx index 959f94f17..0bb2ddcbb 100644 --- a/lime/net/curl/CURL.hx +++ b/lime/net/curl/CURL.hx @@ -17,7 +17,7 @@ abstract CURL(Int) from Int to Int { public static function getDate (date:String, now:Int):Int { - #if (cpp || neko) + #if ((cpp || neko) && lime_curl) return lime_curl_getdate (date, now); #else return 0; @@ -28,7 +28,7 @@ abstract CURL(Int) from Int to Int { public static function globalCleanup ():Void { - #if (cpp || neko) + #if ((cpp || neko) && lime_curl) lime_curl_global_cleanup (); #end @@ -37,8 +37,10 @@ abstract CURL(Int) from Int to Int { public static function globalInit (flags:Int):CURLCode { - #if (cpp || neko) + #if ((cpp || neko) && lime_curl) return cast lime_curl_global_init (flags); + #else + return cast 0; #end } @@ -46,7 +48,7 @@ abstract CURL(Int) from Int to Int { public static function version ():String { - #if (cpp || neko) + #if ((cpp || neko) && lime_curl) return lime_curl_version (); #else return null; @@ -57,7 +59,7 @@ abstract CURL(Int) from Int to Int { public static function versionInfo (type:CURLVersion):String { - #if (cpp || neko) + #if ((cpp || neko) && lime_curl) return lime_curl_version_info (cast (type, Int)); #else return null; @@ -73,7 +75,7 @@ abstract CURL(Int) from Int to Int { } - #if (cpp || neko) + #if ((cpp || neko) && lime_curl) private static var lime_curl_getdate = System.load ("lime", "lime_curl_getdate", 2); private static var lime_curl_global_cleanup = System.load ("lime", "lime_curl_global_cleanup", 0); private static var lime_curl_global_init = System.load ("lime", "lime_curl_global_init", 1); diff --git a/lime/net/curl/CURLEasy.hx b/lime/net/curl/CURLEasy.hx index f6da36fdc..f04089483 100644 --- a/lime/net/curl/CURLEasy.hx +++ b/lime/net/curl/CURLEasy.hx @@ -10,7 +10,7 @@ class CURLEasy { public static function cleanup (handle:CURL):Void { - #if (cpp || neko) + #if ((cpp || neko) && lime_curl) lime_curl_easy_cleanup (handle); #end @@ -19,7 +19,7 @@ class CURLEasy { public static function duphandle (handle:CURL):CURL { - #if (cpp || neko) + #if ((cpp || neko) && lime_curl) return lime_curl_easy_duphandle (handle); #else return 0; @@ -30,7 +30,7 @@ class CURLEasy { public static function escape (handle:CURL, url:String, length:Int):String { - #if (cpp || neko) + #if ((cpp || neko) && lime_curl) return lime_curl_easy_escape (handle, url, length); #else return null; @@ -41,7 +41,7 @@ class CURLEasy { public static function getinfo (handle:CURL, info:CURLInfo):Dynamic { - #if (cpp || neko) + #if ((cpp || neko) && lime_curl) return lime_curl_easy_getinfo (handle, cast (info, Int)); #else return null; @@ -52,10 +52,10 @@ class CURLEasy { public static function init ():CURL { - #if (cpp || neko) + #if ((cpp || neko) && lime_curl) return lime_curl_easy_init (); #else - return null; + return 0; #end } @@ -63,7 +63,7 @@ class CURLEasy { public static function pause (handle:CURL, bitMask:Int):CURLCode { - #if (cpp || neko) + #if ((cpp || neko) && lime_curl) return cast lime_curl_easy_pause (handle, bitMask); #else return cast 0; @@ -74,7 +74,7 @@ class CURLEasy { public static function perform (handle:CURL):CURLCode { - #if (cpp || neko) + #if ((cpp || neko) && lime_curl) return cast lime_curl_easy_perform (handle); #else return cast 0; @@ -83,9 +83,9 @@ class CURLEasy { } - /*public static function easyRecv (handle:Dynamic):CURLCode { + /*public static function recv (handle:Dynamic):CURLCode { - #if (cpp || neko) + #if ((cpp || neko) && lime_curl) return cast lime_curl_easy_perform (handle); #else return cast 0; @@ -96,7 +96,7 @@ class CURLEasy { public static function reset (handle:CURL):CURLCode { - #if (cpp || neko) + #if ((cpp || neko) && lime_curl) return cast lime_curl_easy_reset (handle); #else return cast 0; @@ -105,9 +105,9 @@ class CURLEasy { } - /*public static function easySend (handle:Dynamic):CURLCode { + /*public static function send (handle:Dynamic):CURLCode { - #if (cpp || neko) + #if ((cpp || neko) && lime_curl) return cast lime_curl_easy_perform (handle); #else return cast 0; @@ -118,7 +118,7 @@ class CURLEasy { public static function setopt (handle:CURL, option:CURLOption, parameter:Dynamic):CURLCode { - #if (cpp || neko) + #if ((cpp || neko) && lime_curl) return cast lime_curl_easy_setopt (handle, cast (option, Int), parameter); #else return cast 0; @@ -129,7 +129,7 @@ class CURLEasy { public static function strerror (code:CURLCode):String { - #if (cpp || neko) + #if ((cpp || neko) && lime_curl) return lime_curl_easy_strerror (cast (code, Int)); #else return null; @@ -140,7 +140,7 @@ class CURLEasy { public static function unescape (handle:CURL, url:String, inLength:Int, outLength:Int):String { - #if (cpp || neko) + #if ((cpp || neko) && lime_curl) return lime_curl_easy_unescape (handle, url, inLength, outLength); #else return null; @@ -149,7 +149,7 @@ class CURLEasy { } - #if (cpp || neko) + #if ((cpp || neko) && lime_curl) private static var lime_curl_easy_cleanup = System.load ("lime", "lime_curl_easy_cleanup", 1); private static var lime_curl_easy_duphandle = System.load ("lime", "lime_curl_easy_duphandle", 1); private static var lime_curl_easy_escape = System.load ("lime", "lime_curl_easy_escape", 3);