fixed "may be uninitialized" on linux systems
[NeonServV5.git] / src / lib / ini.c
index e0bd1af8281dd26a295120750df32586ab2138c2..b9e8f97ef99b11c624e5dd9d7a80b1c0f493e6bc 100644 (file)
@@ -124,7 +124,7 @@ void ReadString(char *SectionName,char *FieldName,char *FieldValue) {
 
 int loadINI(char *filename) {
     FILE *f;
-    int i, fpointer;
+    int i, fpointer = 0;
     char SectionName[SECTION_LEN], FieldName[FIELDNAME_LEN], FieldValue[FIELDVALUE_LEN], ch;
 
     f=fopen(filename,"rb");
@@ -150,10 +150,9 @@ int loadINI(char *filename) {
         removeSpace(SectionName);
         while(!feof(f)) {
             fread(&ch,sizeof(char),1,f);
-            if (ch == 0x0d)
+            if (ch == '\r' || ch == '\n')
                 break;
         }
-        fread(&ch,sizeof(char),1,f);
         if (SectionName[0] == '\0')
             continue; 
         while(!feof(f)) {
@@ -195,7 +194,6 @@ int loadINI(char *filename) {
                 }
             }
             removeSpace(FieldValue);
-            fread(&ch,sizeof(char),1,f);
             WriteString(SectionName,FieldName,FieldValue);
         }
     }