fixed bug #2067946 - GetParameters returns an incorrect result in some situation.
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@5748 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
d0008e0493
commit
6577ff4f14
1 changed files with 38 additions and 20 deletions
|
@ -1410,33 +1410,51 @@ RefreshShellIcons
|
||||||
!define ${_FILEFUNC_UN}GetParameters `!insertmacro ${_FILEFUNC_UN}GetParametersCall`
|
!define ${_FILEFUNC_UN}GetParameters `!insertmacro ${_FILEFUNC_UN}GetParametersCall`
|
||||||
|
|
||||||
Function ${_FILEFUNC_UN}GetParameters
|
Function ${_FILEFUNC_UN}GetParameters
|
||||||
Push $0
|
;cmdline-check
|
||||||
Push $1
|
StrCmp $CMDLINE "" 0 +3
|
||||||
Push $2
|
Push ""
|
||||||
|
Return
|
||||||
|
|
||||||
StrCpy $1 1
|
;vars
|
||||||
StrCpy $0 $CMDLINE 1
|
Push $0 ;tmp
|
||||||
StrCmp $0 '"' 0 +3
|
Push $1 ;length
|
||||||
StrCpy $2 '"'
|
Push $2 ;parameter offset
|
||||||
goto +2
|
Push $3 ;separator
|
||||||
StrCpy $2 ' '
|
|
||||||
|
|
||||||
IntOp $1 $1 + 1
|
;length/offset
|
||||||
StrCpy $0 $CMDLINE 1 $1
|
StrLen $1 $CMDLINE
|
||||||
StrCmp $0 $2 +2
|
StrCpy $2 2 ;start with third character
|
||||||
StrCmp $0 '' end -3
|
|
||||||
|
|
||||||
IntOp $1 $1 + 1
|
;separator
|
||||||
StrCpy $0 $CMDLINE 1 $1
|
StrCpy $3 $CMDLINE 1 ;first character
|
||||||
StrCmp $0 ' ' -2
|
StrCmp $3 '"' +2
|
||||||
StrCpy $0 $CMDLINE '' $1
|
StrCpy $3 ' '
|
||||||
|
|
||||||
|
token: ;finding second separator
|
||||||
|
IntCmp $2 $1 strip 0 strip
|
||||||
|
StrCpy $0 $CMDLINE 1 $2
|
||||||
|
IntOp $2 $2 + 1
|
||||||
|
StrCmp $3 $0 0 token
|
||||||
|
|
||||||
|
strip: ;strip white space
|
||||||
|
IntCmp $2 $1 copy 0 copy
|
||||||
|
StrCpy $0 $CMDLINE 1 $2
|
||||||
|
StrCmp $0 ' ' 0 copy
|
||||||
|
IntOp $2 $2 + 1
|
||||||
|
Goto strip
|
||||||
|
|
||||||
|
copy:
|
||||||
|
StrCpy $0 $CMDLINE "" $2
|
||||||
|
|
||||||
|
;strip white spaces from end
|
||||||
|
rstrip:
|
||||||
StrCpy $1 $0 1 -1
|
StrCpy $1 $0 1 -1
|
||||||
StrCmp $1 ' ' 0 +3
|
StrCmp $1 ' ' 0 done
|
||||||
StrCpy $0 $0 -1
|
StrCpy $0 $0 -1
|
||||||
goto -3
|
Goto rstrip
|
||||||
|
|
||||||
end:
|
done:
|
||||||
|
Pop $3
|
||||||
Pop $2
|
Pop $2
|
||||||
Pop $1
|
Pop $1
|
||||||
Exch $0
|
Exch $0
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue