mirror of
https://github.com/johnwhitington/cpdf-source.git
synced 2025-06-05 22:09:39 +02:00
Better error handling for file size specs
This commit is contained in:
@@ -1137,7 +1137,10 @@ let displaydoctitle b =
|
|||||||
_ -> failwith "DisplayDocTitle: must use true or false"
|
_ -> failwith "DisplayDocTitle: must use true or false"
|
||||||
|
|
||||||
let read_file_size s =
|
let read_file_size s =
|
||||||
let read_int s = int_of_string (implode (rev s)) in
|
let read_int s' =
|
||||||
|
try int_of_string (implode (rev s')) with
|
||||||
|
_ -> error (Printf.sprintf "Could not read file size specification %s" s)
|
||||||
|
in
|
||||||
match rev (explode (String.uppercase_ascii s)) with
|
match rev (explode (String.uppercase_ascii s)) with
|
||||||
| 'B'::'I'::'G'::s -> 1024 * 1024 * 1024 * read_int s
|
| 'B'::'I'::'G'::s -> 1024 * 1024 * 1024 * read_int s
|
||||||
| 'B'::'G'::s -> 1000 * 1000 * 1000 * read_int s
|
| 'B'::'G'::s -> 1000 * 1000 * 1000 * read_int s
|
||||||
|
Reference in New Issue
Block a user