[Include] [INC] Xini v2 - Edit INI files
#5

[red]Useless[/red]
pawn Code:
xini_remove(filename[])
{
  if(!fexist(filename)) return false;
  fremove(filename);
  return true;
}
[blue]native bool:fremove(const name[]);[/blue] fails if the file doesn't exist.
Basically this does exactly the same as fremove (not thinking about uselessly called fexist...).

[red]Uneffective, bad managed code[/red]
pawn Code:
new File:file, File:file2, line[MAX_STRING], key2[MAX_STRING], header2[MAX_STRING], filename2[MAX_STRING], tmp[MAX_STRING];
  format(filename2,MAX_STRING,"%s.xini",filename);
  if((file = fopen(filename,io_read)) && (file2 = fopen(filename2,io_write)))
[blue]MAX_STRING = 255[/blue] => you allocate 1275 bytes of memory (what is really a lot for a such simple function) even before checking if the file exists...
Seriously, first learn how to write effective code and JUST then release something.

[red]Doesn't allow you to choose file name[/red]
pawn Code:
format(filename2,MAX_STRING,"%s.xini",filename);
Because it always appends .xini to end of the file name.

[red]Bad written include[/red]
pawn Code:
native xini_get(filename[],header[],key[],bool:ignorecase=true);
native xini_set(filename[],header[],key[],value[],bool:ignorecase=true);
native xini_iskeyset(filename[],header[],key[],bool:ignorecase=true);
native xini_isheaderset(filename[],header[],bool:ignorecase=true);
native xini_setint(filename[],header[],key[],value,bool:ignorecase=true);
native xini_int(filename[],header[],key[],bool:ignorecase=true);
native xini_setfloat(filename[],header[],key[],Float:value,bool:ignorecase=true);
native Float:xini_float(filename[],header[],key[],bool:ignorecase=true);
native xini_create(filename[]);
native xini_remove(filename[]);
native xini_truncreate(filename[]);
native xini_getstore(filename[],value[],refheader[],refkey[],offset=0,bool:ignorecase=true);
xini_set is [blue]bool[/blue], but native is withoud [blue]"bool"[/blue] -> [green]native xini_set(filename[],header[],key[],value[],bool:ignorecase=true);[/green] <- (the same problem with xini_iskeyset, xini_isheaderset, xini_setint, xini_setfloat, xini_getstore, xini_unsetheader)

These functions aren't [blue]stock[/blue]-ed, so compiler compiles entire include even if you don't use any of xini functions.

And also there is [red]"unnatived"[/red] function... so if you don't read entire include (because it is the last function in the include), you won't probably know about xini_unsetheader...

EDIT: Windows already contains similar functions: [green]GetPrivateProfileString WritePrivateProfileString[/green] -> perfect idea for a plugin.
Reply


Messages In This Thread
[INC] Xini v2 - Edit INI files - by boylett - 30.12.2008, 18:47
Re: [INC] Xini v2 - Edit INI files - by Kowalski - 30.12.2008, 20:32
Re: [INC] Xini v2 - Edit INI files - by Serbish - 30.12.2008, 20:38
Re: [INC] Xini v2 - Edit INI files - by Donuts - 30.12.2008, 21:41
Re: [INC] Xini v2 - Edit INI files - by Magor - 30.12.2008, 22:15
Re: [INC] Xini v2 - Edit INI files - by Magor - 30.12.2008, 22:22
Re: [INC] Xini v2 - Edit INI files - by boylett - 30.12.2008, 22:36
Re: [INC] Xini v2 - Edit INI files - by Serbish - 30.12.2008, 22:37
Re: [INC] Xini v2 - Edit INI files - by boylett - 30.12.2008, 22:40
Re: [INC] Xini v2 - Edit INI files - by Magor - 30.12.2008, 22:48
Re: [INC] Xini v2 - Edit INI files - by boylett - 30.12.2008, 22:51
Re: [INC] Xini v2 - Edit INI files - by ғαιιοцт - 02.01.2009, 10:42
Re: [INC] Xini v2 - Edit INI files - by boylett - 02.01.2009, 11:19
Re: [INC] Xini v2 - Edit INI files - by ғαιιοцт - 02.01.2009, 11:52
Re: [INC] Xini v2 - Edit INI files - by ғαιιοцт - 03.01.2009, 09:52
Re: [INC] Xini v2 - Edit INI files - by boylett - 03.01.2009, 10:00
Re: [INC] Xini v2 - Edit INI files - by ғαιιοцт - 03.01.2009, 10:01
Re: [INC] Xini v2 - Edit INI files - by boylett - 03.01.2009, 10:07
Re: [INC] Xini v2 - Edit INI files - by [DrM]spatrik - 13.07.2010, 09:18
Re: [INC] Xini v2 - Edit INI files - by Patchwerk - 17.07.2011, 19:36
Re: [INC] Xini v2 - Edit INI files - by Sasino97 - 17.07.2011, 21:15
Re: [INC] Xini v2 - Edit INI files - by CaHbKo - 17.07.2011, 21:26

Forum Jump:


Users browsing this thread: 3 Guest(s)