@@ -124,6 +124,12 @@ void trace(string func = __FUNCTION__, A...)(string fmt, A args)
124
124
writefln(fmt, args);
125
125
}
126
126
127
+ void printWarning (string func = __FUNCTION__ , A... )(string fmt, A args)
128
+ {
129
+ stderr.write(" warning: " );
130
+ debug stderr.write(" [" , func, " ] " );
131
+ stderr.writefln(fmt, args);
132
+ }
127
133
int printError (string func = __FUNCTION__ , A... )(int code, string fmt, A args)
128
134
{
129
135
stderr.writef(" error: (code %d) " , code);
@@ -208,7 +214,8 @@ unittest
208
214
assert (s == 1024 + 102 ); // 102.4
209
215
}
210
216
211
- bool compareHash (const (char )[] h1, const (char )[] h2) {
217
+ bool compareHash (const (char )[] h1, const (char )[] h2)
218
+ {
212
219
import std.digest : secureEqual;
213
220
import std.uni : asLowerCase;
214
221
return secureEqual (h1.asLowerCase, h2.asLowerCase);
@@ -320,7 +327,7 @@ int processFile(string path)
320
327
++ count;
321
328
if (entry.isDir)
322
329
{
323
- printError( 5 , " '%s': Is a directory" , file);
330
+ printWarning( " '%s': Is a directory" , file);
324
331
continue ;
325
332
}
326
333
@@ -395,7 +402,7 @@ int processList(string listPath)
395
402
if (formattedRead(line, " %s %s" , expected, file) != 2 )
396
403
{
397
404
++ statErrors;
398
- printError( 11 , " Formatting error at line %u" , currentLine);
405
+ printWarning( " Could not get hash at line %u" , currentLine);
399
406
continue ;
400
407
}
401
408
break ;
@@ -404,7 +411,7 @@ int processList(string listPath)
404
411
if (formattedRead(line, " %s(%s) = %s" , hash, file, expected) != 3 )
405
412
{
406
413
++ statErrors;
407
- printError( 12 , " Formatting error at line %u" , currentLine);
414
+ printWarning( " Could not get hash at line %u" , currentLine);
408
415
continue ;
409
416
}
410
417
@@ -422,10 +429,10 @@ int processList(string listPath)
422
429
}
423
430
}
424
431
425
- printError( 13 , " Hash tag not found at line %u" , currentLine);
432
+ printWarning( " Unknown hash tag at line %u" , currentLine);
426
433
continue ;
427
434
case sri:
428
- throw new Exception ( " SRI is not supported in file checks" );
435
+ return printError ( 15 , " SRI is not supported in file checks" );
429
436
}
430
437
431
438
L_ENTRY_HASH :
0 commit comments