X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fshare%2Futf8%2Fcharset.c;h=cfde5621d8b926d0ed2238b2d725c691c373045e;hb=b9574fe58950d38c96399161421484935249822a;hp=2775d10d4c4a7c3a6ec3d2ed02384d3ada0ae54c;hpb=ca8660193b5e4a74f8f79817de12be87a4ff3078;p=platform%2Fupstream%2Fflac.git diff --git a/src/share/utf8/charset.c b/src/share/utf8/charset.c index 2775d10..cfde562 100644 --- a/src/share/utf8/charset.c +++ b/src/share/utf8/charset.c @@ -1,19 +1,19 @@ /* * Copyright (C) 2001 Edmund Grimley Evans - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ /* @@ -27,10 +27,15 @@ * 8-bit char, 16-bit short and 32-bit int. */ +#if HAVE_CONFIG_H +# include +#endif + #ifndef HAVE_ICONV /* should be ifdef USE_CHARSET_CONVERT */ #include +#include "share/alloc.h" #include "charset.h" #include "charmaps.h" @@ -329,7 +334,7 @@ static struct inverse_map *make_inverse_map(const unsigned short *from) char used[256]; int i, j, k; - to = (struct inverse_map *)malloc(sizeof(struct inverse_map)); + to = malloc(sizeof(struct inverse_map)); if (!to) return 0; for (i = 0; i < 256; i++) @@ -354,7 +359,7 @@ static struct inverse_map *make_inverse_map(const unsigned short *from) return to; } -int wctomb_8bit(void *map1, char *s, int wc1) +static int wctomb_8bit(void *map1, char *s, int wc1) { struct map *map = map1; unsigned short wc = wc1; @@ -442,9 +447,9 @@ struct charset *charset_find(const char *code) for (i = 0; maps[i].name; i++) if (!ascii_strcasecmp(code, maps[i].name)) { if (!maps[i].charset) { - maps[i].charset = (struct charset *)malloc(sizeof(struct charset)); + maps[i].charset = malloc(sizeof(struct charset)); if (maps[i].charset) { - struct map *map = (struct map *)malloc(sizeof(struct map)); + struct map *map = malloc(sizeof(struct map)); if (!map) { free(maps[i].charset); maps[i].charset = 0; @@ -488,7 +493,7 @@ int charset_convert(const char *fromcode, const char *tocode, if (!charset1 || !charset2 ) return -1; - tobuf = (char *)malloc(fromlen * charset2->max + 1); + tobuf = safe_malloc_mul2add_(fromlen, /*times*/charset2->max, /*+*/1); if (!tobuf) return -2;