diff --git a/opam b/opam index 3a9128ee..bb5a53f9 100644 --- a/opam +++ b/opam @@ -26,6 +26,6 @@ depends: [ "easy-format" "ulex" "xmlm" - "base64" {>="2.0.0"} + "base64" {>="3.1.0"} ] dev-repo: "git://github.com/alavrik/piqi" diff --git a/piqilib/piqi_base64.ml b/piqilib/piqi_base64.ml index c5a6ae73..a98346e8 100644 --- a/piqilib/piqi_base64.ml +++ b/piqilib/piqi_base64.ml @@ -18,12 +18,11 @@ (* TODO: add more base64 validation; the base64 library doesn't do any * validation *) let decode x = - try - B64.decode x - with _ -> - invalid_arg "Piqi_base64.decode" + match Base64.decode x with + | Error _ -> invalid_arg "Piqi_base64.decode" + | Ok v -> v let encode x = - B64.encode x + Base64.encode_exn x