From d74c5acdcd03b043a15f1bb8b47753ea113ffd33 Mon Sep 17 00:00:00 2001 From: anders_k Date: Mon, 7 Mar 2016 14:34:21 +0000 Subject: [PATCH] Incomplete support for Z (size_t) logiclib integer tests and other minor fixes git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6713 212acab6-be3b-0410-9dea-997c60f758d6 --- Contrib/Makensisw/makensisw.h | 2 +- Contrib/Makensisw/utils.cpp | 2 +- Contrib/NSISdl/httpget.cpp | 6 +++--- Contrib/NSISdl/nsisdl.cpp | 2 +- Include/LogicLib.nsh | 26 ++++++++++++++++++++++++-- 5 files changed, 30 insertions(+), 8 deletions(-) diff --git a/Contrib/Makensisw/makensisw.h b/Contrib/Makensisw/makensisw.h index cc014fea..d52d5b9b 100644 --- a/Contrib/Makensisw/makensisw.h +++ b/Contrib/Makensisw/makensisw.h @@ -123,7 +123,7 @@ const TCHAR *compressor_display_names[] = {_T("Defined in Script/Compiler Defaul _T("LZMA"), _T("LZMA (solid)"), _T("Best Compressor")}; -WORD compressor_commands[] = {IDM_COMPRESSOR_SCRIPT, +const WORD compressor_commands[] = {IDM_COMPRESSOR_SCRIPT, IDM_ZLIB, IDM_ZLIB_SOLID, IDM_BZIP2, diff --git a/Contrib/Makensisw/utils.cpp b/Contrib/Makensisw/utils.cpp index b0440822..e4a13574 100644 --- a/Contrib/Makensisw/utils.cpp +++ b/Contrib/Makensisw/utils.cpp @@ -635,7 +635,7 @@ void AddTip(HWND hWnd,LPCTSTR lpszToolTip) { ti.uFlags = TTF_IDISHWND; ti.hwnd = g_tip.tip_p; ti.uId = (UINT_PTR) hWnd; - ti.lpszText = (LPTSTR) lpszToolTip; + ti.lpszText = const_cast(lpszToolTip); SendMessage(g_tip.tip, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) &ti); } diff --git a/Contrib/NSISdl/httpget.cpp b/Contrib/NSISdl/httpget.cpp index e1debbd7..ceeb4f64 100644 --- a/Contrib/NSISdl/httpget.cpp +++ b/Contrib/NSISdl/httpget.cpp @@ -243,12 +243,12 @@ static int my_strnicmp(char *b1, const char *b2, int l) return 0; } -char *_strstr(char *i, const char *s) +char *_strstr(const char *i, const char *s) { if (strlen(i)>=strlen(s)) while (i[strlen(s)-1]) { int l=strlen(s)+1; - char *ii=i; + const char *ii=i; const char *is=s; while (--l>0) { @@ -256,7 +256,7 @@ char *_strstr(char *i, const char *s) ii++; is++; } - if (l==0) return i; + if (l==0) return const_cast(i); i++; } return NULL; diff --git a/Contrib/NSISdl/nsisdl.cpp b/Contrib/NSISdl/nsisdl.cpp index b322ecca..ec744bc9 100644 --- a/Contrib/NSISdl/nsisdl.cpp +++ b/Contrib/NSISdl/nsisdl.cpp @@ -226,7 +226,7 @@ void progress_callback(const char *msg, __int64 read_bytes) } } -extern char *_strstr(char *i, const char *s); +extern char *_strstr(const char *i, const char *s); #define strstr _strstr extern "C" diff --git a/Include/LogicLib.nsh b/Include/LogicLib.nsh index 8831fa9a..0646a385 100644 --- a/Include/LogicLib.nsh +++ b/Include/LogicLib.nsh @@ -54,6 +54,8 @@ ; a L= b; a L<> b; a L< b; a L>= b; a L> b; a L<= b ; ptrdiff_t integer tests ; a P= b; a P<> b; a P< b; a P>= b; a P> b; a P<= b +; size_t integer tests +; a Z= b; a Z<> b ; Built-in NSIS flag tests: ; ${Abort}; ${Errors}; ${RebootFlag}; ${Silent} ; Built-in NSIS other tests: @@ -253,9 +255,9 @@ !insertmacro _L> `${_a}` `${_b}` `${_f}` `${_t}` !macroend - ; ptrdiff_t tests + ; ptrdiff_t & size_t tests !macro LogicLib_PtrDiffTest _o _a _b _t _f - !if ${NSIS_PTR_SIZE} <= 4 + !if "${NSIS_PTR_SIZE}" <= 4 !insertmacro _${_o} `${_a}` `${_b}` `${_t}` `${_f}` !else !insertmacro _L${_o} `${_a}` `${_b}` `${_t}` `${_f}` @@ -279,6 +281,26 @@ !macro _P<= _a _b _t _f !insertmacro LogicLib_PtrDiffTest <= `${_a}` `${_b}` `${_t}` `${_f}` !macroend + !macro _Z= _a _b _t _f + !insertmacro LogicLib_PtrDiffTest = `${_a}` `${_b}` `${_t}` `${_f}` + !macroend + !macro _Z<> _a _b _t _f + !insertmacro LogicLib_PtrDiffTest <> `${_a}` `${_b}` `${_t}` `${_f}` + !macroend +!if "${NSIS_PTR_SIZE}" <= 4 ; BUGBUG: System::Int64Op does not support unsigned operations! + !macro _Z< _a _b _t _f + !insertmacro _U< `${_a}` `${_b}` `${_t}` `${_f}` + !macroend + !macro _Z>= _a _b _t _f + !insertmacro _U>= `${_a}` `${_b}` `${_t}` `${_f}` + !macroend + !macro _Z> _a _b _t _f + !insertmacro _U> `${_a}` `${_b}` `${_t}` `${_f}` + !macroend + !macro _Z<= _a _b _t _f + !insertmacro _U<= `${_a}` `${_b}` `${_t}` `${_f}` + !macroend +!endif ; Flag tests !macro _Abort _a _b _t _f