Commit 30656fd6 authored by Alan Coopersmith's avatar Alan Coopersmith

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's avatarAlan Coopersmith <alan.coopersmith@oracle.com>
parent 2e630090
...@@ -172,7 +172,7 @@ _XlcCreateDefaultCharSet( ...@@ -172,7 +172,7 @@ _XlcCreateDefaultCharSet(
const char *ct_sequence) const char *ct_sequence)
{ {
XlcCharSet charset; XlcCharSet charset;
int name_len, ct_sequence_len; size_t name_len, ct_sequence_len;
const char *colon; const char *colon;
char *tmp; char *tmp;
...@@ -195,7 +195,7 @@ _XlcCreateDefaultCharSet( ...@@ -195,7 +195,7 @@ _XlcCreateDefaultCharSet(
/* Fill in encoding_name and xrm_encoding_name. */ /* Fill in encoding_name and xrm_encoding_name. */
if ((colon = strchr(charset->name, ':')) != NULL) { 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); char *encoding_tmp = Xmalloc(length + 1);
if (encoding_tmp == NULL) { if (encoding_tmp == NULL) {
Xfree((char *) charset->name); Xfree((char *) charset->name);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment