[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 05/10: [hpftodit]: Hush compiler warning.
From: |
G. Branden Robinson |
Subject: |
[groff] 05/10: [hpftodit]: Hush compiler warning. |
Date: |
Mon, 26 Jul 2021 20:38:48 -0400 (EDT) |
gbranden pushed a commit to branch master
in repository groff.
commit df2116d4d71e11f4724d32d5e1b4c4d77000fd53
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Mon Jul 26 07:54:05 2021 +1000
[hpftodit]: Hush compiler warning.
* src/utils/hpftodit/hpftodit.cpp (hp_msl_to_ucode_name,
unicode_to_ucode_name): Hush "format nonliteral" compiler warnings by
using a preprocessor-defined string literal as an sprint() format
string instead of a C variable that just compared identically to the
same thing.
../src/utils/hpftodit/hpftodit.cpp: In function ‘char*
hp_msl_to_ucode_name(int)’:
../src/utils/hpftodit/hpftodit.cpp:1288:59: warning: format not a string
literal, argument types not checked [-Wformat-nonliteral]
sprintf(value, equal(ustr, UNNAMED) ? ustr : "u%s", ustr);
^
../src/utils/hpftodit/hpftodit.cpp: In function ‘char*
unicode_to_ucode_name(int)’:
../src/utils/hpftodit/hpftodit.cpp:1312:59: warning: format not a string
literal, argument types not checked [-Wformat-nonliteral]
sprintf(value, equal(ustr, UNNAMED) ? ustr : "u%s", ustr);
^
---
ChangeLog | 8 ++++++++
src/utils/hpftodit/hpftodit.cpp | 4 ++--
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 49d0520..65ac337 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2021-07-26 G. Branden Robinson <g.branden.robinson@gmail.com>
+
+ * src/utils/hpftodit/hpftodit.cpp (hp_msl_to_ucode_name,
+ unicode_to_ucode_name): Hush "format nonliteral" compiler
+ warnings by using a preprocessor-defined string literal as an
+ sprint() format string instead of a C variable that just
+ compared identically to the same thing.
+
2021-07-25 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/utils/hpftodit/hpftodit.cpp (show_symset): Prevent
diff --git a/src/utils/hpftodit/hpftodit.cpp b/src/utils/hpftodit/hpftodit.cpp
index f827ed3..2647a6f 100644
--- a/src/utils/hpftodit/hpftodit.cpp
+++ b/src/utils/hpftodit/hpftodit.cpp
@@ -1286,7 +1286,7 @@ hp_msl_to_ucode_name(int msl)
ustr = uname_decomposed + 1;
}
char *value = new char[strlen(ustr) + 1];
- sprintf(value, equal(ustr, UNNAMED) ? ustr : "u%s", ustr);
+ sprintf(value, equal(ustr, UNNAMED) ? UNNAMED : "u%s", ustr);
return value;
}
@@ -1312,7 +1312,7 @@ unicode_to_ucode_name(int ucode)
ustr = uname_decomposed + 1;
}
char *value = new char[strlen(ustr) + 1];
- sprintf(value, equal(ustr, UNNAMED) ? ustr : "u%s", ustr);
+ sprintf(value, equal(ustr, UNNAMED) ? UNNAMED : "u%s", ustr);
return value;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 05/10: [hpftodit]: Hush compiler warning.,
G. Branden Robinson <=