diff --git a/lime/_backend/native/NativeRenderer.hx b/lime/_backend/native/NativeRenderer.hx index dee1ec321..94ce5d1c1 100644 --- a/lime/_backend/native/NativeRenderer.hx +++ b/lime/_backend/native/NativeRenderer.hx @@ -50,7 +50,7 @@ class NativeRenderer { #else - var type = lime_renderer_get_type (handle); + var type:String = lime_renderer_get_type (handle); switch (type) { @@ -155,7 +155,7 @@ class NativeRenderer { @:cffi private static function lime_renderer_create (window:Float):Float; @:cffi private static function lime_renderer_flip (handle:Float):Void; @:cffi private static function lime_renderer_get_context (handle:Float):Float; - @:cffi private static function lime_renderer_get_type (handle:Float):String; + @:cffi private static function lime_renderer_get_type (handle:Float):Dynamic; @:cffi private static function lime_renderer_lock (handle:Float):Dynamic; @:cffi private static function lime_renderer_make_current (handle:Float):Void; @:cffi private static function lime_renderer_unlock (handle:Float):Void; diff --git a/lime/_backend/native/NativeWindow.hx b/lime/_backend/native/NativeWindow.hx index c528c7b06..3b0737457 100644 --- a/lime/_backend/native/NativeWindow.hx +++ b/lime/_backend/native/NativeWindow.hx @@ -261,7 +261,7 @@ class NativeWindow { @:cffi private static function lime_window_set_fullscreen (handle:Float, fullscreen:Bool):Bool; @:cffi private static function lime_window_set_icon (handle:Float, buffer:Dynamic):Void; @:cffi private static function lime_window_set_minimized (handle:Float, minimized:Bool):Bool; - @:cffi private static function lime_window_set_title (handle:Float, title:String):String; + @:cffi private static function lime_window_set_title (handle:Float, title:String):Dynamic; } diff --git a/lime/audio/openal/AL.hx b/lime/audio/openal/AL.hx index eafef16d4..9a06bc840 100644 --- a/lime/audio/openal/AL.hx +++ b/lime/audio/openal/AL.hx @@ -943,7 +943,7 @@ class AL { @:cffi private static function lime_al_get_sourcefv (source:Int, param:Int, count:Int):Dynamic; @:cffi private static function lime_al_get_sourcei (source:Int, param:Int):Int; @:cffi private static function lime_al_get_sourceiv (source:Int, param:Int, count:Int):Dynamic; - @:cffi private static function lime_al_get_string (param:Int):String; + @:cffi private static function lime_al_get_string (param:Int):Dynamic; @:cffi private static function lime_al_is_buffer (buffer:Int):Bool; @:cffi private static function lime_al_is_enabled (capability:Int):Bool; @:cffi private static function lime_al_is_extension_present (extname:String):Bool; diff --git a/lime/audio/openal/ALC.hx b/lime/audio/openal/ALC.hx index 286e7fab7..cfeffaa03 100644 --- a/lime/audio/openal/ALC.hx +++ b/lime/audio/openal/ALC.hx @@ -206,7 +206,7 @@ class ALC { @:cffi private static function lime_alc_get_current_context ():Float; @:cffi private static function lime_alc_get_error (device:Float):Int; @:cffi private static function lime_alc_get_integerv (device:Float, param:Int, size:Int):Dynamic; - @:cffi private static function lime_alc_get_string (device:Float, param:Int):String; + @:cffi private static function lime_alc_get_string (device:Float, param:Int):Dynamic; @:cffi private static function lime_alc_make_context_current (context:Float):Bool; @:cffi private static function lime_alc_open_device (devicename:String):Float; @:cffi private static function lime_alc_process_context (context:Float):Void; diff --git a/lime/graphics/opengl/GL.hx b/lime/graphics/opengl/GL.hx index 829c975be..f581bafc3 100644 --- a/lime/graphics/opengl/GL.hx +++ b/lime/graphics/opengl/GL.hx @@ -2283,7 +2283,7 @@ class GL { @:cffi private static function lime_gl_get_shader_info_log (shader:Int):String; @:cffi private static function lime_gl_get_shader_parameter (shader:Int, pname:Int):Int; @:cffi private static function lime_gl_get_shader_precision_format (shadertype:Int, precisiontype:Int):Dynamic; - @:cffi private static function lime_gl_get_shader_source (shader:Int):String; + @:cffi private static function lime_gl_get_shader_source (shader:Int):Dynamic; @:cffi private static function lime_gl_get_supported_extensions (result:Dynamic):Void; @:cffi private static function lime_gl_get_tex_parameter (target:Int, pname:Int):Int; @:cffi private static function lime_gl_get_uniform (program:Int, location:Int):Dynamic; diff --git a/lime/net/curl/CURL.hx b/lime/net/curl/CURL.hx index 2c768bf26..991c715b0 100644 --- a/lime/net/curl/CURL.hx +++ b/lime/net/curl/CURL.hx @@ -81,7 +81,7 @@ abstract CURL(Float) from Float to Float { @:cffi private static function lime_curl_getdate (date:String, now:Float):Float; @:cffi private static function lime_curl_global_cleanup ():Void; @:cffi private static function lime_curl_global_init (flags:Int):Int; - @:cffi private static function lime_curl_version ():String; + @:cffi private static function lime_curl_version ():Dynamic; @:cffi private static function lime_curl_version_info (type:Int):Dynamic; #end diff --git a/lime/net/curl/CURLEasy.hx b/lime/net/curl/CURLEasy.hx index 3033682c0..e8125750e 100644 --- a/lime/net/curl/CURLEasy.hx +++ b/lime/net/curl/CURLEasy.hx @@ -153,7 +153,7 @@ class CURLEasy { #if ((cpp || neko || nodejs) && lime_curl) @:cffi private static function lime_curl_easy_cleanup (handle:Float):Void; @:cffi private static function lime_curl_easy_duphandle (handle:Float):Float; - @:cffi private static function lime_curl_easy_escape (curl:Float, url:String, length:Int):String; + @:cffi private static function lime_curl_easy_escape (curl:Float, url:String, length:Int):Dynamic; @:cffi private static function lime_curl_easy_getinfo (curl:Float, info:Int):Dynamic; @:cffi private static function lime_curl_easy_init ():Float; @:cffi private static function lime_curl_easy_pause (handle:Float, bitmask:Int):Int; @@ -162,8 +162,8 @@ class CURLEasy { @:cffi private static function lime_curl_easy_reset (curl:Float):Void; @:cffi private static function lime_curl_easy_send (curl:Float, buffer:Dynamic, buflen:Int, n:Int):Int; @:cffi private static function lime_curl_easy_setopt (handle:Float, option:Int, parameter:Dynamic):Int; - @:cffi private static function lime_curl_easy_strerror (errornum:Int):String; - @:cffi private static function lime_curl_easy_unescape (curl:Float, url:String, inlength:Int, outlength:Int):String; + @:cffi private static function lime_curl_easy_strerror (errornum:Int):Dynamic; + @:cffi private static function lime_curl_easy_unescape (curl:Float, url:String, inlength:Int, outlength:Int):Dynamic; #end diff --git a/lime/system/Clipboard.hx b/lime/system/Clipboard.hx index d3419d7e8..2b619c82e 100644 --- a/lime/system/Clipboard.hx +++ b/lime/system/Clipboard.hx @@ -63,7 +63,7 @@ class Clipboard { #if (cpp || neko || nodejs) - @:cffi private static function lime_clipboard_get_text ():String; + @:cffi private static function lime_clipboard_get_text ():Dynamic; @:cffi private static function lime_clipboard_set_text (text:String):Void; #end diff --git a/lime/system/System.hx b/lime/system/System.hx index 41b46cf37..9063962ff 100644 --- a/lime/system/System.hx +++ b/lime/system/System.hx @@ -374,7 +374,7 @@ class System { #if (cpp || neko || nodejs) - @:cffi private static function lime_system_get_directory (type:Int, company:String, title:String):String; + @:cffi private static function lime_system_get_directory (type:Int, company:String, title:String):Dynamic; @:cffi private static function lime_system_get_display (index:Int):Dynamic; @:cffi private static function lime_system_get_num_displays ():Int; @:cffi private static function lime_system_get_timer ():Float; diff --git a/lime/ui/FileDialog.hx b/lime/ui/FileDialog.hx index 9814e40de..5d3d5e541 100644 --- a/lime/ui/FileDialog.hx +++ b/lime/ui/FileDialog.hx @@ -174,7 +174,7 @@ class FileDialog { }); - worker.onComplete.add (function (path) { + worker.onComplete.add (function (path:String) { if (path != null) { @@ -198,7 +198,7 @@ class FileDialog { // Doesn't work in a thread - var path = lime_file_dialog_open_file (filter, defaultPath); + var path:String = lime_file_dialog_open_file (filter, defaultPath); if (path != null) { @@ -241,7 +241,7 @@ class FileDialog { }); - worker.onComplete.add (function (path) { + worker.onComplete.add (function (path:String) { if (path != null) { @@ -263,7 +263,7 @@ class FileDialog { #else - var path = lime_file_dialog_save_file (filter, defaultPath); + var path:String = lime_file_dialog_save_file (filter, defaultPath); if (path != null) { @@ -301,9 +301,9 @@ class FileDialog { #if (cpp || neko || nodejs) - @:cffi private static function lime_file_dialog_open_file (filter:String, defaultPath:String):String; + @:cffi private static function lime_file_dialog_open_file (filter:String, defaultPath:String):Dynamic; @:cffi private static function lime_file_dialog_open_files (filter:String, defaultPath:String):Dynamic; - @:cffi private static function lime_file_dialog_save_file (filter:String, defaultPath:String):String; + @:cffi private static function lime_file_dialog_save_file (filter:String, defaultPath:String):Dynamic; #end diff --git a/lime/ui/Gamepad.hx b/lime/ui/Gamepad.hx index 924f5eb87..51089725f 100644 --- a/lime/ui/Gamepad.hx +++ b/lime/ui/Gamepad.hx @@ -79,8 +79,8 @@ class Gamepad { #if (cpp || neko || nodejs) @:cffi private static function lime_gamepad_add_mappings (mappings:Dynamic):Void; - @:cffi private static function lime_gamepad_get_device_guid (id:Int):String; - @:cffi private static function lime_gamepad_get_device_name (id:Int):String; + @:cffi private static function lime_gamepad_get_device_guid (id:Int):Dynamic; + @:cffi private static function lime_gamepad_get_device_name (id:Int):Dynamic; #end diff --git a/project/src/ExternalInterface.cpp b/project/src/ExternalInterface.cpp index 49f25ae8e..f6f2b5d99 100644 --- a/project/src/ExternalInterface.cpp +++ b/project/src/ExternalInterface.cpp @@ -167,15 +167,15 @@ namespace lime { } - HxString lime_clipboard_get_text () { + value lime_clipboard_get_text () { if (Clipboard::HasText ()) { - return HxString (Clipboard::GetText ()); + return alloc_string (Clipboard::GetText ()); } else { - return 0; + return alloc_null (); } @@ -189,11 +189,11 @@ namespace lime { } - HxString lime_file_dialog_open_file (HxString filter, HxString defaultPath) { + value lime_file_dialog_open_file (HxString filter, HxString defaultPath) { #ifdef LIME_NFD const char* path = FileDialog::OpenFile (filter.__s, defaultPath.__s); - return HxString (path); + return path ? alloc_string (path) : alloc_null (); #endif return 0; @@ -223,11 +223,11 @@ namespace lime { } - HxString lime_file_dialog_save_file (HxString filter, HxString defaultPath) { + value lime_file_dialog_save_file (HxString filter, HxString defaultPath) { #ifdef LIME_NFD const char* path = FileDialog::SaveFile (filter.__s, defaultPath.__s); - return HxString (path); + return path ? alloc_string (path) : alloc_null (); #endif return 0; @@ -486,16 +486,18 @@ namespace lime { } - HxString lime_gamepad_get_device_guid (int id) { + value lime_gamepad_get_device_guid (int id) { - return HxString (Gamepad::GetDeviceGUID (id)); + const char* guid = Gamepad::GetDeviceGUID (id); + return guid ? alloc_string (guid) : alloc_null (); } - HxString lime_gamepad_get_device_name (int id) { + value lime_gamepad_get_device_name (int id) { - return HxString (Gamepad::GetDeviceName (id)); + const char* name = Gamepad::GetDeviceName (id); + return name ? alloc_string (name) : alloc_null (); } @@ -926,10 +928,11 @@ namespace lime { } - HxString lime_renderer_get_type (double renderer) { + value lime_renderer_get_type (double renderer) { Renderer* targetRenderer = (Renderer*)(intptr_t)renderer; - return HxString (targetRenderer->Type ()); + const char* type = targetRenderer->Type (); + return type ? alloc_string (type) : alloc_null (); } @@ -955,9 +958,10 @@ namespace lime { } - HxString lime_system_get_directory (int type, HxString company, HxString title) { + value lime_system_get_directory (int type, HxString company, HxString title) { - return HxString (System::GetDirectory ((SystemDirectory)type, company.__s, title.__s)); + const char* path = System::GetDirectory ((SystemDirectory)type, company.__s, title.__s); + return path ? alloc_string (path) : alloc_null (); } @@ -1212,10 +1216,11 @@ namespace lime { } - HxString lime_window_set_title (double window, HxString title) { + value lime_window_set_title (double window, HxString title) { Window* targetWindow = (Window*)(intptr_t)window; - return HxString (targetWindow->SetTitle (title.__s)); + const char* result = targetWindow->SetTitle (title.__s); + return result ? alloc_string (result) : alloc_null (); } diff --git a/project/src/audio/openal/OpenALBindings.cpp b/project/src/audio/openal/OpenALBindings.cpp index 68990939b..f59419cde 100644 --- a/project/src/audio/openal/OpenALBindings.cpp +++ b/project/src/audio/openal/OpenALBindings.cpp @@ -613,9 +613,10 @@ namespace lime { } - HxString lime_al_get_string (int param) { + value lime_al_get_string (int param) { - return HxString (alGetString (param)); + const char* result = alGetString (param); + return result ? alloc_string (result) : alloc_null (); } @@ -949,10 +950,11 @@ namespace lime { } - HxString lime_alc_get_string (double device, int param) { + value lime_alc_get_string (double device, int param) { ALCdevice* alcDevice = (ALCdevice*)(intptr_t)device; - return HxString (alcGetString (alcDevice, param)); + const char* result = alcGetString (alcDevice, param); + return result ? alloc_string (result) : alloc_null (); } diff --git a/project/src/graphics/cairo/CairoBindings.cpp b/project/src/graphics/cairo/CairoBindings.cpp index 7a0159dc8..34dc27b9f 100644 --- a/project/src/graphics/cairo/CairoBindings.cpp +++ b/project/src/graphics/cairo/CairoBindings.cpp @@ -924,7 +924,8 @@ namespace lime { HxString lime_cairo_version_string () { - return HxString (cairo_version_string ()); + const char* version = cairo_version_string (); + return version ? HxString (version) : HxString (0, 0); } diff --git a/project/src/graphics/opengl/OpenGLBindings.cpp b/project/src/graphics/opengl/OpenGLBindings.cpp index 2a6a6103c..8454867c1 100644 --- a/project/src/graphics/opengl/OpenGLBindings.cpp +++ b/project/src/graphics/opengl/OpenGLBindings.cpp @@ -833,20 +833,20 @@ namespace lime { } - HxString lime_gl_get_shader_source (int id) { + value lime_gl_get_shader_source (int id) { int len = 0; glGetShaderiv (id, GL_SHADER_SOURCE_LENGTH, &len); if (len == 0) { - return 0; + return alloc_null (); } char *buf = new char[len + 1]; glGetShaderSource (id, len + 1, 0, buf); - HxString result = HxString (buf); + value result = alloc_string (buf); delete [] buf; diff --git a/project/src/net/curl/CURLBindings.cpp b/project/src/net/curl/CURLBindings.cpp index dbe8b5dc8..e5aa699d1 100644 --- a/project/src/net/curl/CURLBindings.cpp +++ b/project/src/net/curl/CURLBindings.cpp @@ -20,10 +20,10 @@ namespace lime { } - HxString lime_curl_easy_escape (double curl, HxString url, int length) { + value lime_curl_easy_escape (double curl, HxString url, int length) { char* result = curl_easy_escape ((CURL*)(intptr_t)curl, url.__s, length); - return HxString (result); + return result ? alloc_string (result) : alloc_null (); } @@ -500,18 +500,18 @@ namespace lime { } - HxString lime_curl_easy_strerror (int errornum) { + value lime_curl_easy_strerror (int errornum) { const char* result = curl_easy_strerror ((CURLcode)errornum); - return HxString (result); + return result ? alloc_string (result) : alloc_null (); } - HxString lime_curl_easy_unescape (double curl, HxString url, int inlength, int outlength) { + value lime_curl_easy_unescape (double curl, HxString url, int inlength, int outlength) { char* result = curl_easy_unescape ((CURL*)(intptr_t)curl, url.__s, inlength, &outlength); - return HxString (result); + return result ? alloc_string (result) : alloc_null (); } @@ -566,10 +566,10 @@ namespace lime { //lime_curl_slist_free_all - HxString lime_curl_version () { + value lime_curl_version () { char* result = curl_version (); - return HxString (result); + return result ? alloc_string (result) : alloc_null (); }