MCPcopy Create free account
hub / github.com/StrongPC123/Far-Cry-1-Source-Full / LoadBuf

Method LoadBuf

ResourceCompiler/CfgFile.cpp:171–265  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

169
170
171void CfgFile::LoadBuf( const char *buf,size_t bufSize )
172{
173
174 // Read entries from config CString buffer.
175 Section *curr_section = &m_sections.front(); // Empty section.
176
177 const char *s = buf;
178 size_t size = bufSize;
179
180 CString ss = s;
181
182 char str[4096];
183 size_t i = 0;
184
185 while (i < size)
186 {
187// while (j < size && s[j] != '\n') j++;
188
189 sscanf( &s[i],"%[^\n]s",str );
190
191 Log ("Parsing line: \"%s\"", str);
192
193 i+=strlen(str);
194 if(s[i]==10)i++;
195
196 bool bComment=false;
197
198 // Is comment?
199 Entry entry;
200 entry.key = "";
201 entry.value = str;
202
203 bComment=entry.IsComment();
204
205 if (bComment)
206 Log ("It's a comment");
207
208 // Analyze entry CString, split on key and value and store in lists.
209 CString entrystr = str;
210
211 if(!bComment)
212 entrystr.Trim();
213
214 if(bComment || entrystr.IsEmpty())
215 {
216 Log ("Empty!");
217 // Add this comment to current section.
218 curr_section->entries.push_back( entry );
219 continue;
220 }
221
222
223 {
224 int splitter = entrystr.Find( '=' );
225 Log ("found splitter at %d", splitter);
226
227 if (splitter > 0)
228 {

Callers

nothing calls this directly

Calls 10

IsCommentMethod · 0.80
MidMethod · 0.80
LogFunction · 0.50
frontMethod · 0.45
IsEmptyMethod · 0.45
push_backMethod · 0.45
FindMethod · 0.45
GetStringMethod · 0.45
GetLengthMethod · 0.45
backMethod · 0.45

Tested by

no test coverage detected