lua_5.3.5_amzn.patch 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. Only in src-amzn\: LICENSE
  2. diff -ru src\/loadlib.c src-amzn\/loadlib.c
  3. --- src\/loadlib.c 2017-04-19 10:20:42.000000000 -0700
  4. +++ src-amzn\/loadlib.c 2021-04-16 14:18:21.187929700 -0700
  5. @@ -184,12 +184,14 @@
  6. static void pusherror (lua_State *L) {
  7. int error = GetLastError();
  8. +#if LUMBERYARD_DISABLED
  9. char buffer[128];
  10. if (FormatMessageA(FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM,
  11. NULL, error, 0, buffer, sizeof(buffer)/sizeof(char), NULL))
  12. lua_pushstring(L, buffer);
  13. else
  14. - lua_pushfstring(L, "system error %d\n", error);
  15. +#endif
  16. + lua_pushfstring(L, "system error %d\n", error);
  17. }
  18. static void lsys_unloadlib (void *lib) {
  19. diff -ru src\/loslib.c src-amzn\/loslib.c
  20. --- src\/loslib.c 2017-04-19 10:29:57.000000000 -0700
  21. +++ src-amzn\/loslib.c 2021-04-16 15:43:26.939098900 -0700
  22. @@ -21,6 +21,10 @@
  23. #include "lauxlib.h"
  24. #include "lualib.h"
  25. +#if defined(__APPLE__)
  26. +#include <TargetConditionals.h>
  27. +#endif
  28. +
  29. /*
  30. ** {==================================================================
  31. @@ -139,8 +143,13 @@
  32. static int os_execute (lua_State *L) {
  33. +#if defined(TARGET_OS_IPHONE)
  34. + const char* cmd = NULL;
  35. + int stat = -1;
  36. +#else
  37. const char *cmd = luaL_optstring(L, 1, NULL);
  38. int stat = system(cmd);
  39. +#endif
  40. if (cmd != NULL)
  41. return luaL_execresult(L, stat);
  42. else {
  43. @@ -157,20 +166,29 @@
  44. static int os_rename (lua_State *L) {
  45. +#if !defined(APPLE) && !defined(ANDROID)
  46. const char *fromname = luaL_checkstring(L, 1);
  47. const char *toname = luaL_checkstring(L, 2);
  48. return luaL_fileresult(L, rename(fromname, toname) == 0, NULL);
  49. +#else
  50. + luaL_error(L, "os_rename not implemented on this platform");
  51. + return 1;
  52. +#endif
  53. }
  54. static int os_tmpname (lua_State *L) {
  55. +#if !defined(APPLE) && !defined(ANDROID)
  56. char buff[LUA_TMPNAMBUFSIZE];
  57. int err;
  58. lua_tmpnam(buff, err);
  59. if (err)
  60. +#endif
  61. return luaL_error(L, "unable to generate a unique filename");
  62. +#if !defined(APPLE) && !defined(ANDROID)
  63. lua_pushstring(L, buff);
  64. return 1;
  65. +#endif
  66. }
  67. Only in src\: Makefile