games/openbor: regen patches

This commit is contained in:
Jan Beich 2018-07-07 00:40:34 +00:00
parent d35cb075e1
commit 3dad98480a
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=474049
6 changed files with 28 additions and 28 deletions

View File

@ -1,9 +1,9 @@
Fix potential crashes found by ASan/Clang/GCC
Fix an infinite loop in lcmScriptDeleteMain()
--- openbor.c.orig 2017-04-22 14:20:08 UTC
--- openbor.c.orig 2018-07-06 15:13:16 UTC
+++ openbor.c
@@ -5747,17 +5747,17 @@ s_collision_attack *collision_alloc_attack_instance(s_
@@ -6259,17 +6259,17 @@ s_collision_attack *collision_alloc_attack_instance(s_
//
// Allocate an empty collision attack list.
s_collision_attack **collision_alloc_attack_list()
@ -22,7 +22,7 @@ Fix an infinite loop in lcmScriptDeleteMain()
memset(result, 0, alloc_size);
// return result.
@@ -5796,17 +5796,17 @@ s_collision_body *collision_alloc_body_instance(s_coll
@@ -6308,17 +6308,17 @@ s_collision_body *collision_alloc_body_instance(s_coll
//
// Allocate an empty collision attack list.
s_collision_body **collision_alloc_body_list()
@ -41,7 +41,7 @@ Fix an infinite loop in lcmScriptDeleteMain()
memset(result, 0, alloc_size);
// return result.
@@ -8204,7 +8204,8 @@ size_t lcmScriptCopyBuffer(ArgList *argl
@@ -8743,7 +8743,8 @@ size_t lcmScriptCopyBuffer(ArgList *arglist, char *buf
size_t lcmScriptDeleteMain(char **buf)
{
@ -51,15 +51,15 @@ Fix an infinite loop in lcmScriptDeleteMain()
ptrdiff_t pos = 0;
char *newbuf = NULL;
@@ -15210,6 +15210,11 @@ void bar(int x, int y, int value, int ma
@@ -15920,6 +15921,11 @@ void bar(int x, int y, int value, int maxvalue, s_bars
else
{
return;
}
+ }
+
+ if (value < 0)
+ {
+ value = 0;
+ }
+
}
if (value > maxvalue)
{
value = maxvalue;

View File

@ -1,8 +1,8 @@
Don't crash with empty Paks/ directory.
--- sdl/menu.c.orig 2015-04-18 21:21:56 UTC
--- sdl/menu.c.orig 2018-07-06 15:13:16 UTC
+++ sdl/menu.c
@@ -747,7 +747,7 @@ void Menu()
@@ -753,7 +753,7 @@ void Menu()
}
freeAllLogs();
termMenu();

View File

@ -1,6 +1,6 @@
Store settings under ~/.openbor instead of current directory
--- sdl/sdlport.c.orig 2015-04-18 21:21:56 UTC
--- sdl/sdlport.c.orig 2018-07-06 15:13:16 UTC
+++ sdl/sdlport.c
@@ -11,6 +11,8 @@
#include "ram.h"
@ -11,8 +11,8 @@ Store settings under ~/.openbor instead of current directory
#include <time.h>
#include <unistd.h>
@@ -103,6 +105,16 @@ int main(int argc, char *argv[])
#ifdef ANDROID
@@ -135,6 +137,16 @@ int main(int argc, char *argv[])
}
dirExists(rootDir, 1);
chdir(rootDir);
+#else
@ -26,5 +26,5 @@ Store settings under ~/.openbor instead of current directory
+ err(1, "cannot cd to $HOME/.openbor");
+ }
#endif
dirExists(paksDir, 1);
dirExists(savesDir, 1);

View File

@ -1,9 +1,9 @@
Reset seek position for BGM with more than 128 tracks
Don't crash with more than 256 tracks.
--- source/gamelib/packfile.c.orig 2018-02-19 15:02:50 UTC
--- source/gamelib/packfile.c.orig 2018-07-06 15:13:16 UTC
+++ source/gamelib/packfile.c
@@ -1408,7 +1408,7 @@ void packfile_music_read(fileliststruct *filelist, int
@@ -1407,7 +1407,7 @@ void packfile_music_read(fileliststruct *filelist, int
getBasePath(packfile, filelist[i].filename, 1);
if(stristr(packfile, ".pak"))
{
@ -12,7 +12,7 @@ Don't crash with more than 256 tracks.
filelist[i].nTracks = 0;
fd = fopen(packfile, "rb");
if(fd == NULL)
@@ -1440,7 +1440,7 @@ void packfile_music_read(fileliststruct *filelist, int
@@ -1439,7 +1439,7 @@ void packfile_music_read(fileliststruct *filelist, int
{
goto nextpak;
}

View File

@ -1,6 +1,6 @@
Implement Linux-like memory stats for BSDs
--- source/ramlib/ram.c.orig 2017-04-22 14:20:08 UTC
--- source/ramlib/ram.c.orig 2018-07-06 15:13:16 UTC
+++ source/ramlib/ram.c
@@ -25,6 +25,21 @@
#include <mach/task.h>
@ -36,7 +36,7 @@ Implement Linux-like memory stats for BSDs
static unsigned long elfOffset = 0x00000000;
static unsigned long stackSize = 0x00000000;
#endif
@@ -56,7 +74,10 @@ static unsigned long stackSize = 0x00000
@@ -56,7 +74,10 @@ static unsigned long stackSize = 0x00000000;
/////////////////////////////////////////////////////////////////////////////
// Symbols
@ -97,7 +97,7 @@ Implement Linux-like memory stats for BSDs
#elif LINUX
struct sysinfo info;
sysinfo(&info);
@@ -133,11 +197,29 @@ void setSystemRam()
@@ -133,11 +196,29 @@ void setSystemRam()
stat.dwLength = sizeof(MEMORYSTATUSEX);
GlobalMemoryStatusEx(&stat);
systemRam = stat.ullTotalPhys;
@ -132,7 +132,7 @@ Implement Linux-like memory stats for BSDs
#elif LINUX
struct sysinfo info;
sysinfo(&info);
@@ -183,7 +265,10 @@ void setSystemRam()
@@ -183,7 +264,10 @@ void setSystemRam()
stackSize = 0x00000000;
systemRam = getFreeRam(BYTES);
#endif
@ -144,7 +144,7 @@ Implement Linux-like memory stats for BSDs
stackSize = (int)&_end - (int)&_start + ((int)&_start - elfOffset);
#endif
getRamStatus(BYTES);
@@ -212,6 +297,42 @@ u64 getUsedRam(int byte_size)
@@ -215,6 +299,42 @@ u64 getUsedRam(int byte_size)
return 0;
}
return info.resident_size / byte_size;

View File

@ -6,9 +6,9 @@ source/utils.c:303:64: error: member reference base type 'int' is not a structur
writeToLogFile("Memory usage at exit: %u\n", mallinfo().arena);
~~~~~~~~~~^~~~~~
--- source/utils.c.orig 2017-04-22 14:20:08 UTC
--- source/utils.c.orig 2018-07-06 15:13:16 UTC
+++ source/utils.c
@@ -299,7 +299,7 @@ void *checkAlloc(void *ptr, size_t size, const char *f
@@ -303,7 +303,7 @@ void *checkAlloc(void *ptr, size_t size, const char *f
"\n* Shutting Down *\n\n");
writeToLogFile("Out of memory!\n");
writeToLogFile("Allocation of size %i failed in function '%s' at %s:%i.\n", size, func, file, line);
@ -16,4 +16,4 @@ source/utils.c:303:64: error: member reference base type 'int' is not a structur
+#if defined(__GLIBC__) || defined(ANDROID) || defined(VITA)
writeToLogFile("Memory usage at exit: %u\n", mallinfo().arena);
#endif
exit(2);
borExit(2);