mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-28 10:20:04 +02:00
More sensible types for path lengths
Now uses the types given in the path function declarations
This commit is contained in:
11
src/update.c
11
src/update.c
@@ -42,11 +42,13 @@
|
|||||||
char *exe_name(void)
|
char *exe_name(void)
|
||||||
{
|
{
|
||||||
#if defined WIN32
|
#if defined WIN32
|
||||||
char *name= (char *)malloc(64), max=64, res;
|
char *name= (char *)malloc(64);
|
||||||
while ((res = (char)GetModuleFileName(NULL, name, max)) >= max)
|
DWORD max=64, res;
|
||||||
|
while ((res = GetModuleFileName(NULL, name, max)) >= max)
|
||||||
{
|
{
|
||||||
#elif defined MACOSX
|
#elif defined MACOSX
|
||||||
char *fn=malloc(64),*name=malloc(PATH_MAX), max=64, res;
|
char *fn=malloc(64),*name=malloc(PATH_MAX);
|
||||||
|
uint32_t max=64, res;
|
||||||
if (_NSGetExecutablePath(fn, &max) != 0)
|
if (_NSGetExecutablePath(fn, &max) != 0)
|
||||||
{
|
{
|
||||||
fn = realloc(fn, max);
|
fn = realloc(fn, max);
|
||||||
@@ -60,7 +62,8 @@ char *exe_name(void)
|
|||||||
}
|
}
|
||||||
res = 1;
|
res = 1;
|
||||||
#else
|
#else
|
||||||
char fn[64], *name=malloc(64), max=64, res;
|
char fn[64], *name=malloc(64);
|
||||||
|
size_t max=64, res;
|
||||||
sprintf(fn, "/proc/self/exe");
|
sprintf(fn, "/proc/self/exe");
|
||||||
memset(name, 0, max);
|
memset(name, 0, max);
|
||||||
while ((res = readlink(fn, name, max)) >= max-1)
|
while ((res = readlink(fn, name, max)) >= max-1)
|
||||||
|
Reference in New Issue
Block a user