More-accurate Generic.cpp variable arrangement

Also found some authentic variable names
This commit is contained in:
Clownacy 2020-01-07 06:23:19 +00:00
parent fb64e057ca
commit 34bee5073f

View file

@ -11,26 +11,28 @@
void GetCompileDate(int *year, int *month, int *day) void GetCompileDate(int *year, int *month, int *day)
{ {
int i; int i;
const char *months[13]; char strMonth[0x10];
char month_string[0x10];
months[0] = "XXX"; const char *table[13] = {
months[1] = "Jan"; "XXX",
months[2] = "Feb"; "Jan",
months[3] = "Mar"; "Feb",
months[4] = "Apr"; "Mar",
months[5] = "May"; "Apr",
months[6] = "Jun"; "May",
months[7] = "Jul"; "Jun",
months[8] = "Aug"; "Jul",
months[9] = "Sep"; "Aug",
months[10] = "Oct"; "Sep",
months[11] = "Nov"; "Oct",
months[12] = "Dec"; "Nov",
sscanf(__DATE__, "%s %d %d", month_string, day, year); // The expansion of __DATE__ is not reproductible. TODO : Think about changing this to be reproductible "Dec",
};
sscanf(__DATE__, "%s %d %d", strMonth, day, year); // The expansion of __DATE__ is not reproductible. TODO : Think about changing this to be reproductible
for (i = 0; i < 12; ++i) // This being 12 instead of 13 might be a bug, but it works anyway by accident for (i = 0; i < 12; ++i) // This being 12 instead of 13 might be a bug, but it works anyway by accident
if (!memcmp(&month_string, months[i], 3)) if (!memcmp(&strMonth, table[i], 3))
break; break;
*month = i; *month = i;
@ -413,14 +415,17 @@ BOOL SaveWindowRect(HWND hWnd, const char *filename)
return TRUE; return TRUE;
} }
const char *extra_text = "(C)Pixel";
BOOL IsEnableBitmap(const char *path) BOOL IsEnableBitmap(const char *path)
{ {
FILE *fp;
long len;
char str[16]; char str[16];
static const char *extra_text = "(C)Pixel";
const long len = (long)strlen(extra_text); len = (long)strlen(extra_text);
FILE *fp = fopen(path, "rb"); fp = fopen(path, "rb");
if (fp == NULL) if (fp == NULL)
return FALSE; return FALSE;