X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=src%2Ftextfile.c;h=01c3959289e6045fc68d47e6b42159b358cc2fd7;hb=07d7220830f341d1038aed9d0467803c9d1e9d11;hp=332386dc5880d9a18ba546dd487cb2564d25ecf5;hpb=88bfb44de205f72acaefac0d509e1e4e604496f1;p=wimlib diff --git a/src/textfile.c b/src/textfile.c index 332386dc..01c39592 100644 --- a/src/textfile.c +++ b/src/textfile.c @@ -5,27 +5,24 @@ /* * Copyright (C) 2014 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 "wimlib/assert.h" #include "wimlib/encoding.h" #include "wimlib/error.h" #include "wimlib/file_io.h" @@ -131,22 +128,9 @@ translate_text_buffer(const u8 *buf_raw, size_t bufsize_raw, bufsize_raw - offset_raw, &buf_tstr, &bufsize_tstr); } else { - #if TCHAR_IS_UTF16LE - bufsize_tstr = bufsize_raw - offset_raw; - buf_tstr = MALLOC(bufsize_tstr + 2); - if (buf_tstr) { - memcpy(buf_tstr, buf_raw + offset_raw, bufsize_tstr); - ((u8*)buf_tstr)[bufsize_tstr + 0] = 0; - ((u8*)buf_tstr)[bufsize_tstr + 1] = 0; - ret = 0; - } else { - ret = WIMLIB_ERR_NOMEM; - } - #else ret = utf16le_to_tstr((const utf16lechar *)(buf_raw + offset_raw), bufsize_raw - offset_raw, &buf_tstr, &bufsize_tstr); - #endif } if (ret) return ret;