Win64 fixes

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6413 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2013-09-06 23:48:59 +00:00
parent e23b3db418
commit e63fa6c53b
38 changed files with 389 additions and 331 deletions

View file

@ -46,7 +46,7 @@ void NSISCALL pushstring(const TCHAR *str)
*g_stacktop=th;
}
TCHAR * NSISCALL getuservariable(const int varnum)
TCHAR* NSISCALL getuservariable(const int varnum)
{
if (varnum < 0 || varnum >= __INST_LAST) return NULL;
return g_variables+varnum*g_stringsize;
@ -159,9 +159,9 @@ void NSISCALL SetUserVariableW(const int varnum, const wchar_t* wideStr)
// playing with integers
int NSISCALL myatoi(const TCHAR *s)
INT_PTR NSISCALL nsishelper_str_to_ptr(const TCHAR *s)
{
int v=0;
INT_PTR v=0;
if (*s == _T('0') && (s[1] == _T('x') || s[1] == _T('X')))
{
s++;
@ -204,7 +204,7 @@ int NSISCALL myatoi(const TCHAR *s)
return v;
}
unsigned NSISCALL myatou(const TCHAR *s)
unsigned int NSISCALL myatou(const TCHAR *s)
{
unsigned int v=0;
@ -270,13 +270,12 @@ int NSISCALL myatoi_or(const TCHAR *s)
return v;
}
int NSISCALL popint()
INT_PTR NSISCALL popintptr()
{
TCHAR buf[128];
if (popstringn(buf,COUNTOF(buf)))
return 0;
return myatoi(buf);
return nsishelper_str_to_ptr(buf);
}
int NSISCALL popint_or()
@ -284,13 +283,12 @@ int NSISCALL popint_or()
TCHAR buf[128];
if (popstringn(buf,COUNTOF(buf)))
return 0;
return myatoi_or(buf);
}
void NSISCALL pushint(int value)
void NSISCALL pushintptr(INT_PTR value)
{
TCHAR buffer[1024];
wsprintf(buffer, _T("%d"), value);
TCHAR buffer[30];
wsprintf(buffer, sizeof(void*) > 4 ? _T("%Id") : _T("%d"), value);
pushstring(buffer);
}

View file

@ -56,16 +56,19 @@ extern unsigned int g_stringsize;
extern stack_t **g_stacktop;
extern TCHAR *g_variables;
void NSISCALL pushstring(const TCHAR *str);
void NSISCALL pushintptr(INT_PTR value);
#define pushint(v) pushintptr((INT_PTR)(v))
int NSISCALL popstring(TCHAR *str); // 0 on success, 1 on empty stack
int NSISCALL popstringn(TCHAR *str, int maxlen); // with length limit, pass 0 for g_stringsize
int NSISCALL popint(); // pops an integer
INT_PTR NSISCALL popintptr();
#define popint() ( (int) popintptr() )
int NSISCALL popint_or(); // with support for or'ing (2|4|8)
int NSISCALL myatoi(const TCHAR *s); // converts a string to an integer
unsigned NSISCALL myatou(const TCHAR *s); // converts a string to an unsigned integer, decimal only
INT_PTR NSISCALL nsishelper_str_to_ptr(const TCHAR *s);
#define myatoi(s) ( (int) nsishelper_str_to_ptr(s) ) // converts a string to an integer
unsigned int NSISCALL myatou(const TCHAR *s); // converts a string to an unsigned integer, decimal only
int NSISCALL myatoi_or(const TCHAR *s); // with support for or'ing (2|4|8)
void NSISCALL pushstring(const TCHAR *str);
void NSISCALL pushint(int value);
TCHAR * NSISCALL getuservariable(const int varnum);
TCHAR* NSISCALL getuservariable(const int varnum);
void NSISCALL setuservariable(const int varnum, const TCHAR *var);
#ifdef _UNICODE