Skip to content
Snippets Groups Projects
Commit f5d35a1e authored by rswindell's avatar rswindell
Browse files

Increased INI_MAX_LINE_LEN from 256 to 2048 (MAX_VALUE_LEN*2).

NULL section arguments now specify "global" keys belonging to no specific
section (top-most portion of .ini file).
parent c3a6c0d0
No related branches found
No related tags found
No related merge requests found
......@@ -42,7 +42,8 @@
#include "filewrap.h" /* chsize */
#include "ini_file.h"
#define INI_MAX_LINE_LEN 256 /* Maximum length of entire line, includes '\0' */
/* Maximum length of entire line, includes '\0' */
#define INI_MAX_LINE_LEN (INI_MAX_VALUE_LEN*2)
#define NEW_SECTION ((char*)~0)
......@@ -85,6 +86,9 @@ static BOOL find_section(FILE* fp, const char* section)
rewind(fp);
if(section==NULL)
return(TRUE);
while(!feof(fp)) {
if(fgets(str,sizeof(str),fp)==NULL)
break;
......@@ -102,6 +106,9 @@ static size_t find_section_index(str_list_t list, const char* section)
char str[INI_MAX_VALUE_LEN];
size_t i;
if(section==NULL)
return(0);
for(i=0; list[i]!=NULL; i++) {
SAFECOPY(str,list[i]);
if((p=section_name(str))!=NULL && stricmp(p,section)==0)
......@@ -191,6 +198,9 @@ size_t iniAddSection(str_list_t* list, const char* section
char str[INI_MAX_LINE_LEN];
size_t i;
if(section==NULL)
return(0);
i=find_section_index(*list, section);
if((*list)[i]==NULL) {
if(style->section_separator!=NULL)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment