Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (degenerate_762, AbrahamR, AndrewAMD, ozgur), 667 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
what can make str_cmpi crash? #252934
02/21/09 15:04
02/21/09 15:04
Joined: Jan 2007
Posts: 1,619
Germany
Scorpion Offline OP
Serious User
Scorpion  Offline OP
Serious User

Joined: Jan 2007
Posts: 1,619
Germany
hello,
I am trying to read out strings from a file, check if they are a valid keywords and if so call a function or set a variable etc.. In most the cases the functions get called as expected, but sometimes the engine crashes in the function, which compares the strings.

After some debugging i found out, that the engine crashes at the str_cmpii function. So I checked if the strings are valid by outputting them with diag(). Both strings were correct, but the engine still crashed at that function.

As far as I could observe it, the crash isn't caused by a special string, but if the file size exceeds a limit.

So my question is what factors can cause this crash else, if both passed strings are 'valid'?

Code:
diag(string1); //give correct output
diag(string2); //works, too
if(str_cmpi(string1,string2)){//Crash!
    [...]
}


Re: what can make str_cmpi crash? [Re: Scorpion] #252944
02/21/09 17:26
02/21/09 17:26
Joined: Dec 2006
Posts: 1,086
Queensland - Australia
Nidhogg Offline
Serious User
Nidhogg  Offline
Serious User

Joined: Dec 2006
Posts: 1,086
Queensland - Australia
I think a had the same problem a while ago and it was fixed in an updated
version of GS. If that's not the problem then maybe try adding a bool to it
eg: if(str_cmpi(string1,string2) == 0)

From the manual
These functions return TRUE if the strings are equal. This is different to C / C++ where similar functions return FALSE when the strings are equal.

Good luck.


Windows XP SP3
Intel Dual Core CPU: E5200 @ 2.5GHz
4.00GB DDR3 Ram
ASUS P5G41T-M LX
PCIE x16 GeForce GTS 450 1Gb
SB Audigy 4
Spyware Doctor with AntiVirus
Re: what can make str_cmpi crash? [Re: Nidhogg] #253212
02/23/09 15:17
02/23/09 15:17
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
A user - maybe it was you? - already reported a crash of str_cmpi some time ago and we thoroughly checked that function on that occasion. So I'm pretty sure that str_cmpi is flawless. However it may have something to do with the rest of your project.

For instance, when internal memory is overwritten over the end of a STRING struct, then functions like str_cmpi can indeed crash. Overwriting internal memory can happen, for instance, by loading a file with faulty content.

Re: what can make str_cmpi crash? [Re: jcl] #253368
02/24/09 12:10
02/24/09 12:10
Joined: Oct 2002
Posts: 806
Zapan@work Offline
User
Zapan@work  Offline
User

Joined: Oct 2002
Posts: 806
We had also problems with some other str_* functions in one of our bigger projects. We've increased the nexus and everything works fine...

Re: what can make str_cmpi crash? [Re: jcl] #253369
02/24/09 12:10
02/24/09 12:10
Joined: Jan 2007
Posts: 1,619
Germany
Scorpion Offline OP
Serious User
Scorpion  Offline OP
Serious User

Joined: Jan 2007
Posts: 1,619
Germany
I am pretty sure there are no files with faulty content, but I'll check the malloc/free calls and my array indexing etc again...

Re: what can make str_cmpi crash? [Re: Scorpion] #253371
02/24/09 12:37
02/24/09 12:37
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
Zapan: When string functions crash depending on random conditions, such as the size of the nexus, then internal memory is most likely overwritten. It can be a bug in the script, or a damaged file with wrong internal pointers. This project will behave unstable.

Generally, if something bad happens in a project, increasing the memory in the hope that it will then crash less often is the wrong strategy. Better try the opposite, establish some worst case condition where is always crashes. This way you'll find the reason more easily by temporarily eliminating parts of your code.

Re: what can make str_cmpi crash? [Re: jcl] #253517
02/25/09 06:52
02/25/09 06:52
Joined: Dec 2007
Posts: 706
Schortens Germany
Landixus Offline
User
Landixus  Offline
User

Joined: Dec 2007
Posts: 706
Schortens Germany
The Problem is solved.
Scorpion bekommt jetzt 3 Tage keine Schokolade.

Der Fehler ist zu peinlich um Ihn zu beschreiben.


My Blog German: http://blog.quakeit.de/
www.quakeit.de ||
Airfix Game in Cooperation with:
www.3drt.com
Models Levels and Textures
Re: what can make str_cmpi crash? [Re: Landixus] #253565
02/25/09 14:02
02/25/09 14:02
Joined: Jan 2007
Posts: 1,619
Germany
Scorpion Offline OP
Serious User
Scorpion  Offline OP
Serious User

Joined: Jan 2007
Posts: 1,619
Germany
-.- bist du wieder nett
Es lag an einem array, dem falsche werte zugewiesen wurden.


Moderated by  old_bill, Tobias 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1