[Include] dini2.inc - Improved dini file processor with amazing benchmarks (aka. gini)!
#61

Ok, TY.
Reply
#62

[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
Reply
#63

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.
Reply
#64

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

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?
Reply
#66

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 ?
Reply
#67

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...
Reply
#68

Код:
#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
Reply
#69

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!
Reply
#70

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.
Reply
#71

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;

Reply
#72

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;
}
Reply
#73

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

But saving/reading done correctly, lol.
Reply
#74

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"); 
Reply
#75

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?
Reply
#76

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

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.
Reply
#78

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

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

Can you add ignore case in dini_exists?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)