supermin/0007-src-Fix-warnings-about...

62 lines
2.2 KiB
Diff

From 63b515b375ebf2dbcc7b0b53f2031c3aa63ac8dc Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 2 Sep 2022 12:03:29 +0100
Subject: [PATCH 07/12] src: Fix warnings about parsing ints from strings
Warnings of the form:
90 | Failure "int_of_string" ->
^^^^^^^^^^^^^^^
Warning 52 [fragile-literal-pattern]: Code should not depend on the
actual values of this constructor's arguments. They are only for
information and may change in future versions. (See manual section
11.5)
---
src/ph_pacman.ml | 2 +-
src/ph_rpm.ml | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/ph_pacman.ml b/src/ph_pacman.ml
index d9ecb29..44445a6 100644
--- a/src/ph_pacman.ml
+++ b/src/ph_pacman.ml
@@ -87,7 +87,7 @@ let pacman_package_of_string str =
| _ -> assert false in
epoch, version, release
with
- Failure "int_of_string" ->
+ Failure _ ->
failwith ("failed to parse epoch:version-release field " ^ evr) in
{ name = name;
diff --git a/src/ph_rpm.ml b/src/ph_rpm.ml
index f1ea299..85557fe 100644
--- a/src/ph_rpm.ml
+++ b/src/ph_rpm.ml
@@ -89,7 +89,7 @@ let rec rpm_init s =
| [x] -> error "unable to parse rpm version string: %s" x
| major :: minor :: _ ->
try int_of_string major, int_of_string minor
- with Failure "int_of_string" ->
+ with Failure _ ->
error "unable to parse rpm version string: non-numeric, %s" version in
rpm_major := major;
rpm_minor := minor;
@@ -120,11 +120,11 @@ and opensuse_init s =
| [x] -> error "unable to parse output of zypper --version: %s" x
| major :: minor :: [] ->
(try int_of_string major, int_of_string minor, 0
- with Failure "int_of_string" ->
+ with Failure _ ->
error "unable to parse output of zypper --version: non-numeric")
| major :: minor :: patch :: _ ->
(try int_of_string major, int_of_string minor, int_of_string patch
- with Failure "int_of_string" ->
+ with Failure _ ->
error "unable to parse output of zypper --version: non-numeric") in
zypper_major := major;
zypper_minor := minor;
--
2.37.3