MCPcopy Create free account
hub / github.com/JHRobotics/softgpu / liner

Function liner

winini.c:287–394  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

285}
286
287BOOL liner(const char *src, const char *dst, linerRule_t *rules)
288{
289 static char linebuf[MAX_LINE];
290 BOOL rc = 0;
291
292 removeROFlag(src);
293 removeROFlag(dst);
294
295 HANDLE file = CreateFileA(src, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
296
297 if(file != INVALID_HANDLE_VALUE)
298 {
299 char c;
300 DWORD readed;
301 size_t linepos = 0;
302 DWORD junk;
303 size_t fpos = 0;
304
305 HANDLE out = CreateFileA(dst, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
306
307 if(out != INVALID_HANDLE_VALUE)
308 {
309 do
310 {
311 readed = 0;
312 if(ReadFile(file, &c, 1, &readed, NULL))
313 {
314 if(readed == 1)
315 {
316 fpos++;
317 switch(c)
318 {
319 case '\r':
320 case '\0':
321 break;
322 case '\n':
323 {
324 BOOL ignore_line = FALSE;
325 linebuf[linepos] = '\0';
326 for(linerRule_t *r = rules; r->line_match != NULL; r++)
327 {
328 if(r->full_match)
329 {
330 if(strcmp(linebuf, r->line_match) == 0)
331 {
332 ignore_line = !r->action(linebuf, linepos, fpos);
333
334 if(r->last_rule) break;
335 }
336 }
337 else
338 {
339 if(strstr(linebuf, r->line_match) != NULL)
340 {
341 ignore_line = !r->action(linebuf, linepos, fpos);
342
343 if(r->last_rule) break;
344 }

Callers 2

infFixerFunction · 0.85
simd95Function · 0.85

Calls 1

removeROFlagFunction · 0.85

Tested by

no test coverage detected