WIN32: Use MAX_PATH (260) instead of MAXPATHLEN (256)

This commit is contained in:
sluicebox 2021-05-03 10:10:13 -07:00
parent 1f253b805c
commit 863747bc96
3 changed files with 12 additions and 12 deletions

View File

@ -232,7 +232,7 @@ Common::String OSystem_Win32::getScreenshotsPath() {
}
// Use the My Pictures folder.
char picturesPath[MAXPATHLEN];
char picturesPath[MAX_PATH];
if (SHGetFolderPathFunc(NULL, CSIDL_MYPICTURES, NULL, SHGFP_TYPE_CURRENT, picturesPath) != S_OK) {
warning("Unable to access My Pictures directory");
@ -252,7 +252,7 @@ Common::String OSystem_Win32::getScreenshotsPath() {
}
Common::String OSystem_Win32::getDefaultConfigFileName() {
char configFile[MAXPATHLEN];
char configFile[MAX_PATH];
// Use the Application Data directory of the user profile.
if (SHGetFolderPathFunc(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, configFile) == S_OK) {
@ -267,9 +267,9 @@ Common::String OSystem_Win32::getDefaultConfigFileName() {
FILE *tmp = NULL;
if ((tmp = fopen(configFile, "r")) == NULL) {
// Check windows directory
char oldConfigFile[MAXPATHLEN];
uint ret = GetWindowsDirectory(oldConfigFile, MAXPATHLEN);
if (ret == 0 || ret > MAXPATHLEN)
char oldConfigFile[MAX_PATH];
uint ret = GetWindowsDirectory(oldConfigFile, MAX_PATH);
if (ret == 0 || ret > MAX_PATH)
error("Cannot retrieve the path of the Windows directory");
strcat(oldConfigFile, "\\" DEFAULT_CONFIG_FILE);
@ -284,8 +284,8 @@ Common::String OSystem_Win32::getDefaultConfigFileName() {
} else {
warning("Unable to access application data directory");
// Check windows directory
uint ret = GetWindowsDirectory(configFile, MAXPATHLEN);
if (ret == 0 || ret > MAXPATHLEN)
uint ret = GetWindowsDirectory(configFile, MAX_PATH);
if (ret == 0 || ret > MAX_PATH)
error("Cannot retrieve the path of the Windows directory");
strcat(configFile, "\\" DEFAULT_CONFIG_FILE);
@ -295,7 +295,7 @@ Common::String OSystem_Win32::getDefaultConfigFileName() {
}
Common::String OSystem_Win32::getDefaultLogFileName() {
char logFile[MAXPATHLEN];
char logFile[MAX_PATH];
// Use the Application Data directory of the user profile.
if (SHGetFolderPathFunc(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, logFile) != S_OK) {

View File

@ -36,7 +36,7 @@
#include "backends/platform/sdl/win32/win32_wrapper.h"
WindowsSaveFileManager::WindowsSaveFileManager() {
char defaultSavepath[MAXPATHLEN];
char defaultSavepath[MAX_PATH];
// Use the Application Data directory of the user profile.

View File

@ -483,19 +483,19 @@ void Engine::checkCD() {
// If we can find a compressed audio track, then it should be ok even
// if it's running from CD.
char buffer[MAXPATHLEN];
char buffer[MAX_PATH];
int i;
const Common::FSNode gameDataDir(ConfMan.get("path"));
if (gameDataDir.getPath().empty()) {
// That's it! I give up!
if (getcwd(buffer, MAXPATHLEN) == NULL)
if (getcwd(buffer, MAX_PATH) == NULL)
return;
} else
Common::strlcpy(buffer, gameDataDir.getPath().c_str(), sizeof(buffer));
for (i = 0; i < MAXPATHLEN - 1; i++) {
for (i = 0; i < MAX_PATH - 1; i++) {
if (buffer[i] == '\\')
break;
}