PR 10109
* winduni.c: Replace test of HAVE_ICONV_H with a test of HAVE_ICONV. (iconv_onechar): Use ICONV_CONST instead of "const". (wind_MultiByteToWideChar): Initialise local strings.
This commit is contained in:
parent
163ea230b5
commit
6f4c2146e7
|
@ -1,3 +1,11 @@
|
||||||
|
2009-05-05 Guillaume Duhamel <guillaume.duhamel@gmail.com>
|
||||||
|
|
||||||
|
PR 10109
|
||||||
|
* winduni.c: Replace test of HAVE_ICONV_H with a test of
|
||||||
|
HAVE_ICONV.
|
||||||
|
(iconv_onechar): Use ICONV_CONST instead of "const".
|
||||||
|
(wind_MultiByteToWideChar): Initialise local strings.
|
||||||
|
|
||||||
2009-04-30 Nick Clifton <nickc@redhat.com>
|
2009-04-30 Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
* readelf.c (dump_relocations): Display a relocation against an
|
* readelf.c (dump_relocations): Display a relocation against an
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* winduni.c -- unicode support for the windres program.
|
/* winduni.c -- unicode support for the windres program.
|
||||||
Copyright 1997, 1998, 2000, 2001, 2003, 2007
|
Copyright 1997, 1998, 2000, 2001, 2003, 2007, 2009
|
||||||
Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
||||||
Written by Ian Lance Taylor, Cygnus Support.
|
Written by Ian Lance Taylor, Cygnus Support.
|
||||||
Rewritten by Kai Tietz, Onevision.
|
Rewritten by Kai Tietz, Onevision.
|
||||||
|
@ -42,7 +42,7 @@
|
||||||
#include "winduni.h"
|
#include "winduni.h"
|
||||||
#include "safe-ctype.h"
|
#include "safe-ctype.h"
|
||||||
|
|
||||||
#if HAVE_ICONV_H
|
#if HAVE_ICONV
|
||||||
#include <iconv.h>
|
#include <iconv.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -616,16 +616,16 @@ codepage_from_unicode (rc_uint_type *length, const unichar *unicode, char **asci
|
||||||
*length = len;
|
*length = len;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_ICONV_H
|
#ifdef HAVE_ICONV
|
||||||
static int
|
static int
|
||||||
iconv_onechar (iconv_t cd, const char *s, char *d, int d_len, const char **n_s, char **n_d)
|
iconv_onechar (iconv_t cd, ICONV_CONST char *s, char *d, int d_len, const char **n_s, char **n_d)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 1; i <= 32; i++)
|
for (i = 1; i <= 32; i++)
|
||||||
{
|
{
|
||||||
char *tmp_d = d;
|
char *tmp_d = d;
|
||||||
const char *tmp_s = s;
|
ICONV_CONST char *tmp_s = s;
|
||||||
size_t ret;
|
size_t ret;
|
||||||
size_t s_left = (size_t) i;
|
size_t s_left = (size_t) i;
|
||||||
size_t d_left = (size_t) d_len;
|
size_t d_left = (size_t) d_len;
|
||||||
|
@ -652,7 +652,7 @@ wind_iconv_cp (rc_uint_type cp)
|
||||||
return NULL;
|
return NULL;
|
||||||
return lim->iconv_name;
|
return lim->iconv_name;
|
||||||
}
|
}
|
||||||
#endif /* HAVE_ICONV_H */
|
#endif /* HAVE_ICONV */
|
||||||
|
|
||||||
static rc_uint_type
|
static rc_uint_type
|
||||||
wind_MultiByteToWideChar (rc_uint_type cp, const char *mb,
|
wind_MultiByteToWideChar (rc_uint_type cp, const char *mb,
|
||||||
|
@ -666,7 +666,7 @@ wind_MultiByteToWideChar (rc_uint_type cp, const char *mb,
|
||||||
/* Convert to bytes. */
|
/* Convert to bytes. */
|
||||||
ret *= sizeof (unichar);
|
ret *= sizeof (unichar);
|
||||||
|
|
||||||
#elif defined (HAVE_ICONV_H)
|
#elif defined (HAVE_ICONV)
|
||||||
int first = 1;
|
int first = 1;
|
||||||
char tmp[32];
|
char tmp[32];
|
||||||
char *p_tmp;
|
char *p_tmp;
|
||||||
|
@ -679,11 +679,11 @@ wind_MultiByteToWideChar (rc_uint_type cp, const char *mb,
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
int iret;
|
int iret;
|
||||||
const char *n_mb;
|
const char *n_mb = "";
|
||||||
char *n_tmp;
|
char *n_tmp = "";
|
||||||
|
|
||||||
p_tmp = tmp;
|
p_tmp = tmp;
|
||||||
iret = iconv_onechar (cd, (const char *) mb, p_tmp, 32, & n_mb, & n_tmp);
|
iret = iconv_onechar (cd, (ICONV_CONST char *) mb, p_tmp, 32, & n_mb, & n_tmp);
|
||||||
if (first)
|
if (first)
|
||||||
{
|
{
|
||||||
first = 0;
|
first = 0;
|
||||||
|
@ -739,7 +739,7 @@ wind_WideCharToMultiByte (rc_uint_type cp, const unichar *u, char *mb, rc_uint_t
|
||||||
|
|
||||||
ret = (rc_uint_type) WideCharToMultiByte (cp, 0, u, -1, mb, mb_len,
|
ret = (rc_uint_type) WideCharToMultiByte (cp, 0, u, -1, mb, mb_len,
|
||||||
NULL, & used_def);
|
NULL, & used_def);
|
||||||
#elif defined (HAVE_ICONV_H)
|
#elif defined (HAVE_ICONV)
|
||||||
int first = 1;
|
int first = 1;
|
||||||
char tmp[32];
|
char tmp[32];
|
||||||
char *p_tmp;
|
char *p_tmp;
|
||||||
|
@ -752,11 +752,11 @@ wind_WideCharToMultiByte (rc_uint_type cp, const unichar *u, char *mb, rc_uint_t
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
int iret;
|
int iret;
|
||||||
const char *n_u;
|
const char *n_u = "";
|
||||||
char *n_tmp;
|
char *n_tmp = "";
|
||||||
|
|
||||||
p_tmp = tmp;
|
p_tmp = tmp;
|
||||||
iret = iconv_onechar (cd, (const char *) u, p_tmp, 32, &n_u, & n_tmp);
|
iret = iconv_onechar (cd, (ICONV_CONST char *) u, p_tmp, 32, &n_u, & n_tmp);
|
||||||
if (first)
|
if (first)
|
||||||
{
|
{
|
||||||
first = 0;
|
first = 0;
|
||||||
|
|
Loading…
Reference in New Issue