# HG changeset patch # User rubidium # Date 1219619530 0 # Node ID 7ce0cbe8575f42fa57d2d65b9c530ac442b4877a # Parent 87148ad75853ae4c2590b1a0bd94a35fe5af63a7 (svn r14161) -Codechange: allow inis to be loaded from tars. diff -r 87148ad75853 -r 7ce0cbe8575f src/ini.cpp --- a/src/ini.cpp Sun Aug 24 23:10:23 2008 +0000 +++ b/src/ini.cpp Sun Aug 24 23:12:10 2008 +0000 @@ -8,6 +8,7 @@ #include "debug.h" #include "ini_type.h" #include "string_func.h" +#include "fileio.h" IniItem::IniItem(IniGroup *parent, const char *name, size_t len) : next(NULL), value(NULL), comment(NULL) { @@ -138,12 +139,14 @@ uint comment_size = 0; uint comment_alloc = 0; - FILE *in = fopen(filename, "r"); + size_t end; + FILE *in = FioFOpenFile(filename, "r", DATA_DIR, &end); if (in == NULL) return; + end += ftell(in); + /* for each line in the file */ - while (fgets(buffer, sizeof(buffer), in)) { - + while ((size_t)ftell(in) < end && fgets(buffer, sizeof(buffer), in)) { /* trim whitespace from the left side */ for (s = buffer; *s == ' ' || *s == '\t'; s++) {}