MCPcopy Create free account
hub / github.com/crownengine/crown / LoadConfigFromFile

Function LoadConfigFromFile

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

Source from the content-addressed store, hash-verified

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

Callers 1

ReadALConfigFunction · 0.85

Calls 15

strchrFunction · 0.85
sscanfFunction · 0.85
strcmpFunction · 0.85
expdupFunction · 0.85
moveFunction · 0.85
readlineFunction · 0.70
strcasecmpFunction · 0.50
emptyMethod · 0.45
clearMethod · 0.45
appendMethod · 0.45
findMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected