Changeset 319 for clamav/trunk/libclamav/c++/llvm/lib/System/Win32/Path.inc
- Timestamp:
- Apr 19, 2011, 11:12:07 PM (14 years ago)
- Location:
- clamav/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
clamav/trunk ¶
-
Property svn:mergeinfo
set to
/clamav/vendor/0.97 merged eligible
-
Property svn:mergeinfo
set to
-
TabularUnified clamav/trunk/libclamav/c++/llvm/lib/System/Win32/Path.inc ¶
r189 r319 127 127 128 128 void Path::makeAbsolute() { 129 TCHAR FullPath[MAX_PATH + 1] = {0}; 129 TCHAR FullPath[MAX_PATH + 1] = {0}; 130 130 LPTSTR FilePart = NULL; 131 131 … … 162 162 } 163 163 164 bool 164 bool 165 165 Path::isAbsolute() const { 166 166 // FIXME: This does not handle correctly an absolute path starting from … … 175 175 return path[0] == '/' || (path[1] == ':' && path[2] == '/'); 176 176 } 177 } 178 179 static Path *TempDirectory = NULL;177 } 178 179 static Path *TempDirectory; 180 180 181 181 Path … … 267 267 char pathname[MAX_PATH]; 268 268 ::GetCurrentDirectoryA(MAX_PATH,pathname); 269 return Path(pathname); 269 return Path(pathname); 270 270 } 271 271 … … 281 281 // FIXME: the above set of functions don't map to Windows very well. 282 282 283 284 bool285 Path::isRootDirectory() const {286 size_t len = path.size();287 return len > 0 && path[len-1] == '/';288 }289 283 290 284 StringRef Path::getDirname() const { … … 407 401 status.uniqueID += path[i]; 408 402 409 __int64 ft = *reinterpret_cast<__int64*>(&fi.ftLastWriteTime); 410 status.modTime.fromWin32Time(ft); 403 ULARGE_INTEGER ui; 404 ui.LowPart = fi.ftLastWriteTime.dwLowDateTime; 405 ui.HighPart = fi.ftLastWriteTime.dwHighDateTime; 406 status.modTime.fromWin32Time(ui.QuadPart); 411 407 412 408 status.isDir = fi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY; … … 449 445 return true; 450 446 } 451 447 452 448 if (!(fi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { 453 449 if (ErrMsg) … … 618 614 if (!CreateDirectory(pathname, NULL) && 619 615 GetLastError() != ERROR_ALREADY_EXISTS) 620 return MakeErrMsg(ErrMsg, 616 return MakeErrMsg(ErrMsg, 621 617 std::string(pathname) + ": Can't create directory: "); 622 618 *next++ = '/'; … … 650 646 if (!GetFileAttributesEx(path.c_str(), GetFileExInfoStandard, &fi)) 651 647 return true; 652 648 653 649 if (fi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { 654 650 // If it doesn't exist, we're done. … … 707 703 pathname[lastchar] = 0; 708 704 if (!RemoveDirectory(pathname)) 709 return MakeErrMsg(ErrStr, 705 return MakeErrMsg(ErrStr, 710 706 std::string(pathname) + ": Can't destroy directory: "); 711 707 return false; … … 727 723 bool Path::getMagicNumber(std::string& Magic, unsigned len) const { 728 724 assert(len < 1024 && "Request for magic string too long"); 729 char* buf = (char*) alloca(1 + len);725 char* buf = reinterpret_cast<char*>(alloca(len)); 730 726 731 727 HANDLE h = CreateFile(path.c_str(), … … 746 742 return false; 747 743 748 buf[len] = '\0'; 749 Magic = buf; 744 Magic = std::string(buf, len); 750 745 return true; 751 746 } … … 754 749 Path::renamePathOnDisk(const Path& newName, std::string* ErrMsg) { 755 750 if (!MoveFileEx(path.c_str(), newName.c_str(), MOVEFILE_REPLACE_EXISTING)) 756 return MakeErrMsg(ErrMsg, "Can't move '" + path + "' to '" + newName.path 751 return MakeErrMsg(ErrMsg, "Can't move '" + path + "' to '" + newName.path 757 752 + "': "); 758 753 return false; … … 765 760 return true; 766 761 } 767 762 768 763 HANDLE h = CreateFile(path.c_str(), 769 764 FILE_READ_ATTRIBUTES | FILE_WRITE_ATTRIBUTES, … … 784 779 } 785 780 781 ULARGE_INTEGER ui; 782 ui.QuadPart = si.modTime.toWin32Time(); 786 783 FILETIME ft; 787 (uint64_t&)ft = si.modTime.toWin32Time(); 784 ft.dwLowDateTime = ui.LowPart; 785 ft.dwHighDateTime = ui.HighPart; 788 786 BOOL ret = SetFileTime(h, NULL, &ft, &ft); 789 787 DWORD err = GetLastError();
Note:
See TracChangeset
for help on using the changeset viewer.