More C++11ification.

This commit is contained in:
Ben Vanik
2014-07-13 22:28:00 -07:00
parent 0a250d5e91
commit e9284dfaed
40 changed files with 211 additions and 152 deletions

View File

@@ -62,7 +62,7 @@ Entry* DiscImageDevice::ResolvePath(const char* path) {
// Walk the path, one separator at a time.
// We copy it into the buffer and shift it left over and over.
char remaining[XE_MAX_PATH];
char remaining[poly::max_path];
XEIGNORE(xestrcpya(remaining, XECOUNT(remaining), path));
while (remaining[0]) {
char* next_slash = xestrchra(remaining, '\\');

View File

@@ -35,23 +35,23 @@ Entry* HostPathDevice::ResolvePath(const char* path) {
XELOGFS("HostPathDevice::ResolvePath(%s)", path);
#if XE_WCHAR
xechar_t rel_path[XE_MAX_PATH];
xechar_t rel_path[poly::max_path];
XEIGNORE(xestrwiden(rel_path, XECOUNT(rel_path), path));
#else
const xechar_t* rel_path = path;
#endif
xechar_t full_path[XE_MAX_PATH];
xechar_t full_path[poly::max_path];
xe_path_join(local_path_, rel_path, full_path, XECOUNT(full_path));
// Swap around path separators.
if (XE_PATH_SEPARATOR != '\\') {
if (poly::path_separator != '\\') {
for (size_t n = 0; n < XECOUNT(full_path); n++) {
if (full_path[n] == 0) {
break;
}
if (full_path[n] == '\\') {
full_path[n] = XE_PATH_SEPARATOR;
full_path[n] = poly::path_separator;
}
}
}

View File

@@ -87,10 +87,10 @@ X_STATUS HostPathEntry::QueryDirectory(
}
if (handle == INVALID_HANDLE_VALUE) {
xechar_t target_path[XE_MAX_PATH];
xestrcpy(target_path, XE_MAX_PATH, local_path_);
xechar_t target_path[poly::max_path];
xestrcpy(target_path, poly::max_path, local_path_);
if (file_name == NULL) {
xestrcat(target_path, XE_MAX_PATH, XETEXT("*"));
xestrcat(target_path, poly::max_path, L"*");
}
else {
auto target_length = xestrlen(local_path_);

View File

@@ -63,7 +63,7 @@ Entry* STFSContainerDevice::ResolvePath(const char* path) {
// Walk the path, one separator at a time.
// We copy it into the buffer and shift it left over and over.
char remaining[XE_MAX_PATH];
char remaining[poly::max_path];
XEIGNORE(xestrcpya(remaining, XECOUNT(remaining), path));
while (remaining[0]) {
char* next_slash = xestrchra(remaining, '\\');

View File

@@ -91,7 +91,7 @@ Entry* FileSystem::ResolvePath(const char* path) {
// Resolve symlinks.
// TODO(benvanik): more robust symlink handling - right now we assume simple
// drive path -> device mappings with nothing nested.
char full_path[XE_MAX_PATH];
char full_path[poly::max_path];
XEIGNORE(xestrcpya(full_path, XECOUNT(full_path), path));
for (std::unordered_map<std::string, std::string>::iterator it =
symlinks_.begin(); it != symlinks_.end(); ++it) {
@@ -111,7 +111,7 @@ Entry* FileSystem::ResolvePath(const char* path) {
if (xestrcasestra(full_path, device->path()) == full_path) {
// Found!
// Trim the device prefix off and pass down.
char device_path[XE_MAX_PATH];
char device_path[poly::max_path];
XEIGNORE(xestrcpya(device_path, XECOUNT(device_path),
full_path + xestrlena(device->path())));
return device->ResolvePath(device_path);

View File

@@ -34,7 +34,7 @@ public:
protected:
char name_[256];
char path_[XE_MAX_PATH];
char path_[poly::max_path];
};