Null string fix
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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 ();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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 ();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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 ();
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user