SA-MP Forums Archive
[Include] dini2.inc - Improved dini file processor with amazing benchmarks (aka. gini)! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] dini2.inc - Improved dini file processor with amazing benchmarks (aka. gini)! (/showthread.php?tid=611399)

Pages: 1 2 3 4 5 6 7


Re: dini2.inc - Improved dini file processor with amazing benchmarks (aka. gini)! - JokeyL - 12.01.2017

Ok, TY.


Re: dini2.inc - Improved dini file processor with amazing benchmarks (aka. gini)! - czop1223 - 14.01.2017

[14/01/2017 04:44:57] [debug] #0 00016c58 in INI_OpenFileInstance (file[]=@04a581b0 "Others/race_0.ini") at F:\Pawno\include\dini.inc:103
[14/01/2017 04:44:57] [debug] #1 000174b8 in dini_Get (file[]=@04a581b0 "Others/race_0.ini", field[]=@037baf10 "Created") at F:\Pawno\include\dini.inc:171
[14/01/2017 04:44:57] [debug] #2 000176cc in dini_Int (file[]=@04a581b0 "Others/race_0.ini", field[]=@037baf10 "Created") at F:\Pawno\include\dini.inc:193
[14/01/2017 04:44:57] [debug] #3 000cd9ac in LoadRace () at E:\srv\gamemodes\a.pwn:4778


Re: dini2.inc - Improved dini file processor with amazing benchmarks (aka. gini)! - JokeyL - 14.01.2017

IDK what's going on. Gammix create a script with code:

dini_Int
dini_IntSet
dini_Unset
dini_IntSet

And it's totally bugged, no changes in file.


Re: dini2.inc - Improved dini file processor with amazing benchmarks (aka. gini)! - Gammix - 16.01.2017

Are you using v2.4.2?
Cause that problem was fixed in v.2.4.2 already!


Re: dini2.inc - Improved dini file processor with amazing benchmarks (aka. gini)! - Romz - 16.01.2017

Quote:
Originally Posted by Gammix
Посмотреть сообщение
Update v2.4.2:
- Fixed file timeout issue, array wasn't adjusted properly resulting "array index out of bounds" error.
Version 2.4.2 already was. Maybe you want to say 2.4.3?


Re: dini2.inc - Improved dini file processor with amazing benchmarks (aka. gini)! - Gammix - 16.01.2017

Quote:
Originally Posted by Kolstin
Посмотреть сообщение
Version 2.4.2 already was. Maybe you want to say 2.4.3?
No i actually didn't realized v2.4.2 had already been out. I mean my SAMP folder was having 2.4.1 so i looked into it and found some flaws and updated to new 2.4.2 but then i realized i already had done this on github directly.

So, is this bug still there in v2.4.2 ?


Re: dini2.inc - Improved dini file processor with amazing benchmarks (aka. gini)! - JokeyL - 16.01.2017

Quote:
Originally Posted by Gammix
Посмотреть сообщение
Are you using v2.4.2?
Cause that problem was fixed in v.2.4.2 already!
Yes bro. It's really bugged. You can test it...


Re: dini2.inc - Improved dini file processor with amazing benchmarks (aka. gini)! - JokeyL - 20.01.2017

Код:
#include <a_samp>
#include <gini>
#include <zcmd>

CMD:mycommand(playerid, param[])
{
	dini_Create("test.ini");
	
	dini_Set("test.ini", "Set1", "Set");
	dini_IntSet("test.ini", "Set2", 1);
	dini_Set("test.ini", "Set3", "Sett");
	return 1;
}

CMD:mycommand2(playerid, param[])
{
	dini_IntSet("test.ini", "Set2", 0);
	dini_IntSet("test.ini", "Set1", 1);
	
	dini_UnSet("test.ini", "Set2");
	dini_UnSet("test.ini", "Set3");
	
	dini_IntSet("test.ini", "Set5", 1);
	return 1;
}
and dini_Unset work incorrect


Re: dini2.inc - Improved dini file processor with amazing benchmarks (aka. gini)! - Gammix - 22.01.2017

Update v2.4.3:
- Fixed file array shifting which was causing trouble in saving files present on second index. Now all Set, Get and UnSet functions will be effective!


Re: dini2.inc - Improved dini file processor with amazing benchmarks (aka. gini)! - Lordzy - 22.01.2017

I just ran through your include and noted few things that has to be changed:

- You shouldn't consider using format to copy strings, use memcpy or strcat instead.
- INI_StripLine isn't defined in your include.


Re: dini2.inc - Improved dini file processor with amazing benchmarks (aka. gini)! - Gammix - 22.01.2017

Quote:
Originally Posted by Lordzy
View Post
I just ran through your include and noted few things that has to be changed:

- You shouldn't consider using format to copy strings, use memcpy or strcat instead.
- INI_StripLine isn't defined in your include.
1. I have witnessed that using strcat sometimes makes the destination string empty for some reason. And that causes alot of trouble.

2. Its there but not in form of a function, but inside one:
PHP Code:
if (string[len 2] == '\r')
{
        
string[len 2] = EOS;
}
else if (
string[len 1] == '\n')
{
        
string[len 1] = EOS;




Re: dini2.inc - Improved dini file processor with amazing benchmarks (aka. gini)! - Lordzy - 22.01.2017

Quote:
Originally Posted by Gammix
View Post
1. I have witnessed that using strcat sometimes makes the destination string empty for some reason. And that causes alot of trouble.
That's strange because it wouldn't happen unless the string size is wrong.

Quote:
Originally Posted by Gammix
View Post
2. Its there but not in form of a function, but inside one:
PHP Code:
if (string[len 2] == '\r')
{
        
string[len 2] = EOS;
}
else if (
string[len 1] == '\n')
{
        
string[len 1] = EOS;

I'm talking about your stock function:
Code:
stock DINI_fcopytextfile(const file[], const newfile[])
{
	new File:handles[2];

	handles[0] = fopen(file, io_read);
	if (!handles[0])
	{
		return 0;
	}

	handles[1] = fopen(newfile, io_write);
	if (!handles[1])
	{
		fclose(handles[0]);
		return 0;
	}

	new data[INI_MAX_FIELD_NAME + INI_MAX_FIELD_VALUE];
	while (fread(handles[0], data))
	{
		INI_StripLine(data);
		strcat(data, "\r\n");
		fwrite(handles[1], data);
	}

	fclose(handles[0]);
	fclose(handles[1]);
	return 1;
}



Re: dini2.inc - Improved dini file processor with amazing benchmarks (aka. gini)! - JokeyL - 22.01.2017

Now all working fine, but in console i get : [dini2] - Error: File name not specified while opening file.

But saving/reading done correctly, lol.


Re: dini2.inc - Improved dini file processor with amazing benchmarks (aka. gini)! - Gammix - 22.01.2017

Quote:
Originally Posted by JokeyL
View Post
Now all working fine, but in console i get : [dini2] - Error: File name not specified while opening file.

But saving/reading done correctly, lol.
Its when you are trying to use dini function on any empty file name like:
PHP Code:
dini_Get("""field"); 



Re: dini2.inc - Improved dini file processor with amazing benchmarks (aka. gini)! - JokeyL - 23.01.2017

Gammix my server was crashed after 2 hours.

Crashdetect:

[debug] #0 0000102c in public OnFileTimeout (2) from teamDM.amx
[debug] Run time error 4: "Array index out of bounds"

What's going on?


Re: dini2.inc - Improved dini file processor with amazing benchmarks (aka. gini)! - OneDay - 19.05.2017

I saw that but was only 10 fields. I have many more. It will scale?


Re: dini2.inc - Improved dini file processor with amazing benchmarks (aka. gini)! - Gammix - 19.05.2017

Quote:
Originally Posted by OneDay
Посмотреть сообщение
I saw that but was only 10 fields. I have many more. It will scale?
Well you can test it out yourself using the benchmark code in the main post.

Be sure you increase the value of DINI_MAX_FIELDS accordingly.


Re: dini2.inc - Improved dini file processor with amazing benchmarks (aka. gini)! - JokeyL - 23.05.2017

Bug with double value saving is still available, please do check it.


Re: dini2.inc - Improved dini file processor with amazing benchmarks (aka. gini)! - asri - 26.05.2017

sorry im nubis scripter.i want to no can createdynamicobject save with dini or anything that can save thing


Re: dini2.inc - Improved dini file processor with amazing benchmarks (aka. gini)! - iLearner - 07.06.2017

Can you add ignore case in dini_exists?