Raised This Month: $12 Target: $400
 3% 

[CORE] callfunc_push_str problem


  
 
 
Thread Tools Display Modes
Author Message
harbu
Senior Member
Join Date: Aug 2004
Location: Finland
Old 04-16-2005 , 19:25   [CORE] callfunc_push_str problem
#1

The callfunc_push_str seems to have a bug with returning the string back to when it has been edited in the function pointed out by callfunc_begin()

Example:

Main Plugin File
Code:
public bugff(id) {     new string[64]         if( callfunc_begin( "buggie", "other_plugin.amxx" ) )     {         callfunc_push_str( string )         callfunc_end( )     }     client_print( 0 , print_chat, "%s", string )     return PLUGIN_HANDLED }

The other_plugin.amxx file
Code:
public buggie( string[] ) {     format( string, 63, "OMG!!" ) }

Now when it returns the string it only returns the first character of the edited string.
__________________
harbu is offline
Send a message via MSN to harbu
BAILOPAN
Join Date: Jan 2004
Old 04-16-2005 , 20:14  
#2

It's not a bug. Notice that the function is prototyped as "const".

If you want a callfunc_push_strrf (push string reference), I'll ask PM whether it's possible (he made the callfunc natives).
__________________
egg
BAILOPAN is offline
Twilight Suzuka
bad
Join Date: Jul 2004
Location: CS lab
Old 04-17-2005 , 00:32  
#3

Strings were not passed by reference? I thought all strings in SMALL were passed by reference?
Thats why it wouldn't work then....
__________________
Twilight Suzuka is offline
Send a message via AIM to Twilight Suzuka Send a message via MSN to Twilight Suzuka
BAILOPAN
Join Date: Jan 2004
Old 04-17-2005 , 02:17  
#4

Strings are passed by reference, my example was misleading. The actual data in the string, however, is not handled by reference - it's copied into the heap.

There would need to be an optional second parameter called "copyback" which instructed callfunc_end to save the old address and copy the data into it.

PM's busy now so I won't bother him, I'll consider adding this myself for the next release.
__________________
egg
BAILOPAN is offline
harbu
Senior Member
Join Date: Aug 2004
Location: Finland
Old 04-17-2005 , 02:18  
#5

Quote:
Originally Posted by BAILOPAN
It's not a bug. Notice that the function is prototyped as "const".

If you want a callfunc_push_strrf (push string reference), I'll ask PM whether it's possible (he made the callfunc natives).
If this would be possible it would really rock..
__________________
harbu is offline
Send a message via MSN to harbu
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 04-17-2005 , 08:26  
#6

I will look into this!
__________________
hello, i am pm
PM is offline
BAILOPAN
Join Date: Jan 2004
Old 06-16-2005 , 15:47  
#7

I was unable to reproduce this and it seems the issue is resolved.
__________________
egg
BAILOPAN is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:55.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode