mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-11-30 07:14:09 +08:00
codecvt_members.cc (codecvt::do_in, [...]): More minor tweaks.
2003-11-30 Paolo Carlini <pcarlini@suse.de> * config/locale/gnu/codecvt_members.cc (codecvt::do_in, codecvt::do_length): More minor tweaks. From-SVN: r74069
This commit is contained in:
parent
f19a9af7e1
commit
1644f06da7
@ -1,3 +1,8 @@
|
||||
2003-11-30 Paolo Carlini <pcarlini@suse.de>
|
||||
|
||||
* config/locale/gnu/codecvt_members.cc (codecvt::do_in,
|
||||
codecvt::do_length): More minor tweaks.
|
||||
|
||||
2003-11-30 Paolo Carlini <pcarlini@suse.de>
|
||||
|
||||
* config/locale/gnu/codecvt_members.cc (codecvt::do_in):
|
||||
|
@ -144,7 +144,7 @@ namespace std
|
||||
__from_chunk_end = __from_end;
|
||||
|
||||
__from = __from_next;
|
||||
const size_t __conv = mbsnrtowcs(__to_next, &__from_next,
|
||||
size_t __conv = mbsnrtowcs(__to_next, &__from_next,
|
||||
__from_chunk_end - __from_next,
|
||||
__to_end - __to_next, &__state);
|
||||
if (__conv == static_cast<size_t>(-1))
|
||||
@ -152,15 +152,13 @@ namespace std
|
||||
// In case of error, in order to stop at the exact place we
|
||||
// have to start again from the beginning with a series of
|
||||
// mbrtowc.
|
||||
for (;; ++__to_next)
|
||||
for (;; ++__to_next, __from += __conv)
|
||||
{
|
||||
const size_t __conv_err = mbrtowc(__to_next, __from,
|
||||
__from_end - __from,
|
||||
__conv = mbrtowc(__to_next, __from, __from_end - __from,
|
||||
&__tmp_state);
|
||||
if (__conv_err == static_cast<size_t>(-1)
|
||||
|| __conv_err == static_cast<size_t>(-2))
|
||||
if (__conv == static_cast<size_t>(-1)
|
||||
|| __conv == static_cast<size_t>(-2))
|
||||
break;
|
||||
__from += __conv_err;
|
||||
}
|
||||
__from_next = __from;
|
||||
__state = __tmp_state;
|
||||
@ -262,7 +260,7 @@ namespace std
|
||||
__from_chunk_end = __end;
|
||||
|
||||
const extern_type* __tmp_from = __from;
|
||||
const size_t __conv = mbsnrtowcs(__to, &__from,
|
||||
size_t __conv = mbsnrtowcs(__to, &__from,
|
||||
__from_chunk_end - __from,
|
||||
__max, &__state);
|
||||
if (__conv == static_cast<size_t>(-1))
|
||||
@ -270,14 +268,13 @@ namespace std
|
||||
// In case of error, in order to stop at the exact place we
|
||||
// have to start again from the beginning with a series of
|
||||
// mbrtowc.
|
||||
for (__from = __tmp_from;;)
|
||||
for (__from = __tmp_from;; __from += __conv)
|
||||
{
|
||||
const size_t __conv_err = mbrtowc(NULL, __from, __end - __from,
|
||||
__conv = mbrtowc(NULL, __from, __end - __from,
|
||||
&__tmp_state);
|
||||
if (__conv_err == static_cast<size_t>(-1)
|
||||
|| __conv_err == static_cast<size_t>(-2))
|
||||
if (__conv == static_cast<size_t>(-1)
|
||||
|| __conv == static_cast<size_t>(-2))
|
||||
break;
|
||||
__from += __conv_err;
|
||||
}
|
||||
__state = __tmp_state;
|
||||
__ret += __from - __tmp_from;
|
||||
|
Loading…
Reference in New Issue
Block a user