mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-08 17:42:12 +03:00
Store invocation-specific data of conversion modules in __gconv_step_data
This commit is contained in:
@@ -1,3 +1,11 @@
|
|||||||
|
2011-12-21 Ulrich Drepper <drepper@gmail.com>
|
||||||
|
|
||||||
|
[BZ #13439]
|
||||||
|
* iconv/gconv.h: Define __GCONV_SWAP.
|
||||||
|
* iconvdata/unicode.c: The swap bit must be stored in __flags.
|
||||||
|
* iconvdata/utf-16.c: Likewise.
|
||||||
|
* iconvdata/utf-32.c: Likewise.
|
||||||
|
|
||||||
2011-12-21 Andreas Schwab <schwab@linux-m68k.org>
|
2011-12-21 Andreas Schwab <schwab@linux-m68k.org>
|
||||||
|
|
||||||
[BZ #13524]
|
[BZ #13524]
|
||||||
|
4
NEWS
4
NEWS
@@ -12,8 +12,8 @@ Version 2.15
|
|||||||
6779, 6783, 9696, 10103, 10709, 11589, 12403, 12847, 12868, 12852, 12874,
|
6779, 6783, 9696, 10103, 10709, 11589, 12403, 12847, 12868, 12852, 12874,
|
||||||
12885, 12892, 12907, 12922, 12935, 13007, 13021, 13067, 13068, 13090,
|
12885, 12892, 12907, 12922, 12935, 13007, 13021, 13067, 13068, 13090,
|
||||||
13092, 13114, 13118, 13123, 13134, 13138, 13147, 13150, 13179, 13192,
|
13092, 13114, 13118, 13123, 13134, 13138, 13147, 13150, 13179, 13192,
|
||||||
13268, 13276, 13291, 13335, 13337, 13344, 13358, 13367, 13446, 13472,
|
13268, 13276, 13291, 13335, 13337, 13344, 13358, 13367, 13439, 13446,
|
||||||
13484, 13506, 13524
|
13472, 13484, 13506, 13524
|
||||||
|
|
||||||
* New program pldd to list loaded object of a process
|
* New program pldd to list loaded object of a process
|
||||||
Implemented by Ulrich Drepper.
|
Implemented by Ulrich Drepper.
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 1997-1999, 2000-2002, 2007 Free Software Foundation, Inc.
|
/* Copyright (C) 1997-1999, 2000-2002, 2007, 2011 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
@@ -56,7 +56,8 @@ enum
|
|||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
__GCONV_IS_LAST = 0x0001,
|
__GCONV_IS_LAST = 0x0001,
|
||||||
__GCONV_IGNORE_ERRORS = 0x0002
|
__GCONV_IGNORE_ERRORS = 0x0002,
|
||||||
|
__GCONV_SWAP = 0x0004
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/* Conversion module for Unicode
|
/* Conversion module for Unicode
|
||||||
Copyright (C) 1999, 2000-2002 Free Software Foundation, Inc.
|
Copyright (C) 1999, 2000-2002, 2011 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
|
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
|
||||||
|
|
||||||
@@ -57,7 +57,7 @@
|
|||||||
*inptrp = inptr += 2; \
|
*inptrp = inptr += 2; \
|
||||||
else if (get16u (inptr) == BOM_OE) \
|
else if (get16u (inptr) == BOM_OE) \
|
||||||
{ \
|
{ \
|
||||||
((struct unicode_data *) step->__data)->swap = 1; \
|
data->__flags |= __GCONV_SWAP; \
|
||||||
*inptrp = inptr += 2; \
|
*inptrp = inptr += 2; \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
@@ -71,7 +71,7 @@
|
|||||||
put16u (outbuf, BOM); \
|
put16u (outbuf, BOM); \
|
||||||
outbuf += 2; \
|
outbuf += 2; \
|
||||||
} \
|
} \
|
||||||
swap = ((struct unicode_data *) step->__data)->swap;
|
swap = data->__flags & __GCONV_SWAP;
|
||||||
#define EXTRA_LOOP_ARGS , swap
|
#define EXTRA_LOOP_ARGS , swap
|
||||||
|
|
||||||
|
|
||||||
@@ -86,7 +86,6 @@ enum direction
|
|||||||
struct unicode_data
|
struct unicode_data
|
||||||
{
|
{
|
||||||
enum direction dir;
|
enum direction dir;
|
||||||
int swap;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -110,7 +109,6 @@ gconv_init (struct __gconv_step *step)
|
|||||||
if (new_data != NULL)
|
if (new_data != NULL)
|
||||||
{
|
{
|
||||||
new_data->dir = dir;
|
new_data->dir = dir;
|
||||||
new_data->swap = 0;
|
|
||||||
step->__data = new_data;
|
step->__data = new_data;
|
||||||
|
|
||||||
if (dir == from_unicode)
|
if (dir == from_unicode)
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/* Conversion module for UTF-16.
|
/* Conversion module for UTF-16.
|
||||||
Copyright (C) 1999, 2000-2002, 2003, 2005 Free Software Foundation, Inc.
|
Copyright (C) 1999, 2000-2002, 2003, 2005, 2011 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
|
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
|
||||||
|
|
||||||
@@ -44,11 +44,14 @@
|
|||||||
#define PREPARE_LOOP \
|
#define PREPARE_LOOP \
|
||||||
enum direction dir = ((struct utf16_data *) step->__data)->dir; \
|
enum direction dir = ((struct utf16_data *) step->__data)->dir; \
|
||||||
enum variant var = ((struct utf16_data *) step->__data)->var; \
|
enum variant var = ((struct utf16_data *) step->__data)->var; \
|
||||||
if (__builtin_expect (data->__invocation_counter == 0, 0) && var == UTF_16) \
|
if (__builtin_expect (data->__invocation_counter == 0, 0)) \
|
||||||
|
{ \
|
||||||
|
if (var == UTF_16) \
|
||||||
{ \
|
{ \
|
||||||
if (FROM_DIRECTION) \
|
if (FROM_DIRECTION) \
|
||||||
{ \
|
{ \
|
||||||
/* We have to find out which byte order the file is encoded in. */ \
|
/* We have to find out which byte order the file is \
|
||||||
|
encoded in. */ \
|
||||||
if (inptr + 2 > inend) \
|
if (inptr + 2 > inend) \
|
||||||
return (inptr == inend \
|
return (inptr == inend \
|
||||||
? __GCONV_EMPTY_INPUT : __GCONV_INCOMPLETE_INPUT); \
|
? __GCONV_EMPTY_INPUT : __GCONV_INCOMPLETE_INPUT); \
|
||||||
@@ -58,7 +61,7 @@
|
|||||||
*inptrp = inptr += 2; \
|
*inptrp = inptr += 2; \
|
||||||
else if (get16u (inptr) == BOM_OE) \
|
else if (get16u (inptr) == BOM_OE) \
|
||||||
{ \
|
{ \
|
||||||
((struct utf16_data *) step->__data)->swap = 1; \
|
data->__flags |= __GCONV_SWAP; \
|
||||||
*inptrp = inptr += 2; \
|
*inptrp = inptr += 2; \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
@@ -72,7 +75,11 @@
|
|||||||
outbuf += 2; \
|
outbuf += 2; \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
int swap = ((struct utf16_data *) step->__data)->swap;
|
else if ((var == UTF_16LE && BYTE_ORDER == BIG_ENDIAN) \
|
||||||
|
|| (var == UTF_16BE && BYTE_ORDER == LITTLE_ENDIAN)) \
|
||||||
|
data->__flags |= __GCONV_SWAP; \
|
||||||
|
} \
|
||||||
|
const int swap = data->__flags & __GCONV_SWAP;
|
||||||
#define EXTRA_LOOP_ARGS , swap
|
#define EXTRA_LOOP_ARGS , swap
|
||||||
|
|
||||||
|
|
||||||
@@ -96,7 +103,6 @@ struct utf16_data
|
|||||||
{
|
{
|
||||||
enum direction dir;
|
enum direction dir;
|
||||||
enum variant var;
|
enum variant var;
|
||||||
int swap;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -151,9 +157,6 @@ gconv_init (struct __gconv_step *step)
|
|||||||
{
|
{
|
||||||
new_data->dir = dir;
|
new_data->dir = dir;
|
||||||
new_data->var = var;
|
new_data->var = var;
|
||||||
new_data->swap = ((var == UTF_16LE && BYTE_ORDER == BIG_ENDIAN)
|
|
||||||
|| (var == UTF_16BE
|
|
||||||
&& BYTE_ORDER == LITTLE_ENDIAN));
|
|
||||||
step->__data = new_data;
|
step->__data = new_data;
|
||||||
|
|
||||||
if (dir == from_utf16)
|
if (dir == from_utf16)
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/* Conversion module for UTF-32.
|
/* Conversion module for UTF-32.
|
||||||
Copyright (C) 1999, 2000-2002 Free Software Foundation, Inc.
|
Copyright (C) 1999, 2000-2002, 2011 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
int swap; \
|
int swap; \
|
||||||
if (FROM_DIRECTION && var == UTF_32) \
|
if (FROM_DIRECTION && var == UTF_32) \
|
||||||
{ \
|
{ \
|
||||||
if (data->__invocation_counter == 0) \
|
if (__builtin_expect (data->__invocation_counter == 0, 0)) \
|
||||||
{ \
|
{ \
|
||||||
/* We have to find out which byte order the file is encoded in. */ \
|
/* We have to find out which byte order the file is encoded in. */ \
|
||||||
if (inptr + 4 > inend) \
|
if (inptr + 4 > inend) \
|
||||||
@@ -57,7 +57,7 @@
|
|||||||
*inptrp = inptr += 4; \
|
*inptrp = inptr += 4; \
|
||||||
else if (get32u (inptr) == BOM_OE) \
|
else if (get32u (inptr) == BOM_OE) \
|
||||||
{ \
|
{ \
|
||||||
((struct utf32_data *) step->__data)->swap = 1; \
|
data->__flags |= __GCONV_SWAP; \
|
||||||
*inptrp = inptr += 4; \
|
*inptrp = inptr += 4; \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
@@ -72,7 +72,11 @@
|
|||||||
put32u (outbuf, BOM); \
|
put32u (outbuf, BOM); \
|
||||||
outbuf += 4; \
|
outbuf += 4; \
|
||||||
} \
|
} \
|
||||||
swap = ((struct utf32_data *) step->__data)->swap;
|
else if (__builtin_expect (data->__invocation_counter == 0, 0) \
|
||||||
|
&& ((var == UTF_32LE && BYTE_ORDER == BIG_ENDIAN) \
|
||||||
|
|| (var == UTF_32BE && BYTE_ORDER == LITTLE_ENDIAN))) \
|
||||||
|
data->__flags |= __GCONV_SWAP; \
|
||||||
|
swap = data->__flags & __GCONV_SWAP;
|
||||||
#define EXTRA_LOOP_ARGS , var, swap
|
#define EXTRA_LOOP_ARGS , var, swap
|
||||||
|
|
||||||
|
|
||||||
@@ -96,7 +100,6 @@ struct utf32_data
|
|||||||
{
|
{
|
||||||
enum direction dir;
|
enum direction dir;
|
||||||
enum variant var;
|
enum variant var;
|
||||||
int swap;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -151,9 +154,6 @@ gconv_init (struct __gconv_step *step)
|
|||||||
{
|
{
|
||||||
new_data->dir = dir;
|
new_data->dir = dir;
|
||||||
new_data->var = var;
|
new_data->var = var;
|
||||||
new_data->swap = ((var == UTF_32LE && BYTE_ORDER == BIG_ENDIAN)
|
|
||||||
|| (var == UTF_32BE
|
|
||||||
&& BYTE_ORDER == LITTLE_ENDIAN));
|
|
||||||
step->__data = new_data;
|
step->__data = new_data;
|
||||||
|
|
||||||
if (dir == from_utf32)
|
if (dir == from_utf32)
|
||||||
@@ -216,8 +216,7 @@ gconv_end (struct __gconv_step *data)
|
|||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
if (swap) \
|
if (swap) \
|
||||||
put32 (outptr, bswap_32 (c)); \
|
c = bswap_32 (c); \
|
||||||
else \
|
|
||||||
put32 (outptr, c); \
|
put32 (outptr, c); \
|
||||||
\
|
\
|
||||||
outptr += 4; \
|
outptr += 4; \
|
||||||
|
Reference in New Issue
Block a user