mirror of
https://gitlab.freedesktop.org/xorg/lib/libx11.git
synced 2026-05-07 06:18:04 +02:00
Fix implicit conversion warnings in _XlcCreateDefaultCharSet
lcCharSet.c:187:50: warning: implicit conversion changes signedness:
'int' to 'unsigned long' [-Wsign-conversion]
tmp = Xmalloc(name_len + 1 + ct_sequence_len + 1);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
../../include/X11/Xlibint.h:453:32: note: expanded from macro 'Xmalloc'
~~~~~~ ^~~~
lcCharSet.c:192:31: warning: implicit conversion changes signedness:
'int' to 'unsigned long' [-Wsign-conversion]
memcpy(tmp, name, name_len+1);
~~~~~~ ~~~~~~~~^~
lcCharSet.c:216:45: warning: implicit conversion changes signedness:
'int' to 'unsigned long' [-Wsign-conversion]
memcpy(tmp, ct_sequence, ct_sequence_len+1);
~~~~~~ ~~~~~~~~~~~~~~~^~
lcCharSet.c:183:16: warning: implicit conversion loses integer precision:
'unsigned long' to 'int' [-Wshorten-64-to-32]
name_len = strlen(name);
~ ^~~~~~~~~~~~
lcCharSet.c:184:23: warning: implicit conversion loses integer precision:
'unsigned long' to 'int' [-Wshorten-64-to-32]
ct_sequence_len = strlen(ct_sequence);
~ ^~~~~~~~~~~~~~~~~~~
lcCharSet.c:198:37: warning: implicit conversion loses integer precision:
'long' to 'unsigned int' [-Wshorten-64-to-32]
unsigned int length = colon - charset->name;
~~~~~~ ~~~~~~^~~~~~~~~~~~~~~
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
This commit is contained in:
parent
2e63009057
commit
30656fd66a
1 changed files with 2 additions and 2 deletions
|
|
@ -172,7 +172,7 @@ _XlcCreateDefaultCharSet(
|
|||
const char *ct_sequence)
|
||||
{
|
||||
XlcCharSet charset;
|
||||
int name_len, ct_sequence_len;
|
||||
size_t name_len, ct_sequence_len;
|
||||
const char *colon;
|
||||
char *tmp;
|
||||
|
||||
|
|
@ -195,7 +195,7 @@ _XlcCreateDefaultCharSet(
|
|||
|
||||
/* Fill in encoding_name and xrm_encoding_name. */
|
||||
if ((colon = strchr(charset->name, ':')) != NULL) {
|
||||
unsigned int length = colon - charset->name;
|
||||
size_t length = (size_t)(colon - charset->name);
|
||||
char *encoding_tmp = Xmalloc(length + 1);
|
||||
if (encoding_tmp == NULL) {
|
||||
Xfree((char *) charset->name);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue