Additional error checking by Jim Park.

Also some cleaning.

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6058 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
wizou 2010-04-15 12:11:06 +00:00
parent e438c2092b
commit cefeec3676
6 changed files with 11 additions and 18 deletions

View file

@ -123,7 +123,7 @@ makensis_env.Append(CCFLAGS = ['/Fa${TARGET}.lst']) # listing file name
makensis_env.Append(LINKFLAGS = ['/opt:nowin98']) # 512 bytes align
makensis_env.Append(LINKFLAGS = ['$MAP_FLAG']) # generate map file
if defenv['UNICODE']:
makensis_env.Append(LINKFLAGS = ['/stack:2097152']) # need 2 MB of stack in Unicode (default is 1 MB)
makensis_env.Append(LINKFLAGS = ['/STACK:2097152']) # need 2 MB of stack in Unicode (default is 1 MB)
### plugin environment

View file

@ -114,11 +114,6 @@ CResourceVersionInfo::~CResourceVersionInfo()
}
void CResourceVersionInfo::SetFileFlags(int Value)
{
m_FixedInfo.dwFileFlags = (m_FixedInfo.dwFileFlags & ~(m_FixedInfo.dwFileFlagsMask)) || Value;
}
void CResourceVersionInfo::SetFileVersion(int HighPart, int LowPart)
{
m_FixedInfo.dwFileVersionLS = LowPart;

View file

@ -84,14 +84,6 @@ public:
virtual ~CResourceVersionInfo();
int SetKeyValue(LANGID lang_id, int codepage, TCHAR* AKeyName, TCHAR* AValue);
/**
* Sets the file flags into the VS_FIXEDFILEINFO structure for this object.
* Only what's set as valid in the dwFileFlagsMask is allowed to be set.
* Currently, this API is never used and unless dwFileFlagsMask is set,
* should never be used.
*/
void SetFileFlags(int Value);
/**
* Set the file version.
*/

View file

@ -194,14 +194,14 @@ void LangStringList::set(int pos, int index/*=-1*/, int uindex/*=-1*/, int proce
void LangStringList::set(const TCHAR *name, int index, int uindex/*=-1*/, int process/*=-1*/)
{
set(get(name), index, uindex, process);
set(find(name), index, uindex, process);
}
const TCHAR* LangStringList::pos2name(int pos)
{
struct langstring *data=(struct langstring *) m_gr.get();
if ((unsigned int)pos > (m_gr.getlen() / sizeof(struct langstring)))
if (pos < 0 || (unsigned int)pos > (m_gr.getlen() / sizeof(struct langstring)))
return 0;
return ((const TCHAR*) m_strings.get() + data[pos].name);
@ -209,7 +209,7 @@ const TCHAR* LangStringList::pos2name(int pos)
const TCHAR* LangStringList::offset2name(int name)
{
if ((unsigned int)name > m_strings.getlen()/sizeof(TCHAR))
if (name < 0 || (unsigned int)name > m_strings.getlen()/sizeof(TCHAR))
return 0;
return (const TCHAR*) m_strings.get() + name;
@ -291,7 +291,7 @@ int StringsArray::set(int idx, const TCHAR *str)
const TCHAR* StringsArray::get(int idx)
{
if ((unsigned int)idx >= (m_offsets.getlen() / sizeof(int)))
if (idx < 0 || (unsigned int)idx >= (m_offsets.getlen() / sizeof(int)))
return 0;
return (const TCHAR *) m_strings.get() + ((int*) m_offsets.get())[idx];

View file

@ -5892,6 +5892,11 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
build_overwrite=1; // off
int old_build_datesave=build_datesave;
build_datesave=0; // off
// Jim Park: While the code looks as if the same DLL is added multiple
// times for each command in the DLL, this is actually not the case
// because of CEXEBuild::datablock_optimize() that tries to discover
// duplicates and reuse them.
ret=do_add_file(dllPath.c_str(),0,0,&files_added,tempDLL,2,&data_handle); // 2 means no size add
if (ret != PS_OK) {
return ret;

View file

@ -109,6 +109,7 @@ class UserVarsStringList : public SortedStringListND<struct uservarstring>
int inc_reference(int idx)
{
int pos=get_internal_idx(idx);
if (pos==-1) return -1;
return ((struct uservarstring*) m_gr.get())[pos].reference++;
}