comparison mgtool.php @ 334:0ea16a3777b8

Improve error messages.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 19 Jun 2023 12:44:18 +0300
parents c1de5571b59c
children c9147be13386
comparison
equal deleted inserted replaced
333:9dece4d00e30 334:0ea16a3777b8
339 } 339 }
340 else 340 else
341 { 341 {
342 // Skip other chunks 342 // Skip other chunks
343 if (fseek($fh, $chunk["size"], SEEK_CUR) < 0) 343 if (fseek($fh, $chunk["size"], SEEK_CUR) < 0)
344 return "File seek error in chunk skip"; 344 return "File seek error in chunk data skip";
345 } 345 }
346 346
347 // If the chunk size is not aligned, skip one byte 347 // If the chunk size is not aligned, skip one byte
348 if ($chunk["size"] & 1) 348 if ($chunk["size"] & 1)
349 { 349 {
350 if (fseek($fh, 1, SEEK_CUR) < 0) 350 if (fseek($fh, 1, SEEK_CUR) < 0)
351 return "File seek error in chunk skip"; 351 return "File seek error in chunk alignment skip";
352 } 352 }
353 } 353 }
354 354
355 return TRUE; 355 return TRUE;
356 } 356 }
651 { 651 {
652 if (($hasData = preg_match("/^([#%]?)\s*(\S+?)\s+(.+)$/", $str, $m))) 652 if (($hasData = preg_match("/^([#%]?)\s*(\S+?)\s+(.+)$/", $str, $m)))
653 $captions[$m[2]] = ["caption" => $m[3]]; 653 $captions[$m[2]] = ["caption" => $m[3]];
654 else 654 else
655 $hasData = preg_match("/^([#%]?)\s*(\S+?)$/", $str, $m); 655 $hasData = preg_match("/^([#%]?)\s*(\S+?)$/", $str, $m);
656
656 if ($hasData) 657 if ($hasData)
657 { 658 {
658 $captions[$m[2]] = [ 659 $captions[$m[2]] = [
659 "hide" => ($m[1] == "#"), 660 "hide" => ($m[1] == "#"),
660 "hide_contents" => ($m[1] == "%"), 661 "hide_contents" => ($m[1] == "%"),