修复VFS类中的路径分隔符替换逻辑,并优化SetFilePointer函数以支持高位移动
This commit is contained in:
8
vfs.cpp
8
vfs.cpp
@@ -74,7 +74,7 @@ HANDLE VFS::CreateFileW(std::wstring path) {
|
||||
return INVALID_HANDLE_VALUE;
|
||||
}
|
||||
str = fileop::relpath(str, base_path);
|
||||
str = str_util::str_replace(str, "\\", "/");
|
||||
str = str_util::str_replace(str, "/", "\\");
|
||||
auto c = files.find(str);
|
||||
if (c == files.end()) {
|
||||
SetLastError(ERROR_FILE_NOT_FOUND);
|
||||
@@ -169,7 +169,11 @@ DWORD VFS::SetFilePointer(HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceTo
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return INVALID_SET_FILE_POINTER;
|
||||
}
|
||||
zip_int64_t n = zip_fseek(file, lDistanceToMove, dwMoveMethod);
|
||||
zip_int64_t offset = lDistanceToMove;
|
||||
if (lpDistanceToMoveHigh) {
|
||||
offset |= ((zip_int64_t)*lpDistanceToMoveHigh) << 32;
|
||||
}
|
||||
zip_int64_t n = zip_fseek(file, offset, dwMoveMethod);
|
||||
if (n == -1) {
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return INVALID_SET_FILE_POINTER;
|
||||
|
||||
Reference in New Issue
Block a user