MCPcopy Create free account
hub / github.com/axmolengine/axmol / LoadConfigFromFile

Function LoadConfigFromFile

3rdparty/openal/alc/alconfig.cpp:138–285  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

136}
137
138void LoadConfigFromFile(std::istream &f)
139{
140 std::string curSection;
141 std::string buffer;
142
143 while(readline(f, buffer))
144 {
145 if(lstrip(buffer).empty())
146 continue;
147
148 if(buffer[0] == '[')
149 {
150 auto line = const_cast<char*>(buffer.data());
151 char *section = line+1;
152 char *endsection;
153
154 endsection = std::strchr(section, ']');
155 if(!endsection || section == endsection)
156 {
157 ERR(" config parse error: bad line \"%s\"\n", line);
158 continue;
159 }
160 if(endsection[1] != 0)
161 {
162 char *end = endsection+1;
163 while(std::isspace(*end))
164 ++end;
165 if(*end != 0 && *end != '#')
166 {
167 ERR(" config parse error: bad line \"%s\"\n", line);
168 continue;
169 }
170 }
171 *endsection = 0;
172
173 curSection.clear();
174 if(al::strcasecmp(section, "general") != 0)
175 {
176 do {
177 char *nextp = std::strchr(section, '%');
178 if(!nextp)
179 {
180 curSection += section;
181 break;
182 }
183
184 curSection.append(section, nextp);
185 section = nextp;
186
187 if(((section[1] >= '0' && section[1] <= '9') ||
188 (section[1] >= 'a' && section[1] <= 'f') ||
189 (section[1] >= 'A' && section[1] <= 'F')) &&
190 ((section[2] >= '0' && section[2] <= '9') ||
191 (section[2] >= 'a' && section[2] <= 'f') ||
192 (section[2] >= 'A' && section[2] <= 'F')))
193 {
194 int b{0};
195 if(section[1] >= '0' && section[1] <= '9')

Callers 1

ReadALConfigFunction · 0.85

Calls 15

readlineFunction · 0.85
strcasecmpFunction · 0.85
expdupFunction · 0.85
minFunction · 0.50
emptyMethod · 0.45
dataMethod · 0.45
clearMethod · 0.45
appendMethod · 0.45
findMethod · 0.45
sizeMethod · 0.45
eraseMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected