Jim Park's Unicode NSIS merging - Step 1 : switch to TCHARs where relevant.
Compiler output is identical before & after this step git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/branches/wizou@6036 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
4e48722b63
commit
752d7d239a
209 changed files with 9698 additions and 7658 deletions
|
@ -22,6 +22,8 @@
|
|||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
// Unicode support by Jim Park -- 08/29/2007
|
||||
|
||||
|
||||
#include "POSIXUtil.h"
|
||||
|
@ -54,13 +56,13 @@ namespace POSIX {
|
|||
|
||||
#ifdef __WIN32__
|
||||
/* do it the old way on Win32, because POSIX does not get timezone stuff right */
|
||||
ALT_FILETIME getFileTime(const char* sFileName) {
|
||||
ALT_FILETIME getFileTime(const TCHAR* sFileName) {
|
||||
FILETIME temp;
|
||||
GetSystemTimeAsFileTime(&temp);
|
||||
HANDLE h = CreateFile(sFileName, GENERIC_READ, FILE_SHARE_READ, NULL,
|
||||
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
|
||||
if (h == INVALID_HANDLE_VALUE) {
|
||||
cerr << "Cannot read file time of " << sFileName << "\n";
|
||||
terr << _T("Cannot read file time of ") << sFileName << _T("\n");
|
||||
} else {
|
||||
GetFileTime(h, NULL, NULL, &temp);
|
||||
CloseHandle(h);
|
||||
|
@ -77,7 +79,7 @@ namespace POSIX {
|
|||
time_t currentTime = time(NULL);
|
||||
|
||||
if(stat(sFileName, &buf)) {
|
||||
cerr << "Cannot read file time of " << sFileName << "\n";
|
||||
terr << _T("Cannot read file time of ") << sFileName << _T("\n");
|
||||
} else {
|
||||
/* get the time from the file */
|
||||
currentTime = buf.st_mtime;
|
||||
|
@ -88,11 +90,11 @@ namespace POSIX {
|
|||
}
|
||||
#endif
|
||||
|
||||
uint32_t getFileSize(const char* sFileName) {
|
||||
uint32_t getFileSize(const TCHAR* sFileName) {
|
||||
std::ifstream f;
|
||||
f.open(sFileName, std::ios_base::binary | std::ios_base::in);
|
||||
if (!f.good() || f.eof() || !f.is_open()) {
|
||||
throw "File could not be read (getFileSize)";
|
||||
throw _T("File could not be read (getFileSize)");
|
||||
}
|
||||
f.seekg(0, std::ios_base::beg);
|
||||
std::ifstream::pos_type begin_pos = f.tellg();
|
||||
|
@ -101,29 +103,29 @@ namespace POSIX {
|
|||
}
|
||||
|
||||
#ifdef __WIN32__
|
||||
string getTempFile() {
|
||||
char buffer[MAX_PATH];
|
||||
if(GetTempFileName(".","vpatch",0,buffer) == 0) {
|
||||
cerr << "Cannot create temporary filename";
|
||||
tstring getTempFile() {
|
||||
TCHAR buffer[MAX_PATH];
|
||||
if(GetTempFileName(_T("."),_T("vpatch"),0,buffer) == 0) {
|
||||
terr << _T("Cannot create temporary filename");
|
||||
}
|
||||
return string(buffer);
|
||||
return tstring(buffer);
|
||||
}
|
||||
#else
|
||||
string getTempFile() {
|
||||
char t[] = "/tmp/genpatXXXXXX";
|
||||
tstring getTempFile() {
|
||||
TCHAR t[] = _T("/tmp/genpatXXXXXX");
|
||||
|
||||
mode_t old_umask = umask(0077);
|
||||
|
||||
int fd = mkstemp(t);
|
||||
if (fd == -1) {
|
||||
cerr << "Cannot create temporary filename";
|
||||
return "";
|
||||
terr << _T("Cannot create temporary filename");
|
||||
return _T("");
|
||||
}
|
||||
close(fd);
|
||||
|
||||
umask(old_umask);
|
||||
|
||||
return string(t);
|
||||
return tstring(t);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue