Fix warnings

Some off-by-one errors, truncation warning fix, main() in posix.c no
longer a stub.
This commit is contained in:
Michał Janiszewski 2015-12-29 16:09:36 +01:00
parent 64b589770a
commit 36de7a9027
3 changed files with 3 additions and 7 deletions

View File

@ -57,8 +57,8 @@ void platform_get_exe_path(utf8 *outPath)
}
int exeDelimiterIndex = (int)(exeDelimiter - exePath);
exePath[exeDelimiterIndex] = '\0';
safe_strncpy(outPath, exePath, exeDelimiterIndex + 1);
outPath[exeDelimiterIndex] = '\0';
}
bool platform_check_steam_overlay_attached() {

View File

@ -50,10 +50,6 @@ utf8 _openrctDataDirectoryPath[MAX_PATH] = { 0 };
*/
int main(int argc, const char **argv)
{
//RCT2_GLOBAL(RCT2_ADDRESS_HINSTANCE, HINSTANCE) = hInstance;
//RCT2_GLOBAL(RCT2_ADDRESS_CMDLINE, LPSTR) = lpCmdLine;
STUB();
int run_game = cmdline_run(argv, argc);
if (run_game == 1)
{
@ -372,7 +368,7 @@ int platform_enumerate_directories_begin(const utf8 *directory)
char *npattern = malloc(length+1);
int converted;
converted = wcstombs(npattern, wpattern, length);
npattern[length] = '\0';
npattern[length - 1] = '\0';
if (converted == MAX_PATH) {
log_warning("truncated string %s", npattern);
}

View File

@ -205,7 +205,7 @@ char *safe_strncpy(char * destination, const char * source, size_t size)
if (!terminated)
{
result[size - 1] = '\0';
log_warning("Truncating string %s to %d bytes.", destination, size);
log_warning("Truncating string \"%s\" to %d bytes.", result, size);
}
return result;
}