summaryrefslogtreecommitdiff
path: root/lib/uniconv/u-conv-to-enc.h
diff options
context:
space:
mode:
authorAndreas Rottmann <a.rottmann@gmx.at>2010-05-27 18:23:17 +0200
committerAndreas Rottmann <a.rottmann@gmx.at>2010-05-27 18:23:17 +0200
commitbd6adfa17d453e4c486e36fed4c5779db90a8a0e (patch)
tree9798677560d5f99061afe9f0db105a8c97f2438a /lib/uniconv/u-conv-to-enc.h
parent79ca645d222db2e158784642c3b464a47bea26f3 (diff)
parent3e0814cd9862b89c7a39672672937477bd87ddfb (diff)
Merge commit 'upstream/0.9.3'
Diffstat (limited to 'lib/uniconv/u-conv-to-enc.h')
-rw-r--r--lib/uniconv/u-conv-to-enc.h92
1 files changed, 46 insertions, 46 deletions
diff --git a/lib/uniconv/u-conv-to-enc.h b/lib/uniconv/u-conv-to-enc.h
index ed715482..43d82c77 100644
--- a/lib/uniconv/u-conv-to-enc.h
+++ b/lib/uniconv/u-conv-to-enc.h
@@ -1,5 +1,5 @@
/* Conversion from UTF-16/UTF-32 to legacy encodings.
- Copyright (C) 2002, 2006-2009 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006-2010 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
@@ -29,12 +29,12 @@ FUNC (const char *tocode,
if (offsets != NULL && srclen > 0)
{
scaled_offsets =
- (size_t *) malloc (srclen * sizeof (UNIT) * sizeof (size_t));
+ (size_t *) malloc (srclen * sizeof (UNIT) * sizeof (size_t));
if (scaled_offsets == NULL)
- {
- errno = ENOMEM;
- return NULL;
- }
+ {
+ errno = ENOMEM;
+ return NULL;
+ }
}
else
scaled_offsets = NULL;
@@ -42,9 +42,9 @@ FUNC (const char *tocode,
result = resultbuf;
length = *lengthp;
if (mem_iconveha ((const char *) src, srclen * sizeof (UNIT),
- UTF_NAME, tocode,
- handler == iconveh_question_mark, handler,
- scaled_offsets, &result, &length) < 0)
+ UTF_NAME, tocode,
+ handler == iconveh_question_mark, handler,
+ scaled_offsets, &result, &length) < 0)
{
int saved_errno = errno;
free (scaled_offsets);
@@ -55,11 +55,11 @@ FUNC (const char *tocode,
if (offsets != NULL)
{
/* Convert scaled_offsets[srclen * sizeof (UNIT)] to
- offsets[srclen]. */
+ offsets[srclen]. */
size_t i;
for (i = 0; i < srclen; i++)
- offsets[i] = scaled_offsets[i * sizeof (UNIT)];
+ offsets[i] = scaled_offsets[i * sizeof (UNIT)];
free (scaled_offsets);
}
@@ -67,10 +67,10 @@ FUNC (const char *tocode,
{
result = (char *) malloc (1);
if (result == NULL)
- {
- errno = ENOMEM;
- return NULL;
- }
+ {
+ errno = ENOMEM;
+ return NULL;
+ }
}
*lengthp = length;
return result;
@@ -91,62 +91,62 @@ FUNC (const char *tocode,
{
scaled_offsets = (size_t *) malloc (utf8_srclen * sizeof (size_t));
if (scaled_offsets == NULL)
- {
- if (utf8_src != tmpbuf)
- free (utf8_src);
- errno = ENOMEM;
- return NULL;
- }
+ {
+ if (utf8_src != tmpbuf)
+ free (utf8_src);
+ errno = ENOMEM;
+ return NULL;
+ }
}
else
scaled_offsets = NULL;
result = u8_conv_to_encoding (tocode, handler, utf8_src, utf8_srclen,
- scaled_offsets, resultbuf, lengthp);
+ scaled_offsets, resultbuf, lengthp);
if (result == NULL)
{
int saved_errno = errno;
free (scaled_offsets);
if (utf8_src != tmpbuf)
- free (utf8_src);
+ free (utf8_src);
errno = saved_errno;
return NULL;
}
if (offsets != NULL)
{
- size_t iunit; /* offset into src */
- size_t i8; /* offset into utf8_src */
+ size_t iunit; /* offset into src */
+ size_t i8; /* offset into utf8_src */
for (iunit = 0; iunit < srclen; iunit++)
- offsets[iunit] = (size_t)(-1);
+ offsets[iunit] = (size_t)(-1);
iunit = 0;
i8 = 0;
while (iunit < srclen && i8 < utf8_srclen)
- {
- int countunit;
- int count8;
-
- offsets[iunit] = scaled_offsets[i8];
-
- countunit = U_MBLEN (src + iunit, srclen - iunit);
- count8 = u8_mblen (utf8_src + i8, utf8_srclen - i8);
- if (countunit < 0 || count8 < 0)
- abort ();
- iunit += countunit;
- i8 += count8;
- }
+ {
+ int countunit;
+ int count8;
+
+ offsets[iunit] = scaled_offsets[i8];
+
+ countunit = U_MBLEN (src + iunit, srclen - iunit);
+ count8 = u8_mblen (utf8_src + i8, utf8_srclen - i8);
+ if (countunit < 0 || count8 < 0)
+ abort ();
+ iunit += countunit;
+ i8 += count8;
+ }
/* Check that utf8_src has been traversed entirely. */
if (i8 < utf8_srclen)
- abort ();
+ abort ();
/* Check that src has been traversed entirely, except possibly for an
- incomplete sequence of units at the end. */
+ incomplete sequence of units at the end. */
if (iunit < srclen)
- {
- offsets[iunit] = *lengthp;
- if (!(U_MBLEN (src + iunit, srclen - iunit) < 0))
- abort ();
- }
+ {
+ offsets[iunit] = *lengthp;
+ if (!(U_MBLEN (src + iunit, srclen - iunit) < 0))
+ abort ();
+ }
free (scaled_offsets);
}
if (utf8_src != tmpbuf)