Go Back   EQEmulator Home > EQEmulator Forums > Archives > Archive::Support > Archive::Linux Servers

Archive::Linux Servers Archive area for Linux Servers's posts that were moved here after an inactivity period of 90 days.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 03-13-2002, 05:09 PM
theCoder
Sarnak
 
Join Date: Jan 2002
Posts: 90
Default

I don't know if this is the problem, but the implementation of strreplace contains a local static char array newstringza (OT: what's with all the za's all over the code?), which it fills with the new constructed string. At the end, it returns this array as a char*. I don't remember all the intricacies of C++, but I think this may be a problem (I'll write a quick program to see). A quick fix would be to change the last line (line 92) from:

return newstringza;

to:

return strdup(newstringza);

which allocates a buffer the correct size, copies the string to the buffer, and returns a pointer to the buffer.

Or, you could try moving the declaration of the char[] outside the function (just before it should work).

It's probably not a good idea to return a pointer to a local variable in any case. Anyone with more extensive C++ experience want to comment (I've been doing Java too long...).
Reply With Quote
 


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 07:02 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3