a little bit more TCHARs and minor fixes
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6042 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
acf9a8c21f
commit
f4f18f9469
7 changed files with 29 additions and 16 deletions
|
@ -1092,7 +1092,7 @@ FunctionEnd</pre>
|
|||
The pre function is called first and allows you to initalize variables or decide
|
||||
whether the page should be skipped. Then, the show function is called, which can
|
||||
be used to customize the interface. Finally, the user input can be validated in the
|
||||
leave function. The NSIS Users Manual provides more information about these functions.</p>
|
||||
leave function. The NSIS Users Manual provides more information about these functions.</p>
|
||||
<p>
|
||||
In the show function, the window handles of all controls on the page can be retrieved
|
||||
from a Modern UI variable. A list of the variables names is not yet available. For
|
||||
|
|
|
@ -223,6 +223,7 @@ defines_h.close()
|
|||
# write version into version.h
|
||||
f = open(defenv.File('#$BUILD_CONFIG/nsis-version.h').abspath, 'w')
|
||||
f.write('// This file is automatically generated by SCons\n// DO NOT EDIT THIS FILE\n')
|
||||
f.write('#include "tchar.h"\n')
|
||||
|
||||
if defenv.has_key('VER_MAJOR'):
|
||||
defenv['VERSION'] = defenv['VER_MAJOR']
|
||||
|
|
|
@ -490,7 +490,7 @@ int CEXEBuild::preprocess_string(TCHAR *out, const TCHAR *in, WORD codepage/*=CP
|
|||
{
|
||||
const TCHAR *np;
|
||||
#ifdef _UNICODE
|
||||
np = CharNext(p);
|
||||
np = CharNext(p);
|
||||
#else
|
||||
np = CharNextExA(codepage, p, 0);
|
||||
#endif
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "Platform.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "tchar.h"
|
||||
#include "build.h"
|
||||
#include "util.h"
|
||||
#include "DialogTemplate.h"
|
||||
|
@ -727,7 +728,7 @@ int CEXEBuild::GenerateLangTables() {
|
|||
#undef ADD_FONT
|
||||
}
|
||||
catch (exception& err) {
|
||||
ERROR_MSG(_T("\nError while applying font: %s\n"), err.what());
|
||||
ERROR_MSG(_T("\nError while applying font: %s\n"), CtoTString(err.what()));
|
||||
return PS_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -790,7 +791,7 @@ int CEXEBuild::GenerateLangTables() {
|
|||
#undef ADD_FONT
|
||||
}
|
||||
catch (exception& err) {
|
||||
ERROR_MSG(_T("\nError while applying NLF font/RTL: %s\n"), err.what());
|
||||
ERROR_MSG(_T("\nError while applying NLF font/RTL: %s\n"), CtoTString(err.what()));
|
||||
return PS_ERROR;
|
||||
}
|
||||
|
||||
|
@ -906,7 +907,7 @@ TCHAR SkipComments(FILE *f) {
|
|||
|
||||
// NSIS Language File parser
|
||||
LanguageTable * CEXEBuild::LoadLangFile(TCHAR *filename) {
|
||||
FILE *f = FOPEN(filename, _T("r"));
|
||||
FILE *f = FOPENTEXT(filename, _T("r"));
|
||||
if (!f) {
|
||||
ERROR_MSG(_T("Error: Can't open language file - \"%s\"!\n"),filename);
|
||||
return 0;
|
||||
|
@ -971,7 +972,7 @@ LanguageTable * CEXEBuild::LoadLangFile(TCHAR *filename) {
|
|||
}
|
||||
|
||||
// set ^Language
|
||||
nlf->m_szStrings[NLF_LANGUAGE] = strdup(nlf->m_szName);
|
||||
nlf->m_szStrings[NLF_LANGUAGE] = _tcsdup(nlf->m_szName);
|
||||
|
||||
int temp;
|
||||
|
||||
|
|
|
@ -2825,7 +2825,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
|||
if (s == 0)
|
||||
datebuf[0]=0;
|
||||
else
|
||||
datebuf[max(s,sizeof(datebuf)-1)]=0;
|
||||
datebuf[max(s,_countof(datebuf)-1)]=0;
|
||||
|
||||
value=datebuf;
|
||||
} else if (!_tcsicmp(define,_T("/file")) || !_tcsicmp(define,_T("/file_noerr"))) {
|
||||
|
@ -3139,7 +3139,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
|||
for (;;)
|
||||
{
|
||||
str[0]=0;
|
||||
fgets(str,sizeof(str),fp);
|
||||
_fgetts(str,_countof(str),fp);
|
||||
if (!str[0]) break; // eof
|
||||
|
||||
TCHAR *p=str;
|
||||
|
|
|
@ -300,7 +300,8 @@ class SortedStringListND // no delete - can be placed in GrowBuf
|
|||
int pos=find(name,-1,case_sensitive,1,&where);
|
||||
|
||||
if (pos==-1) return alwaysreturnpos ? where : -1;
|
||||
newstruct.name=strings.add(name,strlen(name)+1);
|
||||
|
||||
// Note that .name is set with the TCHAR* offset into m_strings.
newstruct.name=strings.add(name,strlen(name)+1);
|
||||
|
||||
gr.add(&newstruct,sizeof(T));
|
||||
T *s=(T*)gr.get();
|
||||
|
@ -357,6 +358,7 @@ class SortedStringListND // no delete - can be placed in GrowBuf
|
|||
int ll=0;
|
||||
int nextpos=(ul+ll)/2;
|
||||
|
||||
// Do binary search on m_gr which is sorted. m_strings is NOT sorted.
|
||||
while (ul > ll)
|
||||
{
|
||||
int res;
|
||||
|
@ -366,21 +368,32 @@ class SortedStringListND // no delete - can be placed in GrowBuf
|
|||
if (case_sensitive)
|
||||
res = _tcscmp(str, pCurr);
|
||||
else
|
||||
res = stricmp(str, pCurr);
|
||||
res = _tcsicmp(str, pCurr);
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned int pCurr_len = _tcslen(pCurr);
|
||||
if (case_sensitive)
|
||||
res=strncmp(str, pCurr, mymin((unsigned int) n_chars, strlen(pCurr)));
|
||||
res = _tcsncmp(str, pCurr, mymin((unsigned int) n_chars, pCurr_len));
|
||||
else
|
||||
res=strnicmp(str, pCurr, mymin((unsigned int) n_chars, strlen(pCurr)));
|
||||
if (res == 0 && n_chars != -1 && (unsigned int) n_chars != strlen(pCurr))
|
||||
res = n_chars - strlen(pCurr);
|
||||
res = _tcsncicmp(str, pCurr, mymin((unsigned int) n_chars, pCurr_len));
|
||||
|
||||
// If there is a match and we are looking for a partial match and
|
||||
// n_chars is NOT the length of the current string, then the
|
||||
// comparison result is determined by the length comparison.
|
||||
if (res == 0 && n_chars != -1 && (unsigned int) n_chars != pCurr_len)
|
||||
res = n_chars - pCurr_len;
|
||||
}
|
||||
|
||||
// Found!
|
||||
if (res==0)
|
||||
{
|
||||
// Return where we found it in *where.
|
||||
if (where) *where = nextpos;
|
||||
|
||||
// If returnbestpos, then we should return -1, otherwise where
|
||||
// we found it. But if (returnbestpos && case_sensitive == -1)
|
||||
// returns nextpos.
|
||||
return returnbestpos ? (case_sensitive!=-1 ? -1 : nextpos) : nextpos;
|
||||
}
|
||||
if (res<0) ul=nextpos;
|
||||
|
|
|
@ -21,8 +21,6 @@
|
|||
|
||||
#include "tchar.h"
|
||||
#include <string>
|
||||
//#include <windows.h>
|
||||
//#include <fstream>
|
||||
|
||||
/* Abstract string type as well. */
|
||||
#ifdef _UNICODE
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue