Archive: Stu's FileSearch have return values $1 and $2 swapped?


Stu's FileSearch have return values $1 and $2 swapped?
I needed something exactly like Stu's FileSearch, so I happily downloaded it from here:

http://nsis.sourceforge.net/Search_for_text_in_file
nsis.sourceforge.net/Search_for_text_in_file

And it works great! But... while the documentation for it says:

Pop $0 #Number of times found throughout
Pop $1 #Found at all? yes/no
Pop $2 #Number of lines found in
the function actually returns yes/no in $2 and the number of lines found in $1 (i.e. $1 and $2 are actually swapped).

Is this is a bug in the documentation, or a bug in the way I use it:
Push $R9 # path\name
Push "mysearchstring"
Call un.FileSearch
Pop $0 #Number of times found throughout
Pop $1 #Number of lines found in
Pop $2 #Found at all? yes/no

StrCmp $2 yes 0 LABEL_RETURNFROMCALLBACK
Delete $R9

LABEL_RETURNFROMCALLBACK:
Push $0
If this is a bug in my use of FileSearch, what could it be?

Thanks,
Victor

I'd call it a typo rather...
Just swap $1 and $2

Pop $0 #Number of times found throughout
Pop $1 #Number of lines found in
Pop $2 #Found at all? yes/no
No big deal I guess...

No, no big deal because, as I said, it works great if I just swap them. I just wanted to make sure that I am not working around a bug in my script instead of fixing it. Thanks.

Victor


I have re-written the function without the yes/no (no need for that because we can check the found/line count instead).

http://nsis.sourceforge.net/Search_for_text_in_file

Stu