aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/lib/src/xlibi18n/lcPrTxt.c
diff options
context:
space:
mode:
Diffstat (limited to 'nx-X11/lib/src/xlibi18n/lcPrTxt.c')
-rw-r--r--nx-X11/lib/src/xlibi18n/lcPrTxt.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/nx-X11/lib/src/xlibi18n/lcPrTxt.c b/nx-X11/lib/src/xlibi18n/lcPrTxt.c
index e62e94e80..047eb7f7a 100644
--- a/nx-X11/lib/src/xlibi18n/lcPrTxt.c
+++ b/nx-X11/lib/src/xlibi18n/lcPrTxt.c
@@ -30,6 +30,7 @@
#include "XlcPubI.h"
#include <nx-X11/Xutil.h>
#include <nx-X11/Xatom.h>
+#include "reallocarray.h"
static XPointer *
alloc_list(
@@ -40,11 +41,11 @@ alloc_list(
if (is_wide_char) {
wchar_t **wstr_list;
- wstr_list = Xmalloc(count * sizeof(wchar_t *));
+ wstr_list = Xmallocarray(count, sizeof(wchar_t *));
if (wstr_list == NULL)
return (XPointer *) NULL;
- *wstr_list = Xmalloc(nitems * sizeof(wchar_t));
+ *wstr_list = Xmallocarray(nitems, sizeof(wchar_t));
if (*wstr_list == NULL) {
Xfree(wstr_list);
return (XPointer *) NULL;
@@ -54,7 +55,7 @@ alloc_list(
} else {
char **str_list;
- str_list = Xmalloc(count * sizeof(char *));
+ str_list = Xmallocarray(count, sizeof(char *));
if (str_list == NULL)
return (XPointer *) NULL;
@@ -99,7 +100,7 @@ copy_list(
for (str = *str_list; count > 0; count--, str_list++) {
strcpy(str, mb_text);
*str_list = str;
- length = strlen(str) + 1;
+ length = (int) strlen(str) + 1;
str += length;
mb_text += length;
}
@@ -185,7 +186,7 @@ _XTextPropertyToTextList(
if (do_strcpy) {
len = min(from_left, to_left);
- strncpy(to, from, len);
+ strncpy(to, from, (size_t) len);
from += len;
to += len;
from_left -= len;