ocaml-gettext/0005-Miscellaneous-changes-to-remove-deprecated-features.patch

65 lines
2.3 KiB
Diff
Raw Normal View History

From 685abfdad5f66b8df3ddf0713f7d3ba733b56b60 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 12 Jul 2019 13:50:31 +0100
Subject: [PATCH 5/9] Miscellaneous changes to remove deprecated features.
- Use Bytes instead of mutable strings.
- Use String.uppercase_ascii instead of String.uppercase.
---
libgettext-ocaml/gettextMo.ml | 4 ++--
libgettext-ocaml/gettextMo_int32.ml | 2 +-
libgettext-ocaml/gettextMo_parser.mly | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/libgettext-ocaml/gettextMo.ml b/libgettext-ocaml/gettextMo.ml
index fb395e8..246a115 100644
--- a/libgettext-ocaml/gettextMo.ml
+++ b/libgettext-ocaml/gettextMo.ml
@@ -164,7 +164,7 @@ let input_mo_untranslated failsafe chn mo_header number =
with End_of_file ->
raise (MoInvalidStringOutOfBound(in_channel_length chn,offset_pair))
in
- split_plural str
+ split_plural (Bytes.to_string str)
else
raise (MoInvalidStringOutOfBound(Int32.to_int mo_header.number_of_strings, number))
;;
@@ -183,7 +183,7 @@ let input_mo_translated failsafe chn mo_header number =
raise (MoInvalidTranslationOutOfBound
(in_channel_length chn,offset_pair))
in
- split_plural str
+ split_plural (Bytes.to_string str)
)
else
(
diff --git a/libgettext-ocaml/gettextMo_int32.ml b/libgettext-ocaml/gettextMo_int32.ml
index 7490a3e..4816d83 100644
--- a/libgettext-ocaml/gettextMo_int32.ml
+++ b/libgettext-ocaml/gettextMo_int32.ml
@@ -104,7 +104,7 @@ let input_int32_pair_string chn endian =
(Int32.to_int length,Int32.to_int offset)
in
if 0 <= ioffset + ilength && ioffset + ilength < in_channel_length chn then
- let str = String.make ilength 'X'
+ let str = Bytes.make ilength 'X'
in
seek_in chn ioffset;
really_input chn str 0 ilength;
diff --git a/libgettext-ocaml/gettextMo_parser.mly b/libgettext-ocaml/gettextMo_parser.mly
index 95d50e3..b2e55ca 100644
--- a/libgettext-ocaml/gettextMo_parser.mly
+++ b/libgettext-ocaml/gettextMo_parser.mly
@@ -99,7 +99,7 @@ plural_forms:
;
content_type:
- STRING SEMICOLON CHARSET EQUAL STRING { ($1,String.uppercase $5) }
+ STRING SEMICOLON CHARSET EQUAL STRING { ($1,String.uppercase_ascii $5) }
;
expr:
--
2.22.0