Ignore:
Timestamp:
Apr 19, 2011, 11:12:07 PM (14 years ago)
Author:
Yuri Dario
Message:

clamav: update trunk to 0.97.

Location:
clamav/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • clamav/trunk

  • TabularUnified clamav/trunk/libclamav/c++/llvm/lib/System/Win32/Path.inc

    r189 r319  
    127127
    128128void Path::makeAbsolute() {
    129   TCHAR  FullPath[MAX_PATH + 1] = {0}; 
     129  TCHAR  FullPath[MAX_PATH + 1] = {0};
    130130  LPTSTR FilePart = NULL;
    131131
     
    162162}
    163163
    164 bool 
     164bool
    165165Path::isAbsolute() const {
    166166  // FIXME: This does not handle correctly an absolute path starting from
     
    175175      return path[0] == '/' || (path[1] == ':' && path[2] == '/');
    176176  }
    177 } 
    178 
    179 static Path *TempDirectory = NULL;
     177}
     178
     179static Path *TempDirectory;
    180180
    181181Path
     
    267267  char pathname[MAX_PATH];
    268268  ::GetCurrentDirectoryA(MAX_PATH,pathname);
    269   return Path(pathname); 
     269  return Path(pathname);
    270270}
    271271
     
    281281// FIXME: the above set of functions don't map to Windows very well.
    282282
    283 
    284 bool
    285 Path::isRootDirectory() const {
    286   size_t len = path.size();
    287   return len > 0 && path[len-1] == '/';
    288 }
    289283
    290284StringRef Path::getDirname() const {
     
    407401      status.uniqueID += path[i];
    408402
    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);
    411407
    412408    status.isDir = fi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY;
     
    449445    return true;
    450446  }
    451    
     447
    452448  if (!(fi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
    453449    if (ErrMsg)
     
    618614      if (!CreateDirectory(pathname, NULL) &&
    619615          GetLastError() != ERROR_ALREADY_EXISTS)
    620           return MakeErrMsg(ErrMsg, 
     616          return MakeErrMsg(ErrMsg,
    621617            std::string(pathname) + ": Can't create directory: ");
    622618      *next++ = '/';
     
    650646  if (!GetFileAttributesEx(path.c_str(), GetFileExInfoStandard, &fi))
    651647    return true;
    652    
     648
    653649  if (fi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
    654650    // If it doesn't exist, we're done.
     
    707703    pathname[lastchar] = 0;
    708704    if (!RemoveDirectory(pathname))
    709       return MakeErrMsg(ErrStr, 
     705      return MakeErrMsg(ErrStr,
    710706        std::string(pathname) + ": Can't destroy directory: ");
    711707    return false;
     
    727723bool Path::getMagicNumber(std::string& Magic, unsigned len) const {
    728724  assert(len < 1024 && "Request for magic string too long");
    729   char* buf = (char*) alloca(1 + len);
     725  char* buf = reinterpret_cast<char*>(alloca(len));
    730726
    731727  HANDLE h = CreateFile(path.c_str(),
     
    746742    return false;
    747743
    748   buf[len] = '\0';
    749   Magic = buf;
     744  Magic = std::string(buf, len);
    750745  return true;
    751746}
     
    754749Path::renamePathOnDisk(const Path& newName, std::string* ErrMsg) {
    755750  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
    757752        + "': ");
    758753  return false;
     
    765760    return true;
    766761  }
    767  
     762
    768763  HANDLE h = CreateFile(path.c_str(),
    769764                        FILE_READ_ATTRIBUTES | FILE_WRITE_ATTRIBUTES,
     
    784779  }
    785780
     781  ULARGE_INTEGER ui;
     782  ui.QuadPart = si.modTime.toWin32Time();
    786783  FILETIME ft;
    787   (uint64_t&)ft = si.modTime.toWin32Time();
     784  ft.dwLowDateTime = ui.LowPart;
     785  ft.dwHighDateTime = ui.HighPart;
    788786  BOOL ret = SetFileTime(h, NULL, &ft, &ft);
    789787  DWORD err = GetLastError();
Note: See TracChangeset for help on using the changeset viewer.