X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;ds=sidebyside;f=src%2Fencoding.c;h=5819f0ef30c84000e62403384ac702049b5a851b;hb=2fd8ff1904371cf9bfbab7105287cc221379552b;hp=ff90a23b8ca74bdda4ff2fc763eb66142ce1d818;hpb=fe221b8f000dbd52b884d1ac71d75f49a44cc05c;p=wimlib diff --git a/src/encoding.c b/src/encoding.c index ff90a23b..5819f0ef 100644 --- a/src/encoding.c +++ b/src/encoding.c @@ -5,27 +5,31 @@ /* * Copyright (C) 2012, 2013 Eric Biggers * - * This file is part of wimlib, a library for working with WIM files. + * This file is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 3 of the License, or (at your option) any + * later version. * - * wimlib 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 3 of the License, or (at your option) - * any later version. - * - * wimlib 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 + * This file 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 Lesser General Public License for more * details. * - * You should have received a copy of the GNU General Public License - * along with wimlib; if not, see http://www.gnu.org/licenses/. + * You should have received a copy of the GNU Lesser General Public License + * along with this file; if not, see http://www.gnu.org/licenses/. */ #ifdef HAVE_CONFIG_H # include "config.h" #endif +#include +#include +#include +#include + #include "wimlib.h" +#include "wimlib/alloca.h" #include "wimlib/assert.h" #include "wimlib/encoding.h" #include "wimlib/endianness.h" @@ -33,15 +37,6 @@ #include "wimlib/list.h" #include "wimlib/util.h" -#include -#include -#include -#include -#include - -#ifdef HAVE_ALLOCA_H -# include -#endif bool wimlib_mbs_is_utf8 = !TCHAR_IS_UTF16LE; @@ -563,9 +558,11 @@ cmp_utf16le_strings(const utf16lechar *s1, size_t n1, return (n1 < n2) ? -1 : 1; } -/* Duplicate a UTF16-LE string which may not be null-terminated. */ +/* Duplicate a UTF16-LE string. The input string might not be null terminated + * and might be misaligned, but the returned string is guaranteed to be null + * terminated and properly aligned. */ utf16lechar * -utf16le_dupz(const utf16lechar *ustr, size_t usize) +utf16le_dupz(const void *ustr, size_t usize) { utf16lechar *dup = MALLOC(usize + sizeof(utf16lechar)); if (dup) {