Bug 4070 - Bug in implementation of native function strfind
Bug in implementation of native function strfind
Status: RESOLVED FIXED
Product: AMX Mod X
Classification: Unclassified
Component: Core
trunk
PC All
: P3 normal
Assigned To: amxmodx-bugs@alliedmods.net
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-10-27 09:23 PDT by Lev2001
Modified: 2014-02-08 23:51 PST (History)
4 users (show)

See Also:
dvander: blocking‑1.8.2+


Attachments
Proposed patch (176 bytes, patch)
2009-10-27 09:23 PDT, Lev2001
no flags Details | Diff | Splinter Review
Proposed patch 2 (472 bytes, patch)
2009-10-27 17:08 PDT, Lev2001
dvander: review+
Details | Diff | Splinter Review
Corrected proposed path (320 bytes, patch)
2010-12-22 12:06 PST, Vincent Herbet [:Arkshine]
no flags Details | Diff | Splinter Review

Description Lev2001 2009-10-27 09:23:13 PDT
Created attachment 1768 [details] [review]
Proposed patch

As per documentaion:
"
Syntax:
     strfind ( const string[], const sub[], ignorecase=0, pos=0 ) 
"
there is parameter "pos". Which mean, I hope, that searching should start not from first char but from specified position.
But this doesn't work, i.e. searching is always starts from 0.

Proposed patch is attached. I doesn't check it by compilation, so testing is recommended.
Comment 1 David Anderson [:dvander] 2009-10-27 14:26:40 PDT
What are you using to generate diffs, out of curiosity? There is no context in the patch so it doesn't apply.
Comment 2 Lev2001 2009-10-27 14:56:47 PDT
I used ExamDiff Pro to compare files. It has feature to generate unix diff file.
To generate diff with context I think I have to chekout amxx from svn.
But I doesn't know where it is.
So I simply use archived sources.
Comment 3 Lev2001 2009-10-27 14:58:21 PDT
Or give me an example of patch with context and I will add context to mine patches by hands.
Comment 4 David Anderson [:dvander] 2009-10-27 16:15:15 PDT
Use an SVN client - our URL is svn://svn.alliedmods.net/svnroot/amxmodx/trunk

From the command line: svn checkout svn://svn.alliedmods.net/svnroot/amxmodx/trunk amxmodx

You can use the "svn diff" command to generate patches.

There are also GUI svn clients if you don't like using command lines.
Comment 5 Lev2001 2009-10-27 17:08:01 PDT
Created attachment 1769 [details] [review]
Proposed patch 2

Is this file format is good for you?
Comment 6 David Anderson [:dvander] 2009-10-27 17:08:54 PDT
Comment on attachment 1769 [details] [review]
Proposed patch 2

Much better, thanks!
Comment 7 Reuben Morais 2010-12-20 11:22:54 PST
This one needs checkin.
Comment 8 Vincent Herbet [:Arkshine] 2010-12-22 12:06:49 PST
Created attachment 2487 [details] [review]
Corrected proposed path


The previous patch is not entirely correct. 
This patch fix it by removing the change in the "return".

Compiled and tested successfully.

Here a small plugin used to test and to confirm it works as expected : http://pastebin.com/D05KCv7h
Comment 9 David Anderson [:dvander] 2013-02-13 00:56:15 PST
Given a quick analysis of plugins on the forums, it looks like this will not introduce any binary or source compatibility problems. Will take for 1.8.2. Thanks for the patch!
Comment 10 Vincent Herbet [:Arkshine] 2013-02-13 00:56:23 PST
Pushed changeset: http://hg.alliedmods.net/amxmodx-central/rev/5bdea6a3364d
Changelog:
	Fix strfind ignoring its last parameter (bug 4070, r=dvander).
Comment 11 AM Bugzilla Bot 2014-02-08 23:51:43 PST
Commit pushed to master at https://github.com/alliedmodders/amxmodx

https://github.com/alliedmodders/amxmodx/commit/8793d8f8d5b9cd7b311f7a4362bc18acbdb8e369
Fix strfind ignoring its last parameter (bug 4070, r=dvander).


Former-commit-id: a31621dd0c08c7bbede41a06d0ebf8abab1b66a5

Note You need to log in before you can comment on or make changes to this bug.