Commit d8358c6e authored by Alan Coopersmith's avatar Alan Coopersmith Committed by Ulrich Sibiller

xlibi18n: Fix a bunch of const cast warnings

Add const qualifiers to casts where needed, remove other casts that are no longer needed. Signed-off-by: 's avatarAlan Coopersmith <alan.coopersmith@oracle.com> Backported-to-NX-by: 's avatarUlrich Sibiller <uli42@gmx.de>
parent e667b905
...@@ -970,7 +970,7 @@ cstoct( ...@@ -970,7 +970,7 @@ cstoct(
/* The CompoundText specification says that the only /* The CompoundText specification says that the only
control characters allowed are 0x09, 0x0a, 0x1b, 0x9b. control characters allowed are 0x09, 0x0a, 0x1b, 0x9b.
Therefore here we eliminate other control characters. */ Therefore here we eliminate other control characters. */
unsigned char ch = *((unsigned char *) csptr) & 0x7f; unsigned char ch = *((const unsigned char *) csptr) & 0x7f;
if (!((ch >= min_ch && ch <= max_ch) if (!((ch >= min_ch && ch <= max_ch)
|| (side == XlcGL || (side == XlcGL
&& (ch == 0x00 || ch == 0x09 || ch == 0x0a)) && (ch == 0x00 || ch == 0x09 || ch == 0x0a))
...@@ -1020,7 +1020,7 @@ cstoct( ...@@ -1020,7 +1020,7 @@ cstoct(
#endif #endif
) { ) {
while (csstr_len > 0 && ct_len > 0) { while (csstr_len > 0 && ct_len > 0) {
unsigned char ch = * (unsigned char *) csptr; unsigned char ch = * (const unsigned char *) csptr;
int char_size = (ch < 0xc0 ? 1 : int char_size = (ch < 0xc0 ? 1 :
ch < 0xe0 ? 2 : ch < 0xe0 ? 2 :
ch < 0xf0 ? 3 : ch < 0xf0 ? 3 :
...@@ -1093,9 +1093,9 @@ strtocs( ...@@ -1093,9 +1093,9 @@ strtocs(
dst = (char *) *to; dst = (char *) *to;
length = min(*from_left, *to_left); length = min(*from_left, *to_left);
side = *((unsigned char *) src) & 0x80; side = *((const unsigned char *) src) & 0x80;
while (side == (*((unsigned char *) src) & 0x80) && length-- > 0) while (side == (*((const unsigned char *) src) & 0x80) && length-- > 0)
*dst++ = *src++; *dst++ = *src++;
*from_left -= src - (const char *) *from; *from_left -= src - (const char *) *from;
...@@ -1140,7 +1140,7 @@ cstostr( ...@@ -1140,7 +1140,7 @@ cstostr(
str_len = *to_left; str_len = *to_left;
while (csstr_len > 0 && str_len > 0) { while (csstr_len > 0 && str_len > 0) {
ch = *((unsigned char *) csptr++); ch = *((const unsigned char *) csptr++);
csstr_len--; csstr_len--;
/* Citing ICCCM: "STRING as a type specifies the ISO Latin-1 character /* Citing ICCCM: "STRING as a type specifies the ISO Latin-1 character
set plus the control characters TAB and NEWLINE." */ set plus the control characters TAB and NEWLINE." */
......
...@@ -106,7 +106,8 @@ load_public( ...@@ -106,7 +106,8 @@ load_public(
XLCd lcd) XLCd lcd)
{ {
XLCdPublicPart *pub = XLC_PUBLIC_PART(lcd); XLCdPublicPart *pub = XLC_PUBLIC_PART(lcd);
char **values, *str; char **values;
const char *str;
int num; int num;
if(_XlcCreateLocaleDataBase(lcd) == NULL) if(_XlcCreateLocaleDataBase(lcd) == NULL)
......
...@@ -101,7 +101,7 @@ XmbDrawString( ...@@ -101,7 +101,7 @@ XmbDrawString(
int text_len) int text_len)
{ {
(void)(*font_set->methods->mb_draw_string) (dpy, d, font_set, gc, x, y, (void)(*font_set->methods->mb_draw_string) (dpy, d, font_set, gc, x, y,
(char *)text, text_len); text, text_len);
} }
...@@ -117,7 +117,7 @@ XmbDrawImageString( ...@@ -117,7 +117,7 @@ XmbDrawImageString(
int text_len) int text_len)
{ {
(*font_set->methods->mb_draw_image_string) (dpy, d, font_set, gc, x, y, (*font_set->methods->mb_draw_image_string) (dpy, d, font_set, gc, x, y,
(char *)text, text_len); text, text_len);
} }
int int
...@@ -126,8 +126,7 @@ XmbTextEscapement( ...@@ -126,8 +126,7 @@ XmbTextEscapement(
_Xconst char *text, _Xconst char *text,
int text_len) int text_len)
{ {
return (*font_set->methods->mb_escapement) (font_set, return (*font_set->methods->mb_escapement) (font_set, text, text_len);
(char *)text, text_len);
} }
int int
...@@ -138,8 +137,7 @@ XmbTextExtents( ...@@ -138,8 +137,7 @@ XmbTextExtents(
XRectangle *overall_ink_extents, XRectangle *overall_ink_extents,
XRectangle *overall_logical_extents) XRectangle *overall_logical_extents)
{ {
return (*font_set->methods->mb_extents) (font_set, return (*font_set->methods->mb_extents) (font_set, text, text_len,
(char *)text, text_len,
overall_ink_extents, overall_ink_extents,
overall_logical_extents); overall_logical_extents);
} }
...@@ -157,7 +155,7 @@ XmbTextPerCharExtents( ...@@ -157,7 +155,7 @@ XmbTextPerCharExtents(
XRectangle *max_logical_extents) XRectangle *max_logical_extents)
{ {
return (*font_set->methods->mb_extents_per_char) return (*font_set->methods->mb_extents_per_char)
(font_set, (char *)text, text_len, (font_set, text, text_len,
ink_extents_buffer, logical_extents_buffer, ink_extents_buffer, logical_extents_buffer,
buffer_size, num_chars, max_ink_extents, max_logical_extents); buffer_size, num_chars, max_ink_extents, max_logical_extents);
} }
...@@ -123,7 +123,7 @@ Xutf8DrawString( ...@@ -123,7 +123,7 @@ Xutf8DrawString(
int text_len) int text_len)
{ {
(void)(*font_set->methods->utf8_draw_string) (dpy, d, font_set, gc, x, y, (void)(*font_set->methods->utf8_draw_string) (dpy, d, font_set, gc, x, y,
(char *)text, text_len); text, text_len);
} }
...@@ -139,7 +139,7 @@ Xutf8DrawImageString( ...@@ -139,7 +139,7 @@ Xutf8DrawImageString(
int text_len) int text_len)
{ {
(*font_set->methods->utf8_draw_image_string) (dpy, d, font_set, gc, x, y, (*font_set->methods->utf8_draw_image_string) (dpy, d, font_set, gc, x, y,
(char *)text, text_len); text, text_len);
} }
int int
...@@ -148,8 +148,7 @@ Xutf8TextEscapement( ...@@ -148,8 +148,7 @@ Xutf8TextEscapement(
_Xconst char *text, _Xconst char *text,
int text_len) int text_len)
{ {
return (*font_set->methods->utf8_escapement) (font_set, return (*font_set->methods->utf8_escapement) (font_set, text, text_len);
(char *)text, text_len);
} }
int int
...@@ -160,8 +159,7 @@ Xutf8TextExtents( ...@@ -160,8 +159,7 @@ Xutf8TextExtents(
XRectangle *overall_ink_extents, XRectangle *overall_ink_extents,
XRectangle *overall_logical_extents) XRectangle *overall_logical_extents)
{ {
return (*font_set->methods->utf8_extents) (font_set, return (*font_set->methods->utf8_extents) (font_set, text, text_len,
(char *)text, text_len,
overall_ink_extents, overall_ink_extents,
overall_logical_extents); overall_logical_extents);
} }
...@@ -179,7 +177,7 @@ Xutf8TextPerCharExtents( ...@@ -179,7 +177,7 @@ Xutf8TextPerCharExtents(
XRectangle *max_logical_extents) XRectangle *max_logical_extents)
{ {
return (*font_set->methods->utf8_extents_per_char) return (*font_set->methods->utf8_extents_per_char)
(font_set, (char *)text, text_len, (font_set, text, text_len,
ink_extents_buffer, logical_extents_buffer, ink_extents_buffer, logical_extents_buffer,
buffer_size, num_chars, max_ink_extents, max_logical_extents); buffer_size, num_chars, max_ink_extents, max_logical_extents);
} }
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