string.format() patch2 + bugfix

Made a small change or new addition to the POL Core that makes a difference? You can post the changes here in .patch or .diff file format, for our Dev team to screen and apply to the SVN!

Moderator: POL Developer

Locked
User avatar
andenixa
Grandmaster Poster
Posts: 105
Joined: Tue Nov 09, 2010 1:33 am

string.format() patch2 + bugfix

Post by andenixa » Fri Jun 26, 2015 5:21 am

* Now actually faster than string concatenation in eScript
* Fixes a bug where {:d} formating could cause an arbitrary number shown instead of a real value
* tag errors are slightly more intuitive and compact.
Attachments
String_format_patch_26_jun_2014.patch
(11.92 KiB) Downloaded 27 times

Turley
POL Developer
Posts: 644
Joined: Sun Feb 05, 2006 4:45 am

Re: string.format() patch2 + bugfix

Post by Turley » Sat Jul 11, 2015 4:01 am

THX for your contribution.
But your position variables are not compatible with 64bit. Since you declare them as unsigned int which is to small on 64bit systems to compare against string::npos. You should use size_t that works on every platform.
By the way do you know boost::string_ref? That would remove all the temporary string copies and speed it up further.

User avatar
andenixa
Grandmaster Poster
Posts: 105
Joined: Tue Nov 09, 2010 1:33 am

Re: string.format() patch2 + bugfix

Post by andenixa » Sun Jul 19, 2015 4:01 am

Not much into BOOST yet, but I study it.
The thing is that you have to incorporate the patch somehow.
The previous version has a bug.

I shall use your suggestion about size_t for the next submissions.
I don't even have 64bit version thus these things happen.

Locked