fixed compile on Windows

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3224 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2010-06-27 00:18:33 +00:00
parent c1ae6c9773
commit 918decfd0d
4 changed files with 11 additions and 9 deletions

View File

@ -117,10 +117,12 @@ win32 {
QMAKE_CC = g++ QMAKE_CC = g++
OBJECTS_DIR = temp/obj OBJECTS_DIR = temp/obj
MOC_DIR = temp/moc MOC_DIR = temp/moc
DEFINES = WINDOWS_SYS WIN32 STATICLIB MINGW DEFINES *= WINDOWS_SYS WIN32 STATICLIB MINGW
DEFINES *= MINIUPNPC_VERSION=13 DEFINES *= MINIUPNPC_VERSION=13
DESTDIR = lib DESTDIR = lib
DEFINES -= DEBUG_PQISSL
#miniupnp implementation files #miniupnp implementation files
HEADERS += upnp/upnputil.h HEADERS += upnp/upnputil.h
SOURCES += upnp/upnputil.c SOURCES += upnp/upnputil.c

View File

@ -211,7 +211,7 @@ void RsInit::InitRsConfig()
#ifdef WINDOWS_SYS #ifdef WINDOWS_SYS
// test for portable version // test for portable version
if (GetFileAttributes ("gpg.exe") != (DWORD) -1 && GetFileAttributes ("gpgme-w32spawn.exe") != (DWORD) -1) { if (GetFileAttributes (L"gpg.exe") != (DWORD) -1 && GetFileAttributes (L"gpgme-w32spawn.exe") != (DWORD) -1) {
// use portable version // use portable version
RsInitConfig::portable = true; RsInitConfig::portable = true;
} }

View File

@ -402,7 +402,7 @@ bool RsDirUtil::renameFile(const std::string& from, const std::string& to)
#else #else
std::string f(from),t(to) ; std::string f(from),t(to) ;
#endif #endif
while (!MoveFileEx(f.c_str(), t.c_str(), MOVEFILE_REPLACE_EXISTING)) while (!MoveFileExA(f.c_str(), t.c_str(), MOVEFILE_REPLACE_EXISTING))
#else #else
while (rename(from.c_str(), to.c_str()) < 0) while (rename(from.c_str(), to.c_str()) < 0)
#endif #endif
@ -432,7 +432,7 @@ bool RsDirUtil::renameFile(const std::string& from, const std::string& to)
bool RsDirUtil::createBackup (std::string sFilename, unsigned int nCount) bool RsDirUtil::createBackup (std::string sFilename, unsigned int nCount)
{ {
#ifdef WINDOWS_SYS #ifdef WINDOWS_SYS
if (GetFileAttributes (sFilename.c_str ()) == -1) { if (GetFileAttributesA (sFilename.c_str ()) == -1) {
// file doesn't exist // file doesn't exist
return true; return true;
} }
@ -443,7 +443,7 @@ bool RsDirUtil::createBackup (std::string sFilename, unsigned int nCount)
std::ostringstream sStream; std::ostringstream sStream;
sStream << sFilename << nLast << ".bak"; sStream << sFilename << nLast << ".bak";
if (GetFileAttributes (sStream.str ().c_str ()) != -1) { if (GetFileAttributesA (sStream.str ().c_str ()) != -1) {
break; break;
} }
} }
@ -452,7 +452,7 @@ bool RsDirUtil::createBackup (std::string sFilename, unsigned int nCount)
if (nLast == nCount) { if (nLast == nCount) {
std::ostringstream sStream; std::ostringstream sStream;
sStream << sFilename << nCount << ".bak"; sStream << sFilename << nCount << ".bak";
if (DeleteFile (sStream.str ().c_str ()) == FALSE) { if (DeleteFileA (sStream.str ().c_str ()) == FALSE) {
getPqiNotify()->AddSysMessage (0, RS_SYS_WARNING, "File delete error", "Error while deleting file " + sStream.str ()); getPqiNotify()->AddSysMessage (0, RS_SYS_WARNING, "File delete error", "Error while deleting file " + sStream.str ());
return false; return false;
} }
@ -475,7 +475,7 @@ bool RsDirUtil::createBackup (std::string sFilename, unsigned int nCount)
// copy backup // copy backup
std::ostringstream sStream; std::ostringstream sStream;
sStream << sFilename << 1 << ".bak"; sStream << sFilename << 1 << ".bak";
if (CopyFile (sFilename.c_str (), sStream.str ().c_str (), FALSE) == FALSE) { if (CopyFileA (sFilename.c_str (), sStream.str ().c_str (), FALSE) == FALSE) {
getPqiNotify()->AddSysMessage (0, RS_SYS_WARNING, "File rename error", "Error while renaming file " + sFilename + " to " + sStream.str ()); getPqiNotify()->AddSysMessage (0, RS_SYS_WARNING, "File rename error", "Error while renaming file " + sFilename + " to " + sStream.str ());
return false; return false;
} }

View File

@ -64,7 +64,7 @@ bool RsDiscSpace::crossSystemDiskStats(const char *file, uint64_t& free_blocks,
char *pszFullPath = _fullpath (NULL, file, 0); char *pszFullPath = _fullpath (NULL, file, 0);
if (pszFullPath == 0) { if (pszFullPath == 0) {
std::cerr << "Size estimate failed for drive (_fullpath) " << szDrive << std::endl ; std::cerr << "Size estimate failed for drive (_fullpath) " << std::endl ;
return false; return false;
} }
_splitpath (pszFullPath, szDrive, NULL, NULL, NULL); _splitpath (pszFullPath, szDrive, NULL, NULL, NULL);
@ -72,7 +72,7 @@ bool RsDiscSpace::crossSystemDiskStats(const char *file, uint64_t& free_blocks,
#endif #endif
szDrive[3] = 0; szDrive[3] = 0;
if (!GetDiskFreeSpace (szDrive, &dwSectorPerCluster, &dwBytesPerSector, &dwFreeClusters, &dwTotalClusters)) if (!GetDiskFreeSpaceA (szDrive, &dwSectorPerCluster, &dwBytesPerSector, &dwFreeClusters, &dwTotalClusters))
{ {
std::cerr << "Size estimate failed for drive " << szDrive << std::endl ; std::cerr << "Size estimate failed for drive " << szDrive << std::endl ;
return false; return false;