From b3bf305fc42224a7edcc53c2df2d76ec6dfd607b Mon Sep 17 00:00:00 2001 From: Sirox <71220271+Sirox228@users.noreply.github.com> Date: Tue, 1 Nov 2022 10:43:51 +0300 Subject: [PATCH 01/33] Update JNI.hx --- src/lime/system/JNI.hx | 45 +++--------------------------------------- 1 file changed, 3 insertions(+), 42 deletions(-) diff --git a/src/lime/system/JNI.hx b/src/lime/system/JNI.hx index fea483491..a295f33c5 100644 --- a/src/lime/system/JNI.hx +++ b/src/lime/system/JNI.hx @@ -48,52 +48,13 @@ class JNI public static function callMember(method:Dynamic, jobject:Dynamic, a:Array):Dynamic { - switch (a.length) - { - case 0: - return method(jobject); - case 1: - return method(jobject, a[0]); - case 2: - return method(jobject, a[0], a[1]); - case 3: - return method(jobject, a[0], a[1], a[2]); - case 4: - return method(jobject, a[0], a[1], a[2], a[3]); - case 5: - return method(jobject, a[0], a[1], a[2], a[3], a[4]); - case 6: - return method(jobject, a[0], a[1], a[2], a[3], a[4], a[5]); - case 7: - return method(jobject, a[0], a[1], a[2], a[3], a[4], a[5], a[6]); - default: - return null; - } + a.insert(0, jobject); + return Reflect.callMethod(null, method, a); } public static function callStatic(method:Dynamic, a:Array):Dynamic { - switch (a.length) - { - case 0: - return method(); - case 1: - return method(a[0]); - case 2: - return method(a[0], a[1]); - case 3: - return method(a[0], a[1], a[2]); - case 4: - return method(a[0], a[1], a[2], a[3]); - case 5: - return method(a[0], a[1], a[2], a[3], a[4]); - case 6: - return method(a[0], a[1], a[2], a[3], a[4], a[5]); - case 7: - return method(a[0], a[1], a[2], a[3], a[4], a[5], a[6]); - default: - return null; - } + return Reflect.callMethod(null, method, a); } public static function createMemberField(className:String, memberName:String, signature:String):JNIMemberField From d8237ff50b98839b3136f97e128127dbc7e7a785 Mon Sep 17 00:00:00 2001 From: Mihai Alexandru <77043862+MAJigsaw77@users.noreply.github.com> Date: Fri, 25 Nov 2022 21:53:49 +0200 Subject: [PATCH 02/33] Update GameActivity.java --- .../app/src/main/java/org/haxe/lime/GameActivity.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/templates/android/template/app/src/main/java/org/haxe/lime/GameActivity.java b/templates/android/template/app/src/main/java/org/haxe/lime/GameActivity.java index b82938858..a08d15837 100644 --- a/templates/android/template/app/src/main/java/org/haxe/lime/GameActivity.java +++ b/templates/android/template/app/src/main/java/org/haxe/lime/GameActivity.java @@ -38,7 +38,11 @@ public class GameActivity extends SDLActivity { if (metrics == null) { metrics = new DisplayMetrics (); - Extension.mainActivity.getWindowManager ().getDefaultDisplay ().getMetrics (metrics); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { + Extension.mainActivity.getWindowManager ().getDefaultDisplay ().getRealMetrics (metrics); + } else { + Extension.mainActivity.getWindowManager ().getDefaultDisplay ().getMetrics (metrics); + } } From b5d6db38a7b2443cfcdd3e50d265509e55736f70 Mon Sep 17 00:00:00 2001 From: Mihai Alexandru <77043862+MAJigsaw77@users.noreply.github.com> Date: Sun, 27 Nov 2022 08:19:34 +0200 Subject: [PATCH 03/33] Update GameActivity.java --- .../app/src/main/java/org/haxe/lime/GameActivity.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/templates/android/template/app/src/main/java/org/haxe/lime/GameActivity.java b/templates/android/template/app/src/main/java/org/haxe/lime/GameActivity.java index a08d15837..144ac9a21 100644 --- a/templates/android/template/app/src/main/java/org/haxe/lime/GameActivity.java +++ b/templates/android/template/app/src/main/java/org/haxe/lime/GameActivity.java @@ -38,11 +38,7 @@ public class GameActivity extends SDLActivity { if (metrics == null) { metrics = new DisplayMetrics (); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { - Extension.mainActivity.getWindowManager ().getDefaultDisplay ().getRealMetrics (metrics); - } else { - Extension.mainActivity.getWindowManager ().getDefaultDisplay ().getMetrics (metrics); - } + Extension.mainActivity.getWindowManager ().getDefaultDisplay ().getRealMetrics (metrics); } From 505d90b6ae39b1377af8225472b9d6f8ea46e737 Mon Sep 17 00:00:00 2001 From: player-03 Date: Tue, 20 Dec 2022 14:10:14 -0500 Subject: [PATCH 04/33] Don't modify the argument array. Just on the off chance that the user reuses it. --- src/lime/system/JNI.hx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/lime/system/JNI.hx b/src/lime/system/JNI.hx index a295f33c5..237171ce5 100644 --- a/src/lime/system/JNI.hx +++ b/src/lime/system/JNI.hx @@ -48,8 +48,7 @@ class JNI public static function callMember(method:Dynamic, jobject:Dynamic, a:Array):Dynamic { - a.insert(0, jobject); - return Reflect.callMethod(null, method, a); + return Reflect.callMethod(null, method, [jobject].concat(a)); } public static function callStatic(method:Dynamic, a:Array):Dynamic From 61dd0629bee96064217f64dbf8ba1620ebb755c6 Mon Sep 17 00:00:00 2001 From: player-03 Date: Tue, 20 Dec 2022 14:29:37 -0500 Subject: [PATCH 05/33] Use `getDisplayMetrics()`. `getRealMetrics()` is now deprecated as well. It suggests using `getCurrentWindowMetrics()` instead, but that's new in SDK 30 and doesn't even contain DPI information. Whereas this function has been around since the start. --- .../template/app/src/main/java/org/haxe/lime/GameActivity.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/templates/android/template/app/src/main/java/org/haxe/lime/GameActivity.java b/templates/android/template/app/src/main/java/org/haxe/lime/GameActivity.java index 144ac9a21..e0c37f44c 100644 --- a/templates/android/template/app/src/main/java/org/haxe/lime/GameActivity.java +++ b/templates/android/template/app/src/main/java/org/haxe/lime/GameActivity.java @@ -37,8 +37,7 @@ public class GameActivity extends SDLActivity { if (metrics == null) { - metrics = new DisplayMetrics (); - Extension.mainActivity.getWindowManager ().getDefaultDisplay ().getRealMetrics (metrics); + metrics = Extension.mainContext.getResources ().getDisplayMetrics (); } From db0a8e95fa81975e879691f1ea0a3a5cabcb6625 Mon Sep 17 00:00:00 2001 From: Dimitri Pomier Date: Mon, 6 Feb 2023 13:27:13 +0100 Subject: [PATCH 06/33] Allow Assets.registerLibrary() for default library --- src/lime/utils/Assets.hx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/lime/utils/Assets.hx b/src/lime/utils/Assets.hx index 58477916f..dc64da5b6 100644 --- a/src/lime/utils/Assets.hx +++ b/src/lime/utils/Assets.hx @@ -492,6 +492,11 @@ class Assets public static function registerLibrary(name:String, library:AssetLibrary):Void { + if (name == null || name == "") + { + name = "default"; + } + if (libraries.exists(name)) { if (libraries.get(name) == library) From 3b5588267b1f584849c6fed12690628b6d265576 Mon Sep 17 00:00:00 2001 From: Chris Speciale Date: Tue, 7 Mar 2023 12:03:27 -0500 Subject: [PATCH 07/33] tools.hxml: Remove -D no-inline The no-inline macro was added previously to fix a compatibility issue with an older version of Haxe. It remains to be seen whether or not it is necessary as it seems to create conflicts with intermittent versions of Haxe. For this purpose we will remove it, unless it is deemed necessary again in the future. See: https://github.com/openfl/lime/discussions/1645 for more info. --- tools/tools.hxml | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/tools.hxml b/tools/tools.hxml index 01977752a..4c410494c 100644 --- a/tools/tools.hxml +++ b/tools/tools.hxml @@ -9,4 +9,3 @@ -lib hxp #-lib svg -D optional-cffi --D no-inline \ No newline at end of file From aefce3c4ae34c15f9711f9b248ec308f86dfca39 Mon Sep 17 00:00:00 2001 From: jf <22012032+jobf@users.noreply.github.com> Date: Fri, 17 Mar 2023 18:14:42 +0000 Subject: [PATCH 08/33] change hl_al_filteri argument type --- project/src/media/openal/OpenALBindings.cpp | 2 +- src/lime/_internal/backend/native/NativeCFFI.hx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/project/src/media/openal/OpenALBindings.cpp b/project/src/media/openal/OpenALBindings.cpp index 836de928b..cd67d72cc 100644 --- a/project/src/media/openal/OpenALBindings.cpp +++ b/project/src/media/openal/OpenALBindings.cpp @@ -3659,7 +3659,7 @@ namespace lime { DEFINE_HL_PRIM (_VOID, hl_al_effecti, _TCFFIPOINTER _I32 _I32); DEFINE_HL_PRIM (_VOID, hl_al_effectiv, _TCFFIPOINTER _I32 _ARR); DEFINE_HL_PRIM (_VOID, hl_al_enable, _I32); - DEFINE_HL_PRIM (_VOID, hl_al_filteri, _TCFFIPOINTER _I32 _DYN); + DEFINE_HL_PRIM (_VOID, hl_al_filteri, _TCFFIPOINTER _I32 _I32); DEFINE_HL_PRIM (_VOID, hl_al_filterf, _TCFFIPOINTER _I32 _F32); DEFINE_HL_PRIM (_TCFFIPOINTER, hl_al_gen_aux, _NO_ARG); DEFINE_HL_PRIM (_TCFFIPOINTER, hl_al_gen_buffer, _NO_ARG); diff --git a/src/lime/_internal/backend/native/NativeCFFI.hx b/src/lime/_internal/backend/native/NativeCFFI.hx index a3da6319b..7a03bee57 100644 --- a/src/lime/_internal/backend/native/NativeCFFI.hx +++ b/src/lime/_internal/backend/native/NativeCFFI.hx @@ -2271,7 +2271,7 @@ class NativeCFFI return null; } - @:hlNative("lime", "hl_al_filteri") private static function lime_al_filteri(filter:CFFIPointer, param:Int, value:Dynamic):Void {} + @:hlNative("lime", "hl_al_filteri") private static function lime_al_filteri(filter:CFFIPointer, param:Int, value:Int):Void {} @:hlNative("lime", "hl_al_filterf") private static function lime_al_filterf(filter:CFFIPointer, param:Int, value:hl.F32):Void {} From 95411acb8c6edcecbd80e756b692dff0f55c4571 Mon Sep 17 00:00:00 2001 From: Josh Tynjala Date: Tue, 28 Mar 2023 12:06:41 -0700 Subject: [PATCH 09/33] ExternalInterface: fix conversion of std::wstring to std:string on non-Windows systems for file dialog functions (closes #1622) --- project/src/ExternalInterface.cpp | 89 +++++++++++++++++++++---------- 1 file changed, 61 insertions(+), 28 deletions(-) diff --git a/project/src/ExternalInterface.cpp b/project/src/ExternalInterface.cpp index 08195e7eb..bf746d0fa 100644 --- a/project/src/ExternalInterface.cpp +++ b/project/src/ExternalInterface.cpp @@ -175,6 +175,54 @@ namespace lime { } + value wstring_to_value (std::wstring* val) { + + if (val) { + + #ifdef HX_WINDOWS + return alloc_wstring (val->c_str ()); + #else + std::string _val = std::string (val->begin (), val->end ()); + return alloc_string (_val.c_str ()); + #endif + + } else { + + return 0; + + } + + } + + + vbyte* wstring_to_vbytes (std::wstring* val) { + + if (val) { + + #ifdef HX_WINDOWS + int size = std::wcslen (val->c_str ()); + char* result = (char*)malloc (size + 1); + std::wcstombs (result, val->c_str (), size); + result[size] = '\0'; + return (vbyte*)result; + #else + std::string _val = std::string (val->begin (), val->end ()); + int size = std::strlen (_val.c_str ()); + char* result = (char*)malloc (size + 1); + std::strncpy (result, _val.c_str (), size); + result[size] = '\0'; + return (vbyte*)result; + #endif + + } else { + + return 0; + + } + + } + + value lime_application_create () { Application* application = CreateApplication (); @@ -687,7 +735,7 @@ namespace lime { if (path) { - value _path = alloc_wstring (path->c_str ()); + value _path = wstring_to_value (path); delete path; return _path; @@ -720,13 +768,9 @@ namespace lime { if (path) { - int size = std::wcslen (path->c_str ()); - char* result = (char*)malloc (size + 1); - std::wcstombs (result, path->c_str (), size); - result[size] = '\0'; + vbyte* _path = wstring_to_vbytes (path); delete path; - - return (vbyte*)result; + return _path; } else { @@ -757,7 +801,7 @@ namespace lime { if (path) { - value _path = alloc_wstring (path->c_str ()); + value _path = wstring_to_value (path); delete path; return _path; @@ -790,13 +834,9 @@ namespace lime { if (path) { - int size = std::wcslen (path->c_str ()); - char* result = (char*)malloc (size + 1); - std::wcstombs (result, path->c_str (), size); - result[size] = '\0'; + vbyte* _path = wstring_to_vbytes (path); delete path; - - return (vbyte*)result; + return _path; } else { @@ -830,7 +870,8 @@ namespace lime { for (int i = 0; i < files.size (); i++) { - val_array_set_i (result, i, alloc_wstring (files[i]->c_str ())); + value _file = wstring_to_value (files[i]); + val_array_set_i (result, i, _file); delete files[i]; } @@ -864,12 +905,8 @@ namespace lime { for (int i = 0; i < files.size (); i++) { - int size = std::wcslen (files[i]->c_str ()); - char* _file = (char*)malloc (size + 1); - std::wcstombs (_file, files[i]->c_str (), size); - _file[size] = '\0'; - - *resultData++ = (vbyte*)_file; + vbyte* _file = wstring_to_vbytes (files[i]); + *resultData++ = _file; delete files[i]; } @@ -899,7 +936,7 @@ namespace lime { if (path) { - value _path = alloc_wstring (path->c_str ()); + value _path = wstring_to_value (path); delete path; return _path; @@ -932,13 +969,9 @@ namespace lime { if (path) { - int size = std::wcslen (path->c_str ()); - char* result = (char*)malloc (size + 1); - std::wcstombs (result, path->c_str (), size); - result[size] = '\0'; + vbyte* _path = wstring_to_vbytes (path); delete path; - - return (vbyte*)result; + return _path; } else { From a68e9c4b8e714e208c715bfd452924deb6821291 Mon Sep 17 00:00:00 2001 From: Josh Tynjala Date: Tue, 28 Mar 2023 13:00:20 -0700 Subject: [PATCH 10/33] ExternalInterface: fix error from missing header on Linux in commit 95411acb8c6edcecbd80e756b692dff0f55c4571 --- project/src/ExternalInterface.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/project/src/ExternalInterface.cpp b/project/src/ExternalInterface.cpp index bf746d0fa..989d1e798 100644 --- a/project/src/ExternalInterface.cpp +++ b/project/src/ExternalInterface.cpp @@ -54,6 +54,7 @@ #endif #include +#include DEFINE_KIND (k_finalizer); From 77f3d4bacf87afed54cb98a68ad311bfe80c00b5 Mon Sep 17 00:00:00 2001 From: player-03 Date: Sat, 1 Apr 2023 11:20:05 -0400 Subject: [PATCH 11/33] Improve "Could not find NekoAPI interface" message. This message comes up relatively often when a new user tries to set up Lime, but fails to give any instructions a new user could use. This commit adds a new message explaining the most common issue and how to solve it. It also provides file paths, which may help with more in-depth debugging. --- src/lime/system/CFFI.hx | 45 +++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/src/lime/system/CFFI.hx b/src/lime/system/CFFI.hx index 4f36f0306..c6e7be02a 100644 --- a/src/lime/system/CFFI.hx +++ b/src/lime/system/CFFI.hx @@ -280,34 +280,35 @@ class CFFI { if (!__loadedNekoAPI) { + var init:Dynamic; try { - var init = load("lime", "neko_init", 5); - - if (init != null) - { - __loaderTrace("Found nekoapi @ " + __moduleNames.get("lime")); - init(function(s) return new String(s), function(len:Int) - { - var r = []; - if (len > 0) r[len - 1] = null; - return r; - }, null, true, false); - } - else if (!lazy) - { - throw("Could not find NekoAPI interface."); - } + init = load("lime", "neko_init", 5); } - catch (e:Dynamic) + catch (e) { - if (!lazy) - { - throw("Could not find NekoAPI interface."); - } } - __loadedNekoAPI = true; + if (init != null) + { + __loaderTrace("Found nekoapi @ " + __moduleNames.get("lime")); + init(function(s) return new String(s), function(len:Int) + { + var r = []; + if (len > 0) r[len - 1] = null; + return r; + }, null, true, false); + + __loadedNekoAPI = true; + } + else if (!lazy) + { + var ndllFolder = __findHaxelib("lime") + "/ndll/" + __sysName(); + throw "Could not find lime.ndll. This file is provided with Lime's Haxelib releases, but not via Git. " + + "Please copy it from Lime's latest Haxelib release into either " + + ndllFolder + " or " + ndllFolder + "64, as appropriate for your system. " + + "Advanced users may run `lime rebuild cpp` instead."; + } } } #end From 776db44e37bc909299d896865f1c46e80b2e9681 Mon Sep 17 00:00:00 2001 From: player-03 Date: Sat, 1 Apr 2023 11:29:35 -0400 Subject: [PATCH 12/33] Add missing type declaration. Nowadays you're supposed to omit this type declaration, but what I didn't realize is that that feature was added in Haxe 4.1. Since Lime still needs to support earlier versions, we'll just have to do it the old way. --- src/lime/system/CFFI.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lime/system/CFFI.hx b/src/lime/system/CFFI.hx index c6e7be02a..cf0dbb035 100644 --- a/src/lime/system/CFFI.hx +++ b/src/lime/system/CFFI.hx @@ -285,7 +285,7 @@ class CFFI { init = load("lime", "neko_init", 5); } - catch (e) + catch (e:Dynamic) { } From 2026f404ff8ff9a9aaccd39a1540af403f736e03 Mon Sep 17 00:00:00 2001 From: player-03 Date: Sat, 1 Apr 2023 11:33:20 -0400 Subject: [PATCH 13/33] Initialize variable. --- src/lime/system/CFFI.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lime/system/CFFI.hx b/src/lime/system/CFFI.hx index cf0dbb035..ff230b75c 100644 --- a/src/lime/system/CFFI.hx +++ b/src/lime/system/CFFI.hx @@ -280,7 +280,7 @@ class CFFI { if (!__loadedNekoAPI) { - var init:Dynamic; + var init:Dynamic = null; try { init = load("lime", "neko_init", 5); From 4d3ae39d5013e24f78fb2c4b073d71bc318c594b Mon Sep 17 00:00:00 2001 From: player-03 Date: Sat, 1 Apr 2023 11:56:41 -0400 Subject: [PATCH 14/33] Use forward slashes to load lime.ndll. `substr(7)` returns the substring _starting_ at character 7, which will never be "windows". The author meant to type `substr(0, 7)` instead, to get the substring ending at 7. We could easily make this change, but given that the code has been successfully using forward slashes for several years, I prefer to simplify. --- src/lime/system/CFFI.hx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/lime/system/CFFI.hx b/src/lime/system/CFFI.hx index 4f36f0306..3aa9eba9f 100644 --- a/src/lime/system/CFFI.hx +++ b/src/lime/system/CFFI.hx @@ -149,16 +149,15 @@ class CFFI if (result == null) { - var slash = (__sysName().substr(7).toLowerCase() == "windows") ? "\\" : "/"; var haxelib = __findHaxelib("lime"); if (haxelib != "") { - result = __tryLoad(haxelib + slash + "ndll" + slash + __sysName() + slash + library, library, method, args); + result = __tryLoad(haxelib + "/ndll/" + __sysName() + "/" + library, library, method, args); if (result == null) { - result = __tryLoad(haxelib + slash + "ndll" + slash + __sysName() + "64" + slash + library, library, method, args); + result = __tryLoad(haxelib + "/ndll/" + __sysName() + "64/" + library, library, method, args); } } } From 0f694662f95c511138861989759e97a0c6b5415c Mon Sep 17 00:00:00 2001 From: Josh Tynjala Date: Tue, 4 Apr 2023 09:00:28 -0700 Subject: [PATCH 15/33] HTML5HTTPRequst: status 400 should be considered an error --- src/lime/_internal/backend/html5/HTML5HTTPRequest.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lime/_internal/backend/html5/HTML5HTTPRequest.hx b/src/lime/_internal/backend/html5/HTML5HTTPRequest.hx index e05967b29..cbbe9bbf2 100644 --- a/src/lime/_internal/backend/html5/HTML5HTTPRequest.hx +++ b/src/lime/_internal/backend/html5/HTML5HTTPRequest.hx @@ -534,7 +534,7 @@ class HTML5HTTPRequest { if (request.readyState != 4) return; - if (request.status != null && ((request.status >= 200 && request.status <= 400) || (validStatus0 && request.status == 0))) + if (request.status != null && ((request.status >= 200 && request.status < 400) || (validStatus0 && request.status == 0))) { processResponse(); promise.complete(request.responseText); From adda161ec6811c5c4f18ffe99c3c1f20a77816e1 Mon Sep 17 00:00:00 2001 From: player-03 Date: Wed, 5 Apr 2023 16:36:36 -0400 Subject: [PATCH 16/33] Use "password" text input only on Android. Using `userAgent` to tell whether the app is running on Android. This isn't foolproof, but will work more often than the previous approach (where you chose at compile time and your choice applied to all devices). Resolves #1655. --- src/lime/_internal/backend/html5/HTML5Window.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lime/_internal/backend/html5/HTML5Window.hx b/src/lime/_internal/backend/html5/HTML5Window.hx index 55ddbc061..ca481b681 100644 --- a/src/lime/_internal/backend/html5/HTML5Window.hx +++ b/src/lime/_internal/backend/html5/HTML5Window.hx @@ -1119,7 +1119,7 @@ class HTML5Window textInput.type = 'text'; #else // use password instead of text to avoid IME issues on Android - textInput.type = 'password'; + textInput.type = Browser.navigator.userAgent.indexOf("Android") >= 0 ? 'password' : 'text'; #end textInput.style.position = 'absolute'; textInput.style.opacity = "0"; From dc1a11bdace5217ff9f0389e56e962f3c551a033 Mon Sep 17 00:00:00 2001 From: player-03 Date: Mon, 10 Apr 2023 17:26:00 -0400 Subject: [PATCH 17/33] Use version 2 of actions/setup-java GitHub is deprecating Node 12, forcing us to update any actions that rely on it. https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/ actions/setup-java@v2 now requires us to specify a distribution. v1 used Zulu, so we'll just stick with that for now. --- .github/workflows/main.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cb194f38b..b39889d97 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -217,8 +217,9 @@ jobs: with: ndk-version: r15c - - uses: actions/setup-java@v1 + - uses: actions/setup-java@v2 with: + distribution: "zulu" java-version: 8 - uses: krdlab/setup-haxe@v1 @@ -462,8 +463,9 @@ jobs: with: ndk-version: r15c - - uses: actions/setup-java@v1 + - uses: actions/setup-java@v2 with: + distribution: "zulu" java-version: 8 - uses: krdlab/setup-haxe@v1 From 1e6d883baf567f06599af952ebf215b27cf6398e Mon Sep 17 00:00:00 2001 From: Josh Tynjala Date: Mon, 10 Apr 2023 14:58:24 -0700 Subject: [PATCH 18/33] IOSPlatform: when building liblime.iphonesim.a, explicitly add -DHXCPP_M32 It looks like the new hxcpp update defaults to 64-bit now, so we need to be explicit --- tools/platforms/IOSPlatform.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/platforms/IOSPlatform.hx b/tools/platforms/IOSPlatform.hx index 065e4d48d..04fd2277e 100644 --- a/tools/platforms/IOSPlatform.hx +++ b/tools/platforms/IOSPlatform.hx @@ -491,7 +491,7 @@ class IOSPlatform extends PlatformTarget if (armv7) commands.push(["-Dios", "-DHXCPP_CPP11", "-DHXCPP_ARMV7"]); if (armv7s) commands.push(["-Dios", "-DHXCPP_CPP11", "-DHXCPP_ARMV7S"]); if (arm64) commands.push(["-Dios", "-DHXCPP_CPP11", "-DHXCPP_ARM64"]); - if (i386) commands.push(["-Dios", "-Dsimulator", "-DHXCPP_CPP11"]); + if (i386) commands.push(["-Dios", "-Dsimulator", "-DHXCPP_M32", "-DHXCPP_CPP11"]); if (x86_64) commands.push(["-Dios", "-Dsimulator", "-DHXCPP_M64", "-DHXCPP_CPP11"]); if (arc) From 72db2427205b682bfb11f9fe982ec8ef72d0d290 Mon Sep 17 00:00:00 2001 From: Josh Tynjala Date: Mon, 10 Apr 2023 15:03:45 -0700 Subject: [PATCH 19/33] IOSPlatform: be explicit about armv6, just in case the default architecture used by hxcpp changes in the future The default changed recently for the x86 simulator, so best to be safe --- tools/platforms/IOSPlatform.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/platforms/IOSPlatform.hx b/tools/platforms/IOSPlatform.hx index 04fd2277e..6412e1c74 100644 --- a/tools/platforms/IOSPlatform.hx +++ b/tools/platforms/IOSPlatform.hx @@ -487,7 +487,7 @@ class IOSPlatform extends PlatformTarget var commands = []; - if (armv6) commands.push(["-Dios", "-DHXCPP_CPP11"]); + if (armv6) commands.push(["-Dios", "-DHXCPP_CPP11", "-DHXCPP_ARMV6"]); if (armv7) commands.push(["-Dios", "-DHXCPP_CPP11", "-DHXCPP_ARMV7"]); if (armv7s) commands.push(["-Dios", "-DHXCPP_CPP11", "-DHXCPP_ARMV7S"]); if (arm64) commands.push(["-Dios", "-DHXCPP_CPP11", "-DHXCPP_ARM64"]); From f34b595e70785758d3517030466a954af17027bb Mon Sep 17 00:00:00 2001 From: Josh Tynjala Date: Mon, 10 Apr 2023 15:20:50 -0700 Subject: [PATCH 20/33] IOSPlatform: remove armv7 from default iOS architectures because latest Xcode reports error Fixes error: The armv7 architecture is deprecated. You should update your ARCHS build setting to remove the armv7 architecture. (in target 'Build Haxe' from project 'MyProject') --- tools/platforms/IOSPlatform.hx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/platforms/IOSPlatform.hx b/tools/platforms/IOSPlatform.hx index 6412e1c74..8a8736a4f 100644 --- a/tools/platforms/IOSPlatform.hx +++ b/tools/platforms/IOSPlatform.hx @@ -91,7 +91,7 @@ class IOSPlatform extends PlatformTarget title: "" }; - defaults.architectures = [Architecture.ARMV7, Architecture.ARM64]; + defaults.architectures = [Architecture.ARM64]; defaults.window.width = 0; defaults.window.height = 0; defaults.window.fullscreen = true; @@ -250,7 +250,7 @@ class IOSPlatform extends PlatformTarget if (architectures == null || architectures.length == 0) { - architectures = [Architecture.ARMV7, Architecture.ARM64]; + architectures = [Architecture.ARM64]; } if (project.config.getString("ios.device", "universal") == "universal" || project.config.getString("ios.device") == "iphone") From 8825d27cb2f108757bd02751d8514922b567b6de Mon Sep 17 00:00:00 2001 From: player-03 Date: Mon, 10 Apr 2023 19:06:56 -0400 Subject: [PATCH 21/33] Use version 3 of actions/setup-java. Version 2 wasn't even the latest version, and still used Node 12. --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b39889d97..f871238e6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -217,7 +217,7 @@ jobs: with: ndk-version: r15c - - uses: actions/setup-java@v2 + - uses: actions/setup-java@v3 with: distribution: "zulu" java-version: 8 @@ -463,7 +463,7 @@ jobs: with: ndk-version: r15c - - uses: actions/setup-java@v2 + - uses: actions/setup-java@v3 with: distribution: "zulu" java-version: 8 From e753c5c9334f9a49cc6ab6505b7ee1397c6fbe72 Mon Sep 17 00:00:00 2001 From: Josh Tynjala Date: Tue, 11 Apr 2023 15:21:52 -0700 Subject: [PATCH 22/33] AIRHelper: fix failed Adobe AIR for iOS build on Windows It was incorrectly trying to list simulators from Xcode (and Xcode, obviously, doesn't exist on Windows) --- src/lime/tools/AIRHelper.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lime/tools/AIRHelper.hx b/src/lime/tools/AIRHelper.hx index 08c009060..4a0d66c57 100644 --- a/src/lime/tools/AIRHelper.hx +++ b/src/lime/tools/AIRHelper.hx @@ -204,7 +204,7 @@ class AIRHelper Sys.putEnv("AIR_NOANDROIDFLAIR", "true"); } - if (targetPlatform == IOS) + if (targetPlatform == IOS && System.hostPlatform == MAC) { Sys.putEnv("AIR_IOS_SIMULATOR_DEVICE", XCodeHelper.getSimulatorName(project)); } From 2e19898c288b29dcd7c33774ab546eb695a7a38a Mon Sep 17 00:00:00 2001 From: Josh Tynjala Date: Tue, 11 Apr 2023 15:50:53 -0700 Subject: [PATCH 23/33] XCodeHelper: fix null exception when trying to get the ID or name of the selected iOS simulator Ideally, it shouldn't return null, but if it does, fail gracefully --- src/lime/tools/XCodeHelper.hx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/lime/tools/XCodeHelper.hx b/src/lime/tools/XCodeHelper.hx index 5368f8499..11c0b236c 100644 --- a/src/lime/tools/XCodeHelper.hx +++ b/src/lime/tools/XCodeHelper.hx @@ -101,12 +101,22 @@ class XCodeHelper public static function getSimulatorID(project:HXProject):String { - return getSelectedSimulator(project).id; + var simulator = getSelectedSimulator(project); + if (simulator == null) + { + return null; + } + return simulator.id; } public static function getSimulatorName(project:HXProject):String { - return getSelectedSimulator(project).name; + var simulator = getSelectedSimulator(project); + if (simulator == null) + { + return null; + } + return simulator.name; } private static function getSimulators():String From 04b69a9cef0bfdc333cc8371a8efa507d0f33487 Mon Sep 17 00:00:00 2001 From: Josh Tynjala Date: Tue, 11 Apr 2023 15:51:56 -0700 Subject: [PATCH 24/33] AIRHelper: display a warning when no selected iOS simulator is found when building AIR for iOS app Ideally, we'd always get a simulator name, but better to fail gracefully --- src/lime/tools/AIRHelper.hx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/lime/tools/AIRHelper.hx b/src/lime/tools/AIRHelper.hx index 4a0d66c57..76dc40c74 100644 --- a/src/lime/tools/AIRHelper.hx +++ b/src/lime/tools/AIRHelper.hx @@ -206,7 +206,15 @@ class AIRHelper if (targetPlatform == IOS && System.hostPlatform == MAC) { - Sys.putEnv("AIR_IOS_SIMULATOR_DEVICE", XCodeHelper.getSimulatorName(project)); + var simulatorName = XCodeHelper.getSimulatorName(project); + if (simulatorName == null) + { + Log.warn("Skipping AIR_IOS_SIMULATOR_DEVICE environment variable because default simulator not found"); + } + else + { + Sys.putEnv("AIR_IOS_SIMULATOR_DEVICE", simulatorName); + } } System.runCommand(workingDirectory, project.defines.get("AIR_SDK") + "/bin/adt", args); From 1ac0810895c9adb881109fab1447d10d2689242d Mon Sep 17 00:00:00 2001 From: Josh Tynjala Date: Tue, 11 Apr 2023 16:02:14 -0700 Subject: [PATCH 25/33] XcodeHelper: search for default iPhone simulator device id with a regular expression instead of a specific string Previously, the value was "iphone-11". Now the regex is ~/iphone-\d+/g As long as the naming scheme stays the same, this should choose the newest iPhone supported by Xcode, and we won't need to update manually anymore, like in commit 72dd60f1c851afac9f9166b963bc76e2ece15097 --- src/lime/tools/XCodeHelper.hx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/lime/tools/XCodeHelper.hx b/src/lime/tools/XCodeHelper.hx index 11c0b236c..1565d516a 100644 --- a/src/lime/tools/XCodeHelper.hx +++ b/src/lime/tools/XCodeHelper.hx @@ -6,7 +6,7 @@ import lime.tools.HXProject; class XCodeHelper { private static inline var DEFAULT_IPAD_SIMULATOR = "ipad-air"; - private static inline var DEFAULT_IPHONE_SIMULATOR = "iphone-11"; + private static var DEFAULT_IPHONE_SIMULATOR_REGEX = ~/iphone-\d+/g; private static function extractSimulatorFlagName(line:String):String { @@ -92,7 +92,14 @@ class XCodeHelper } else { - currentDevice = devices.get(DEFAULT_IPHONE_SIMULATOR); + for (device in devices.keys()) + { + if (DEFAULT_IPHONE_SIMULATOR_REGEX.match(device)) + { + currentDevice = devices.get(device); + break; + } + } } } From f8ec10b969d82946664a8fe6b719a8b776b574a7 Mon Sep 17 00:00:00 2001 From: Josh Tynjala Date: Thu, 13 Apr 2023 15:42:05 -0700 Subject: [PATCH 26/33] AIRHelper: allow listen=port in to use USB debugging instead of wifi debugging for Adobe AIR apps on Android or iOS --- src/lime/tools/AIRHelper.hx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/lime/tools/AIRHelper.hx b/src/lime/tools/AIRHelper.hx index 76dc40c74..039ea0de6 100644 --- a/src/lime/tools/AIRHelper.hx +++ b/src/lime/tools/AIRHelper.hx @@ -149,12 +149,20 @@ class AIRHelper if (project.debug) { - args.push("-connect"); - if (project.config.exists("air.connect")) { + args.push("-connect"); args.push(project.config.getString("air.connect")); } + else if (project.config.exists("air.listen")) + { + args.push("-listen"); + args.push(project.config.getString("air.listen")); + } + else + { + args.push("-connect"); + } } args = args.concat(signingOptions); From fb5d64dc79f076a1d9e325c2e42130c87fe0ab50 Mon Sep 17 00:00:00 2001 From: andresa88 Date: Mon, 17 Apr 2023 10:06:24 -0700 Subject: [PATCH 27/33] Fixed an HTML Image issue when using the genes library to compile ES modules. Need to explicitly use: new window.Image() --- src/lime/_internal/backend/html5/HTML5HTTPRequest.hx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/lime/_internal/backend/html5/HTML5HTTPRequest.hx b/src/lime/_internal/backend/html5/HTML5HTTPRequest.hx index cbbe9bbf2..94c3f2b59 100644 --- a/src/lime/_internal/backend/html5/HTML5HTTPRequest.hx +++ b/src/lime/_internal/backend/html5/HTML5HTTPRequest.hx @@ -444,7 +444,11 @@ class HTML5HTTPRequest private static function __loadImage(uri:String, promise:Promise, options:Int):Void { + #if (openfljs || genes) + var image:JSImage = untyped #if haxe4 js.Syntax.code #else __js__ #end ('new window.Image ()'); + #else var image = new JSImage(); + #end if (!__isSameOrigin(uri)) { From e14d3e24d65a38ba073a4413a934371908c46381 Mon Sep 17 00:00:00 2001 From: player-03 Date: Mon, 17 Apr 2023 14:19:15 -0400 Subject: [PATCH 28/33] Always call `new window.Image()`, for consistency. There's no practical downside to doing this, and it makes Lime compatible with tools that act like genes but aren't named "genes." --- src/lime/_internal/backend/html5/HTML5HTTPRequest.hx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/lime/_internal/backend/html5/HTML5HTTPRequest.hx b/src/lime/_internal/backend/html5/HTML5HTTPRequest.hx index 94c3f2b59..d2cb080bc 100644 --- a/src/lime/_internal/backend/html5/HTML5HTTPRequest.hx +++ b/src/lime/_internal/backend/html5/HTML5HTTPRequest.hx @@ -444,11 +444,7 @@ class HTML5HTTPRequest private static function __loadImage(uri:String, promise:Promise, options:Int):Void { - #if (openfljs || genes) - var image:JSImage = untyped #if haxe4 js.Syntax.code #else __js__ #end ('new window.Image ()'); - #else - var image = new JSImage(); - #end + var image:JSImage = #if haxe4 js.Syntax.code #else __js__ #end ('new window.Image ()'); if (!__isSameOrigin(uri)) { From 0535ae026652e6e8216aea583fd119902559d009 Mon Sep 17 00:00:00 2001 From: player-03 Date: Mon, 17 Apr 2023 14:21:44 -0400 Subject: [PATCH 29/33] Always call `new window.Image()`, for consistency. --- src/lime/graphics/Image.hx | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/lime/graphics/Image.hx b/src/lime/graphics/Image.hx index 8712788e8..ed93ba544 100644 --- a/src/lime/graphics/Image.hx +++ b/src/lime/graphics/Image.hx @@ -1438,11 +1438,7 @@ class Image @:noCompletion private function __fromBase64(base64:String, type:String, onload:Image->Void = null):Void { #if (js && html5) - #if (openfljs || genes) var image:JSImage = untyped #if haxe4 js.Syntax.code #else __js__ #end ('new window.Image ()'); - #else - var image = new JSImage(); - #end var image_onLoaded = function(event) { @@ -1574,11 +1570,7 @@ class Image catch (e:Dynamic) {} }); #elseif (js && html5) - #if (openfljs || genes) var image:JSImage = untyped #if haxe4 js.Syntax.code #else __js__ #end ('new window.Image ()'); - #else - var image = new JSImage(); - #end #if !display if (!HTML5HTTPRequest.__isSameOrigin(path)) From 9f9604e0c89a90941e31c3710864f8f8ba71e0f6 Mon Sep 17 00:00:00 2001 From: player-03 Date: Mon, 17 Apr 2023 14:23:29 -0400 Subject: [PATCH 30/33] Restore `untyped` keyword. I meant to move this to right before `__js__` because it's only needed in Haxe 3, but forgot. Also, I realized Lime always puts it before the `#if`, so I just put it back where it was. --- src/lime/_internal/backend/html5/HTML5HTTPRequest.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lime/_internal/backend/html5/HTML5HTTPRequest.hx b/src/lime/_internal/backend/html5/HTML5HTTPRequest.hx index d2cb080bc..a45d34c0d 100644 --- a/src/lime/_internal/backend/html5/HTML5HTTPRequest.hx +++ b/src/lime/_internal/backend/html5/HTML5HTTPRequest.hx @@ -444,7 +444,7 @@ class HTML5HTTPRequest private static function __loadImage(uri:String, promise:Promise, options:Int):Void { - var image:JSImage = #if haxe4 js.Syntax.code #else __js__ #end ('new window.Image ()'); + var image:JSImage = untyped #if haxe4 js.Syntax.code #else __js__ #end ('new window.Image ()'); if (!__isSameOrigin(uri)) { From 7d4d20df9ecd5951e882fc817d01485ea04279e5 Mon Sep 17 00:00:00 2001 From: Josh Tynjala Date: Mon, 17 Apr 2023 14:30:00 -0700 Subject: [PATCH 31/33] actions: build html5 samples with genes to ensure that it doesn't break --- .github/workflows/main.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f871238e6..c23511704 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -639,6 +639,7 @@ jobs: - name: Install Haxe dependencies run: | + haxelib install genes --quiet haxelib git lime-samples https://github.com/openfl/lime-samples --quiet - uses: actions/download-artifact@v3 @@ -663,6 +664,12 @@ jobs: lime build SimpleImage html5 -release -verbose -nocolor lime build SimpleAudio html5 -release -verbose -nocolor + - name: Build Lime samples with Genes + run: | + lime build HelloWorld html5 -clean -release -verbose -nocolor --haxelib=genes + lime build SimpleImage html5 -clean -release -verbose -nocolor --haxelib=genes + lime build SimpleAudio html5 -clean -release -verbose -nocolor --haxelib=genes + ios-samples: needs: package-haxelib runs-on: macos-11 From ef5edc0dfb81f837ecd8bb5d85524542650d6222 Mon Sep 17 00:00:00 2001 From: Josh Tynjala Date: Mon, 17 Apr 2023 14:58:37 -0700 Subject: [PATCH 32/33] actions: temporarily require hxcpp 4.2.1 until HaxeFoundation/hxcpp#1042 is released --- .github/workflows/main.yml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c23511704..dd1c36553 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -29,7 +29,7 @@ jobs: - name: Install Haxe dependencies run: | - haxelib install hxcpp --quiet + haxelib install hxcpp 4.2.1 --quiet haxelib install format --quiet haxelib install hxp --quiet @@ -101,7 +101,7 @@ jobs: rm /usr/local/bin/python3* brew bundle popd - haxelib install hxcpp --quiet + haxelib install hxcpp 4.2.1 --quiet haxelib install format --quiet haxelib install hxp --quiet @@ -153,7 +153,7 @@ jobs: - name: Install Haxe dependencies run: | - haxelib install hxcpp --quiet + haxelib install hxcpp 4.2.1 --quiet haxelib install format --quiet haxelib install hxp --quiet @@ -232,7 +232,7 @@ jobs: - name: Install Haxe dependencies run: | - haxelib install hxcpp --quiet + haxelib install hxcpp 4.2.1 --quiet haxelib install format --quiet haxelib install hxp --quiet @@ -290,7 +290,7 @@ jobs: - name: Install Haxe dependencies run: | - haxelib install hxcpp --quiet + haxelib install hxcpp 4.2.1 --quiet haxelib install format --quiet haxelib install hxp --quiet @@ -340,7 +340,7 @@ jobs: - name: Install Haxe dependencies run: | - haxelib install hxcpp --quiet + haxelib install hxcpp 4.2.1 --quiet haxelib install format --quiet haxelib install hxp --quiet @@ -478,7 +478,7 @@ jobs: - name: Install Haxe dependencies run: | - haxelib install hxcpp --quiet + haxelib install hxcpp 4.2.1 --quiet haxelib install format --quiet haxelib install hxp --quiet haxelib git lime-samples https://github.com/openfl/lime-samples --quiet @@ -587,7 +587,7 @@ jobs: - name: Install Haxe dependencies run: | - haxelib install hxcpp --quiet + haxelib install hxcpp 4.2.1 --quiet haxelib install format --quiet haxelib install hxp --quiet haxelib git lime-samples https://github.com/openfl/lime-samples --quiet @@ -685,7 +685,7 @@ jobs: - name: Install Haxe dependencies run: | - haxelib install hxcpp --quiet + haxelib install hxcpp 4.2.1 --quiet haxelib install format --quiet haxelib install hxp --quiet haxelib git lime-samples https://github.com/openfl/lime-samples --quiet @@ -736,7 +736,7 @@ jobs: - name: Install Haxe dependencies run: | - haxelib install hxcpp --quiet + haxelib install hxcpp 4.2.1 --quiet haxelib install format --quiet haxelib install hxp --quiet haxelib git lime-samples https://github.com/openfl/lime-samples --quiet @@ -782,7 +782,7 @@ jobs: - name: Install Haxe dependencies run: | - haxelib install hxcpp --quiet + haxelib install hxcpp 4.2.1 --quiet haxelib install format --quiet haxelib install hxp --quiet haxelib git lime-samples https://github.com/openfl/lime-samples --quiet @@ -843,7 +843,7 @@ jobs: - name: Install Haxe dependencies run: | - haxelib install hxcpp --quiet + haxelib install hxcpp 4.2.1 --quiet haxelib install format --quiet haxelib install hxp --quiet haxelib git lime-samples https://github.com/openfl/lime-samples --quiet @@ -895,7 +895,7 @@ jobs: - name: Install Haxe dependencies run: | - haxelib install hxcpp --quiet + haxelib install hxcpp 4.2.1 --quiet haxelib install format --quiet haxelib install hxp --quiet haxelib git lime-samples https://github.com/openfl/lime-samples --quiet From 7c9a1894f6278ba29007715168494d03eefb1e3a Mon Sep 17 00:00:00 2001 From: tobil4sk Date: Fri, 21 Apr 2023 19:11:38 +0100 Subject: [PATCH 33/33] Take const char pointers in lime::Font methods --- project/include/text/Font.h | 4 ++-- project/src/text/Font.cpp | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/project/include/text/Font.h b/project/include/text/Font.h index 6523207db..bcf3d4a8e 100644 --- a/project/include/text/Font.h +++ b/project/include/text/Font.h @@ -49,8 +49,8 @@ namespace lime { int GetAscender (); int GetDescender (); wchar_t *GetFamilyName (); - int GetGlyphIndex (char* character); - void* GetGlyphIndices (bool useCFFIValue, char* characters); + int GetGlyphIndex (const char* character); + void* GetGlyphIndices (bool useCFFIValue, const char* characters); void* GetGlyphMetrics (bool useCFFIValue, int index); int GetHeight (); int GetNumGlyphs (); diff --git a/project/src/text/Font.cpp b/project/src/text/Font.cpp index 8ab0bdd0b..61328850c 100644 --- a/project/src/text/Font.cpp +++ b/project/src/text/Font.cpp @@ -25,7 +25,7 @@ #define IS_IN_RANGE(c, f, l) (((c) >= (f)) && ((c) <= (l))) -unsigned long readNextChar (char*& p) +unsigned long readNextChar (const char*& p) { // TODO: since UTF-8 is a variable-length // encoding, you should pass in the input @@ -33,7 +33,8 @@ unsigned long readNextChar (char*& p) // can determine if a malformed UTF-8 // sequence would exceed the end of the buffer... - unsigned char c1, c2, *ptr = (unsigned char*) p; + const unsigned char* ptr = (const unsigned char*) p; + unsigned char c1, c2; unsigned long uc = 0; int seqlen; @@ -792,7 +793,7 @@ namespace lime { } - int Font::GetGlyphIndex (char* character) { + int Font::GetGlyphIndex (const char* character) { long charCode = readNextChar (character); @@ -801,7 +802,7 @@ namespace lime { } - void* Font::GetGlyphIndices (bool useCFFIValue, char* characters) { + void* Font::GetGlyphIndices (bool useCFFIValue, const char* characters) { if (useCFFIValue) {