diff options
author | Khaled Hosny <khaledhosny@eglug.org> | 2013-10-17 20:02:31 +0200 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2013-10-18 07:00:22 +0000 |
commit | 13818a69d77a5806e2bafa92283a56a9f7ac690d (patch) | |
tree | 173acbf5d37302ac3848d8de99fcebae64d7606f /external/icu | |
parent | 0ba2b78a07e1111208eef45813e14c33c95cef6d (diff) |
fdo#70393: move icu to a subdir of external
Change-Id: I9d8191848b093240f79207446afb13ca6fd708e4
Reviewed-on: https://gerrit.libreoffice.org/6309
Tested-by: LibreOffice gerrit bot <gerrit@libreoffice.org>
Reviewed-by: David Tardon <dtardon@redhat.com>
Tested-by: David Tardon <dtardon@redhat.com>
Diffstat (limited to 'external/icu')
-rw-r--r-- | external/icu/ExternalPackage_icu.mk | 85 | ||||
-rw-r--r-- | external/icu/ExternalProject_icu.mk | 99 | ||||
-rw-r--r-- | external/icu/Makefile | 7 | ||||
-rw-r--r-- | external/icu/Module_icu.mk | 18 | ||||
-rw-r--r-- | external/icu/README | 1 | ||||
-rw-r--r-- | external/icu/UnpackedTarball_icu.mk | 34 | ||||
-rw-r--r-- | external/icu/icu4c-aix.patch | 155 | ||||
-rw-r--r-- | external/icu/icu4c-android.patch | 65 | ||||
-rw-r--r-- | external/icu/icu4c-buffer-overflow.patch | 29 | ||||
-rw-r--r-- | external/icu/icu4c-build.patch | 108 | ||||
-rw-r--r-- | external/icu/icu4c-macosx.patch | 19 | ||||
-rw-r--r-- | external/icu/icu4c-mkdir.patch | 10 | ||||
-rw-r--r-- | external/icu/icu4c-rpath.patch | 35 | ||||
-rw-r--r-- | external/icu/icu4c-solarisgcc.patch | 12 | ||||
-rw-r--r-- | external/icu/icu4c-warnings.patch | 21 | ||||
-rw-r--r-- | external/icu/icu4c-wchar_t.patch | 15 | ||||
-rw-r--r-- | external/icu/icu4c.10129.wintz.patch | 24 | ||||
-rw-r--r-- | external/icu/icu4c.10318.CVE-2013-2924_changeset_34076.patch | 36 |
18 files changed, 773 insertions, 0 deletions
diff --git a/external/icu/ExternalPackage_icu.mk b/external/icu/ExternalPackage_icu.mk new file mode 100644 index 000000000000..4af02f5a96fe --- /dev/null +++ b/external/icu/ExternalPackage_icu.mk @@ -0,0 +1,85 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +icu_VERSION := $(ICU_MAJOR).$(ICU_MINOR)$(if $(ICU_MICRO),.$(ICU_MICRO)) + +$(eval $(call gb_ExternalPackage_ExternalPackage,icu,icu)) + +$(eval $(call gb_ExternalPackage_use_external_project,icu,icu)) +ifeq ($(OS),WNT) +ifeq ($(COM),GCC) + +$(eval $(call gb_ExternalPackage_add_file,icu,lib/libicudata.dll.a,source/stubdata/icudt.lib)) +$(eval $(call gb_ExternalPackage_add_file,icu,lib/libicuuc.dll.a,source/lib/icuuc.lib)) +$(eval $(call gb_ExternalPackage_add_file,icu,lib/libicui18n.dll.a,source/lib/icuin.lib)) +$(eval $(call gb_ExternalPackage_add_file,icu,lib/libicutu.dll.a,source/lib/icutu.lib)) +$(eval $(call gb_ExternalPackage_add_libraries_for_install,icu,bin,\ + source/lib/icudt$(ICU_MAJOR).dll \ + source/lib/icuuc$(ICU_MAJOR).dll \ + source/lib/icuin$(ICU_MAJOR).dll \ + source/lib/icutu$(ICU_MAJOR).dll \ +)) +$(eval $(call gb_ExternalPackage_add_files,icu,bin,\ + source/bin/genccode.exe \ + source/bin/genbrk.exe \ + source/bin/gencmn.exe \ +)) + +else +$(eval $(call gb_ExternalPackage_add_files,icu,lib,\ + source/lib/icudt$(if $(MSVC_USE_DEBUG_RUNTIME),d).lib \ + source/lib/icuuc$(if $(MSVC_USE_DEBUG_RUNTIME),d).lib \ + source/lib/icuin$(if $(MSVC_USE_DEBUG_RUNTIME),d).lib \ + source/lib/icutu$(if $(MSVC_USE_DEBUG_RUNTIME),d).lib\ +)) +$(eval $(call gb_ExternalPackage_add_libraries_for_install,icu,bin,\ + source/lib/icudt$(if $(MSVC_USE_DEBUG_RUNTIME),d)$(ICU_MAJOR).dll \ + source/lib/icuuc$(if $(MSVC_USE_DEBUG_RUNTIME),d)$(ICU_MAJOR).dll \ + source/lib/icuin$(if $(MSVC_USE_DEBUG_RUNTIME),d)$(ICU_MAJOR).dll \ + source/lib/icutu$(if $(MSVC_USE_DEBUG_RUNTIME),d)$(ICU_MAJOR).dll \ +)) +$(eval $(call gb_ExternalPackage_add_files,icu,bin,\ + source/bin/genccode.exe \ + source/bin/genbrk.exe \ + source/bin/gencmn.exe \ +)) +endif +else # $(OS) +ifeq ($(DISABLE_DYNLOADING),TRUE) +$(eval $(call gb_ExternalPackage_add_files,icu,lib,\ + source/lib/libicudata.a \ + source/lib/libicuuc.a \ + source/lib/libicui18n.a \ + source/lib/libicutu.a \ +)) +else ifeq ($(OS),ANDROID) +$(eval $(call gb_ExternalPackage_add_libraries_for_install,icu,lib,\ + source/lib/libicudatalo.so \ + source/lib/libicuuclo.so \ + source/lib/libicui18nlo.so \ + source/lib/libicutulo.so \ +)) +else +$(eval $(call gb_ExternalPackage_add_library_for_install,icu,lib/libicudata$(gb_Library_DLLEXT).$(ICU_MAJOR),source/lib/libicudata$(gb_Library_DLLEXT).$(icu_VERSION))) +$(eval $(call gb_ExternalPackage_add_file,icu,lib/libicudata$(gb_Library_DLLEXT),source/lib/libicudata$(gb_Library_DLLEXT).$(icu_VERSION))) +$(eval $(call gb_ExternalPackage_add_library_for_install,icu,lib/libicuuc$(gb_Library_DLLEXT).$(ICU_MAJOR),source/lib/libicuuc$(gb_Library_DLLEXT).$(icu_VERSION))) +$(eval $(call gb_ExternalPackage_add_file,icu,lib/libicuuc$(gb_Library_DLLEXT),source/lib/libicuuc$(gb_Library_DLLEXT).$(icu_VERSION))) +$(eval $(call gb_ExternalPackage_add_library_for_install,icu,lib/libicui18n$(gb_Library_DLLEXT).$(ICU_MAJOR),source/lib/libicui18n$(gb_Library_DLLEXT).$(icu_VERSION))) +$(eval $(call gb_ExternalPackage_add_file,icu,lib/libicui18n$(gb_Library_DLLEXT),source/lib/libicui18n$(gb_Library_DLLEXT).$(icu_VERSION))) +$(eval $(call gb_ExternalPackage_add_file,icu,lib/libicutu$(gb_Library_DLLEXT).$(ICU_MAJOR),source/lib/libicutu$(gb_Library_DLLEXT).$(icu_VERSION))) +$(eval $(call gb_ExternalPackage_add_file,icu,lib/libicutu$(gb_Library_DLLEXT),source/lib/libicutu$(gb_Library_DLLEXT).$(icu_VERSION))) + +$(eval $(call gb_ExternalPackage_add_files,icu,bin,\ + source/bin/genccode \ + source/bin/genbrk \ + source/bin/gencmn \ +)) +endif +endif +# vim: set noet sw=4 ts=4: diff --git a/external/icu/ExternalProject_icu.mk b/external/icu/ExternalProject_icu.mk new file mode 100644 index 000000000000..52cac492f7db --- /dev/null +++ b/external/icu/ExternalProject_icu.mk @@ -0,0 +1,99 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_ExternalProject_ExternalProject,icu)) + +$(eval $(call gb_ExternalProject_register_targets,icu,\ + build \ +)) + +icu_CPPFLAGS:="-DHAVE_GCC_ATOMICS=$(if $(filter TRUE,$(GCC_HAVE_BUILTIN_ATOMIC)),1,0)" + +ifeq ($(OS),WNT) + +# Note: runConfigureICU ignores everything following the platform name! +ifeq ($(COM),MSC) +$(call gb_ExternalProject_get_state_target,icu,build) : + $(call gb_ExternalProject_run,build,\ + export LIB="$(ILIB)" \ + && CFLAGS="$(SOLARINC)" CPPFLAGS="$(SOLARINC)" CXXFLAGS="$(SOLARINC)" \ + ./runConfigureICU \ + $(if $(MSVC_USE_DEBUG_RUNTIME),--enable-debug --disable-release) \ + Cygwin/MSVC \ + && $(MAKE) \ + ,source) +else +$(call gb_ExternalProject_get_state_target,icu,build) : + $(call gb_ExternalProject_run,build,\ + CPPFLAGS=$(icu_CPPFLAGS) CFLAGS="-O -D_MT" CXXFLAGS="-O -D_MT" \ + LIBS="$(if $(filter YES,$(MINGW_SHARED_GXXLIB)),$(MINGW_SHARED_LIBSTDCPP))" \ + LDFLAGS="-L$(COMPATH)/lib -Wl$(COMMA)--enable-runtime-pseudo-reloc-v2 \ + $(if $(filter YES,$(MINGW_SHARED_GCCLIB)),-shared-libgcc)" \ + ./configure \ + $(if $(filter YES,$(CROSS_COMPILING)),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM) \ + --with-cross-build=$(subst $(INPATH),$(INPATH_FOR_BUILD),$(call gb_UnpackedTarball_get_dir,icu))/source) \ + --disable-layout --disable-static --enable-shared --disable-samples \ + && $(MAKE) \ + && for lib in icudata icuin icuuc icutu; do \ + touch $$lib; \ + done \ + ,source) +endif + +else # $(OS) + +icu_CFLAGS:=" \ + $(if $(filter IOS,$(OS)),-DUCONFIG_NO_FILE_IO) \ + $(if $(SYSBASE),-I$(SYSBASE)/usr/include) \ + $(if $(debug),$(gb_DEBUG_CFLAGS),$(gb_COMPILEROPTFLAGS)) \ + $(if $(ENABLE_LTO),$(gb_LTOFLAGS)) \ + $(if $(filter GCC,$(COM)),-fno-strict-aliasing) \ + $(if $(filter $(true),$(gb_SYMBOL)),-g) \ + $(if $(filter ANDROID,$(OS)),-fvisibility=hidden -fno-omit-frame-pointer)" +icu_CXXFLAGS:=" \ + $(if $(filter IOS,$(OS)),-DUCONFIG_NO_FILE_IO) \ + $(if $(debug),$(gb_DEBUG_CFLAGS),$(gb_COMPILEROPTFLAGS)) \ + $(if $(ENABLE_LTO),$(gb_LTOFLAGS)) \ + $(if $(filter GCC,$(COM)),-fno-strict-aliasing) \ + $(if $(filter $(true),$(gb_SYMBOL)),-g) \ + $(if $(filter ANDROID,$(OS)),-fvisibility=hidden -fno-omit-frame-pointer)" +icu_LDFLAGS:=" \ + $(if $(ENABLE_LTO),$(gb_LTOFLAGS)) \ + $(if $(filter TRUE,$(HAVE_LD_HASH_STYLE)),-Wl$(COMMA)--hash-style=$(WITH_LINKER_HASH_STYLE)) \ + $(if $(SYSBASE),-L../lib -L../../lib -L../stubdata -L../../stubdata -L$(SYSBASE)/usr/lib) \ + $(if $(filter TRUE,$(HAVE_LD_BSYMBOLIC_FUNCTIONS)),\ + -Wl$(COMMA)-Bsymbolic-functions -Wl$(COMMA)--dynamic-list-cpp-new -Wl$(COMMA)--dynamic-list-cpp-typeinfo) \ + $(if $(filter ANDROID,$(OS)),-lgnustl_shared -lm)" + +$(call gb_ExternalProject_get_state_target,icu,build) : + $(call gb_ExternalProject_run,build,\ + CPPFLAGS=$(icu_CPPFLAGS) CFLAGS=$(icu_CFLAGS) \ + CXXFLAGS=$(icu_CXXFLAGS) LDFLAGS=$(icu_LDFLAGS) \ + ./configure \ + --disable-layout --disable-samples \ + $(if $(filter IOS ANDROID,$(OS)),--disable-dyload) \ + $(if $(filter ANDROID,$(OS)),--disable-strict) \ + $(if $(filter SOLARIS AIX,$(OS)),--disable-64bit-libs) \ + $(if $(filter TRUE,$(DISABLE_DYNLOADING)),\ + --enable-static --disable-shared,\ + --disable-static --enable-shared $(if $(filter ANDROID,$(OS)),--with-library-suffix=lo)) \ + $(if $(filter YES,$(CROSS_COMPILING)),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)\ + --with-cross-build=$(subst $(INPATH),$(INPATH_FOR_BUILD),$(call gb_UnpackedTarball_get_dir,icu))/source)\ + && $(MAKE) \ + $(if $(filter MACOSX,$(OS)),&& $(PERL) \ + $(SOLARENV)/bin/macosx-change-install-names.pl shl OOO \ + $(gb_Package_SOURCEDIR_icu)/source/lib/libicudata$(gb_Library_DLLEXT).$(icu_VERSION) \ + $(gb_Package_SOURCEDIR_icu)/source/lib/libicuuc$(gb_Library_DLLEXT).$(icu_VERSION) \ + $(gb_Package_SOURCEDIR_icu)/source/lib/libicui18n$(gb_Library_DLLEXT).$(icu_VERSION) \ + $(gb_Package_SOURCEDIR_icu)/source/lib/libicutu$(gb_Library_DLLEXT).$(icu_VERSION)) \ + ,source) + +endif + +# vim: set noet sw=4 ts=4: diff --git a/external/icu/Makefile b/external/icu/Makefile new file mode 100644 index 000000000000..ccb1c85a04da --- /dev/null +++ b/external/icu/Makefile @@ -0,0 +1,7 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- + +module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST)))) + +include $(module_directory)/../solenv/gbuild/partial_build.mk + +# vim: set noet sw=4 ts=4: diff --git a/external/icu/Module_icu.mk b/external/icu/Module_icu.mk new file mode 100644 index 000000000000..258c26ea4e61 --- /dev/null +++ b/external/icu/Module_icu.mk @@ -0,0 +1,18 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_Module_Module,icu)) + +$(eval $(call gb_Module_add_targets,icu,\ + UnpackedTarball_icu \ + ExternalPackage_icu \ + ExternalProject_icu \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/external/icu/README b/external/icu/README new file mode 100644 index 000000000000..484de1f41536 --- /dev/null +++ b/external/icu/README @@ -0,0 +1 @@ +Library providing Unicode support, from [http://site.icu-project.org/]. diff --git a/external/icu/UnpackedTarball_icu.mk b/external/icu/UnpackedTarball_icu.mk new file mode 100644 index 000000000000..2fdc9eefa8c0 --- /dev/null +++ b/external/icu/UnpackedTarball_icu.mk @@ -0,0 +1,34 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_UnpackedTarball_UnpackedTarball,icu)) + +$(eval $(call gb_UnpackedTarball_set_tarball,icu,$(ICU_TARBALL))) + +# *ONLY* for ICU 51(.1)! +# http://site.icu-project.org/download/51#TOC-Known-Issues +$(eval $(call gb_UnpackedTarball_set_pre_action,icu,\ + $(GNUTAR) -x -z -f $(gb_UnpackedTarget_TARFILE_LOCATION)/$(ICU_51_LAYOUT_FIX_TARBALL) \ +)) + +$(eval $(call gb_UnpackedTarball_add_patches,icu,\ + external/icu/icu4c.10318.CVE-2013-2924_changeset_34076.patch \ + external/icu/icu4c.10129.wintz.patch \ + external/icu/icu4c-build.patch \ + external/icu/icu4c-aix.patch \ + external/icu/icu4c-wchar_t.patch \ + external/icu/icu4c-warnings.patch \ + external/icu/icu4c-macosx.patch \ + external/icu/icu4c-solarisgcc.patch \ + external/icu/icu4c-mkdir.patch \ + external/icu/icu4c-buffer-overflow.patch \ + external/icu/icu4c-$(if $(filter ANDROID,$(OS)),android,rpath).patch \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/external/icu/icu4c-aix.patch b/external/icu/icu4c-aix.patch new file mode 100644 index 000000000000..48659ca0406a --- /dev/null +++ b/external/icu/icu4c-aix.patch @@ -0,0 +1,155 @@ +--- misc/icu/source/config/mh-aix-gcc 2009-01-15 01:46:10.000000000 -0600 ++++ misc/build/icu/source/config/mh-aix-gcc 2010-06-24 20:58:16.000000000 -0500 +@@ -1,10 +1,7 @@ + ## -*-makefile-*- +-## Copyright (c) 2003-2009 IBM, Ken Foskey, and others. All rights reserved. +-## +-## Aix-specific setup (for gcc) +-## +-## Please note: AIX does NOT have library versioning per se (there is no 'SONAME' capability). +-## So, we are using 'windows' style library names, that is, libicuuc20.1.so instead of libicuuc.so.20.1 ++## Linux-specific setup ++## Copyright (c) 1999-2006, International Business Machines Corporation and ++## others. All Rights Reserved. + + # Certain files don't compile in -ansi mode (e.g. umutex.c, toolutil.c, and cdatatst.c) + CFLAGS += -D_ALL_SOURCE +@@ -13,84 +10,30 @@ + GEN_DEPS.c= $(CC) -E -MM $(DEFS) $(CPPFLAGS) + GEN_DEPS.cc= $(CXX) -E -MM $(DEFS) $(CPPFLAGS) + +-## Commands to link +-## We need to use the C++ linker, even when linking C programs, since +-## our libraries contain C++ code (C++ static init not called) +-LINK.c= $(AIX_PREDELETE) $(CXX) $(CXXFLAGS) $(LDFLAGS) +-LINK.cc= $(AIX_PREDELETE) $(CXX) $(CXXFLAGS) $(LDFLAGS) +- +-## Shared library options +-LD_SOOPTIONS= -Wl,-bsymbolic +- +-## Commands to make a shared library +-SHLIB.c= $(AIX_PREDELETE) $(CC) $(CFLAGS) $(LDFLAGS) -shared -Wl,-bexpall $(LD_SOOPTIONS) +-SHLIB.cc= $(AIX_PREDELETE) $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -Wl,-bexpall $(LD_SOOPTIONS) ++## Flags for position independent code ++SHAREDLIBCFLAGS = -fPIC ++SHAREDLIBCXXFLAGS = -fPIC ++SHAREDLIBCPPFLAGS = -DPIC ++ ++## Additional flags when building libraries and with threads ++THREADSCPPFLAGS = -D_REENTRANT -D_THREAD_SAFE ++LIBCPPFLAGS = + + ## Compiler switch to embed a runtime search path +-LD_RPATH= -I +-LD_RPATH_PRE= +- +-## enable the shared lib loader +-LDFLAGS += -Wl,-bbigtoc ++LD_RPATH= ++LD_RPATH_PRE= + + ## These are the library specific LDFLAGS + LDFLAGSICUDT=-nodefaultlibs -nostdlib + +-## We need to delete things prior to linking, or else we'll get +-## SEVERE ERROR: output file in use .. on AIX. +-## But, shell script version should NOT delete target as we don't +-## have $@ in that context. (SH = only shell script, icu-config) +-AIX_PREDELETE=rm -f $@ ; +-#SH# AIX_PREDELETE= +- + ## Environment variable to set a runtime search path + LDLIBRARYPATH_ENVVAR = LIBPATH + +-## Override Versioned target for a shared library. +-FINAL_SO_TARGET= $(basename $(SO_TARGET))$(SO_TARGET_VERSION).$(SO) +-MIDDLE_SO_TARGET= $(basename $(SO_TARGET))$(SO_TARGET_VERSION_MAJOR).$(SO) +-SHARED_OBJECT = $(notdir $(FINAL_SO_TARGET:.$(SO)=.$(SOBJ))) +-SHARED_OBJECT_NO_VERSION = $(basename $(SO_TARGET)).$(SOBJ) +- +-# The following is for Makefile.inc's use. +-ICULIBSUFFIX_VERSION = $(LIB_VERSION_MAJOR) +- +-# this one is for icudefs.mk's use +-ifeq ($(ENABLE_SHARED),YES) +-SO_TARGET_VERSION_SUFFIX = $(SO_TARGET_VERSION_MAJOR) +-endif +- +-## Compiler switch to embed a library name. Not present on AIX. +-LD_SONAME = +- +-## The type of assembly needed when pkgdata is used for generating shared libraries. +-GENCCODE_ASSEMBLY=-a xlc +- + ## Shared object suffix +-SOBJ= so +-# without the -brtl option, the library names use .a. AIX is funny that way. +-SO= a +-A= a ++SO = so + + ## Non-shared intermediate object suffix +-STATIC_O = o +- +-## Special AIX rules +- +-## Build archive from shared object +-%.a : %.so +- ln -f $< $(SHARED_OBJECT_NO_VERSION) +- $(AR) $(ARFLAGS) $@ $(SHARED_OBJECT_NO_VERSION) +- rm -f $(SHARED_OBJECT_NO_VERSION) +-$(LIBDIR)/%.a : %.so +- ln -f $< $(SHARED_OBJECT_NO_VERSION) +- $(AR) $(ARFLAGS) $@ $(SHARED_OBJECT_NO_VERSION) +- rm -f $(SHARED_OBJECT_NO_VERSION) +- +-## Build import list from export list +-%.e : %.exp +- @echo "Building an import list for $<" +- @$(SHELL) -ec "echo '#! $*.a($*.so)' | cat - $< > $@" ++STATIC_O = ao + + ## Compilation rules + %.$(STATIC_O): $(srcdir)/%.c +@@ -118,10 +61,10 @@ + [ -s $@ ] || rm -f $@' + + ## Versioned libraries rules +-%$(SO_TARGET_VERSION_MAJOR).$(SO): %$(SO_TARGET_VERSION).$(SO) +- $(RM) $@ && ln -s ${*F}$(SO_TARGET_VERSION).$(SO) $@ +-%.$(SO): %$(SO_TARGET_VERSION).$(SO) +- $(RM) $@ && ln -s ${*F}$(SO_TARGET_VERSION).$(SO) $@ ++%.$(SO).$(SO_TARGET_VERSION_MAJOR): %.$(SO).$(SO_TARGET_VERSION) ++ $(RM) $@ && ln -s ${<F} $@ ++%.$(SO): %.$(SO).$(SO_TARGET_VERSION_MAJOR) ++ $(RM) $@ && ln -s ${*F}.$(SO).$(SO_TARGET_VERSION) $@ + + + ## BIR - bind with internal references [so app data and icu data doesn't collide] +--- misc/icu/source/tools/pkgdata/pkgdata.cpp 2013-03-15 22:12:06.000000000 +0000 ++++ misc/build/icu/source/tools/pkgdata/pkgdata.cpp 2013-04-06 20:56:00.935656635 +0100 +@@ -888,7 +888,7 @@ + + uprv_strcat(pkgDataFlags[SO_EXT], "."); + uprv_strcat(pkgDataFlags[SO_EXT], pkgDataFlags[A_EXT]); +-#elif U_PLATFORM == U_PF_OS400 || defined(_AIX) ++#elif U_PLATFORM == U_PF_OS400 + sprintf(libFileNames[LIB_FILE_VERSION_TMP], "%s.%s", + libFileNames[LIB_FILE], + pkgDataFlags[SOBJ_EXT]); +@@ -1302,15 +1298,6 @@ + pkgDataFlags[LDICUDTFLAGS], + targetDir, + libFileNames[LIB_FILE_CYGWIN_VERSION], +-#elif U_PLATFORM == U_PF_AIX +- sprintf(cmd, "%s %s%s;%s %s -o %s%s %s %s%s %s %s", +- RM_CMD, +- targetDir, +- libFileNames[LIB_FILE_VERSION_TMP], +- pkgDataFlags[GENLIB], +- pkgDataFlags[LDICUDTFLAGS], +- targetDir, +- libFileNames[LIB_FILE_VERSION_TMP], + #else + sprintf(cmd, "%s %s -o %s%s %s %s%s %s %s", + pkgDataFlags[GENLIB], diff --git a/external/icu/icu4c-android.patch b/external/icu/icu4c-android.patch new file mode 100644 index 000000000000..55764a12bbf3 --- /dev/null +++ b/external/icu/icu4c-android.patch @@ -0,0 +1,65 @@ +--- misc/icu/source/config/mh-linux ++++ misc/build/icu/source/config/mh-linux +@@ -30,7 +30,7 @@ + + ## Compiler switch to embed a library name + # The initial tab in the next line is to prevent icu-config from reading it. +- LD_SONAME = -Wl,-soname -Wl,$(notdir $(MIDDLE_SO_TARGET)) ++# LD_SONAME = -Wl,-soname -Wl,$(notdir $(MIDDLE_SO_TARGET)) + #SH# # We can't depend on MIDDLE_SO_TARGET being set. + #SH# LD_SONAME= + +--- misc/icu/source/configure ++++ misc/build/icu/source/configure +@@ -5053,7 +5053,7 @@ + else + icu_cv_host_frag=mh-linux-va + fi ;; +-*-*-linux*|*-*-gnu|*-*-k*bsd*-gnu|*-*-kopensolaris*-gnu) icu_cv_host_frag=mh-linux ;; ++*-*-linux*|*-*-gnu|*-*-k*bsd*-gnu|*-*-kopensolaris*-gnu|*-*-*-androideabi*) icu_cv_host_frag=mh-linux ;; + *-*-cygwin|*-*-mingw32|*-*-mingw64) + if test "$GCC" = yes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +@@ -6127,6 +6127,9 @@ + # Check to see if genccode can generate simple assembly. + GENCCODE_ASSEMBLY= + case "${host}" in ++arm-*-linux-androideabi) ++ GENCCODE_ASSEMBLY="-a gcc-android-arm" ++ ;; + *-linux*|*-kfreebsd*-gnu*|i*86-*-*bsd*|i*86-pc-gnu) + if test "$GCC" = yes; then + # We're using gcc, and the simple -a gcc command line works for genccode +@@ -7200,6 +7203,10 @@ + # wchar_t can be used + CHECK_UTF16_STRING_RESULT="available" + ;; ++*-*-*-androideabi|mips-unknown-linux-android) ++ # no UTF-16 strings thanks, I think, this is to avoid the -std=c++0x which causes trouble with uint64_t ++ CHECK_UTF16_STRING_RESULT="nope" ++ ;; + *) + ;; + esac +--- misc/icu/source/common/putilimp.h ++++ misc/build/icu/source/common/putilimp.h +@@ -86,6 +86,8 @@ + /* Use the predefined value. */ + #elif U_PLATFORM_HAS_WIN32_API + # define U_HAVE_NL_LANGINFO_CODESET 0 ++#elif defined(__ANDROID__) ++# define U_HAVE_NL_LANGINFO_CODESET 0 + #else + # define U_HAVE_NL_LANGINFO_CODESET 1 + #endif +--- misc/icu/source/common/unicode/platform.h ++++ misc/build/icu/source/common/unicode/platform.h +@@ -641,7 +641,7 @@ + #elif defined(U_STATIC_IMPLEMENTATION) + # define U_EXPORT + #elif defined(__GNUC__) +-# define U_EXPORT __attribute__((visibility("default"))) ++# define U_EXPORT + #elif (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x550) \ + || (defined(__SUNPRO_C) && __SUNPRO_C >= 0x550) + # define U_EXPORT __global diff --git a/external/icu/icu4c-buffer-overflow.patch b/external/icu/icu4c-buffer-overflow.patch new file mode 100644 index 000000000000..7385d3b470d9 --- /dev/null +++ b/external/icu/icu4c-buffer-overflow.patch @@ -0,0 +1,29 @@ +I: Statement might be overflowing a buffer in strncat. Common mistake: + BAD: strncat(buffer,charptr,sizeof(buffer)) is wrong, it takes the left over size as 3rd argument + GOOD: strncat(buffer,charptr,sizeof(buffer)-strlen(buffer)-1) +E: icu bufferoverflowstrncat pkgdata.cpp:299:87 + +--- + source/tools/pkgdata/pkgdata.cpp | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +Index: icu/source/tools/pkgdata/pkgdata.cpp +=================================================================== +--- build/icu.orig/source/tools/pkgdata/pkgdata.cpp ++++ build/icu/source/tools/pkgdata/pkgdata.cpp +@@ -1914,12 +1914,12 @@ static void loadLists(UPKGOptions *o, UE + const char cmd[] = "icu-config --incpkgdatafile"; + + /* #1 try the same path where pkgdata was called from. */ +- findDirname(progname, cmdBuf, 1024, &status); ++ findDirname(progname, cmdBuf, sizeof(cmdBuf), &status); + if(U_SUCCESS(status)) { + if (cmdBuf[0] != 0) { +- uprv_strncat(cmdBuf, U_FILE_SEP_STRING, 1024); ++ uprv_strncat(cmdBuf, U_FILE_SEP_STRING, sizeof(cmdBuf)-1-strlen(cmdBuf)); + } +- uprv_strncat(cmdBuf, cmd, 1024); ++ uprv_strncat(cmdBuf, cmd, sizeof(cmdBuf)-1-strlen(cmdBuf)); + + if(verbose) { + fprintf(stdout, "# Calling icu-config: %s\n", cmdBuf); diff --git a/external/icu/icu4c-build.patch b/external/icu/icu4c-build.patch new file mode 100644 index 000000000000..ba47658b3f7f --- /dev/null +++ b/external/icu/icu4c-build.patch @@ -0,0 +1,108 @@ +--- misc/icu/source/common/umutex.h ++++ misc/icu/source/common/umutex.h +@@ -48,16 +48,8 @@ + #endif /* win32 */ + + #if U_PLATFORM_IS_DARWIN_BASED +-#if defined(__STRICT_ANSI__) +-#define UPRV_REMAP_INLINE +-#define inline +-#endif + #include <libkern/OSAtomic.h> + #define USE_MAC_OS_ATOMIC_INCREMENT 1 +-#if defined(UPRV_REMAP_INLINE) +-#undef inline +-#undef UPRV_REMAP_INLINE +-#endif + #endif + + /* +--- misc/icu/source/tools/toolutil/pkg_genc.h ++++ misc/build/icu/source/tools/toolutil/pkg_genc.h +@@ -58,7 +58,7 @@ + #endif + + #define LARGE_BUFFER_MAX_SIZE 2048 +-#define SMALL_BUFFER_MAX_SIZE 512 ++#define SMALL_BUFFER_MAX_SIZE 2048 + #define SMALL_BUFFER_FLAG_NAMES 32 + #define BUFFER_PADDING_SIZE 20 + +--- misc/icu/source/tools/toolutil/pkg_genc.c ++++ misc/build/icu/source/tools/toolutil/pkg_genc.c +@@ -145,6 +145,28 @@ + + ".long ","",HEX_0X + }, ++ {"gcc-android-arm", ++ "\t.arch armv5te\n" ++ "\t.fpu softvfp\n" ++ "\t.eabi_attribute 20, 1\n" ++ "\t.eabi_attribute 21, 1\n" ++ "\t.eabi_attribute 23, 3\n" ++ "\t.eabi_attribute 24, 1\n" ++ "\t.eabi_attribute 25, 1\n" ++ "\t.eabi_attribute 26, 2\n" ++ "\t.eabi_attribute 30, 6\n" ++ "\t.eabi_attribute 18, 4\n" ++ "\t.file \"%s.s\"\n" ++ "\t.global %s\n" ++ "\t.section .rodata\n" ++ "\t.align 2\n" ++ "\t.type %s, %%object\n" ++ "%s:\n", ++ ++ "\t.word ", ++ "\t.section .note.GNU-stack,\"\",%%progbits\n", ++ HEX_0X ++ }, + {"sun", + "\t.section \".rodata\"\n" + "\t.align 8\n" + +--- misc/icu/source/config/mh-darwin 2010-09-29 20:37:36.000000000 +0200 ++++ misc/build/icu/source/config/mh-darwin 2011-03-15 10:56:26.653056004 +0100 +@@ -25,11 +25,7 @@ + SHLIB.cc= $(CXX) -dynamiclib -dynamic $(CXXFLAGS) $(LDFLAGS) $(LD_SOOPTIONS) + + ## Compiler switches to embed a library name and version information +-ifeq ($(ENABLE_RPATH),YES) +-LD_SONAME = -Wl,-compatibility_version -Wl,$(SO_TARGET_VERSION_MAJOR) -Wl,-current_version -Wl,$(SO_TARGET_VERSION) -install_name $(libdir)/$(notdir $(MIDDLE_SO_TARGET)) +-else +-LD_SONAME = -Wl,-compatibility_version -Wl,$(SO_TARGET_VERSION_MAJOR) -Wl,-current_version -Wl,$(SO_TARGET_VERSION) -install_name $(notdir $(MIDDLE_SO_TARGET)) +-endif ++LD_SONAME = -Wl,-compatibility_version -Wl,$(SO_TARGET_VERSION_MAJOR) -Wl,-current_version -Wl,$(SO_TARGET_VERSION) -install_name @__________________________________________________OOO/$(notdir $(MIDDLE_SO_TARGET)) + + ## Compiler switch to embed a runtime search path + LD_RPATH= +@@ -45,10 +41,6 @@ + ## Non-shared intermediate object suffix + STATIC_O = ao + +-## Override Versioned target for a shared library. +-FINAL_SO_TARGET= $(basename $(SO_TARGET)).$(SO_TARGET_VERSION).$(SO) +-MIDDLE_SO_TARGET= $(basename $(SO_TARGET)).$(SO_TARGET_VERSION_MAJOR).$(SO) +- + ## Compilation and dependency rules + %.$(STATIC_O): $(srcdir)/%.c + $(call SILENT_COMPILE,$(strip $(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS)) -MMD -MT "$*.d $*.o $*.$(STATIC_O)" -o $@ $<) +@@ -80,16 +72,10 @@ + + ## Versioned libraries rules + +-%.$(SO_TARGET_VERSION_MAJOR).$(SO): %.$(SO_TARGET_VERSION).$(SO) ++%.$(SO).$(SO_TARGET_VERSION_MAJOR): %.$(SO).$(SO_TARGET_VERSION) + $(RM) $@ && ln -s ${<F} $@ +-%.$(SO): %.$(SO_TARGET_VERSION_MAJOR).$(SO) +- $(RM) $@ && ln -s ${*F}.$(SO_TARGET_VERSION).$(SO) $@ +- +-# tzcode option +-TZORIG_EXTRA_CFLAGS=-DSTD_INSPIRED +- +-# genren opts +-GENREN_PL_OPTS=-x Mach-O -n '-g' -p '| c++filt' ++%.$(SO): %.$(SO).$(SO_TARGET_VERSION_MAJOR) ++ $(RM) $@ && ln -s ${*F}.$(SO).$(SO_TARGET_VERSION) $@ + + ## Remove shared library 's' + STATIC_PREFIX_WHEN_USED = diff --git a/external/icu/icu4c-macosx.patch b/external/icu/icu4c-macosx.patch new file mode 100644 index 000000000000..0de6ac30381a --- /dev/null +++ b/external/icu/icu4c-macosx.patch @@ -0,0 +1,19 @@ +--- misc/icu/source/common/putil.cpp ++++ misc/build/icu/source/common/putil.cpp +@@ -1080,8 +1080,16 @@ + static const time_t decemberSolstice=1198332540; /*2007-12-22 06:09 UT*/ + + /* This probing will tell us when daylight savings occurs. */ ++#if U_PLATFORM_IS_DARWIN_BASED ++ struct tm *tmp; ++ tmp = localtime(&juneSolstice); ++ juneSol = *tmp; ++ tmp = localtime(&decemberSolstice); ++ decemberSol = *tmp; ++#else + localtime_r(&juneSolstice, &juneSol); + localtime_r(&decemberSolstice, &decemberSol); ++#endif + if(decemberSol.tm_isdst > 0) { + daylightType = U_DAYLIGHT_DECEMBER; + } else if(juneSol.tm_isdst > 0) { diff --git a/external/icu/icu4c-mkdir.patch b/external/icu/icu4c-mkdir.patch new file mode 100644 index 000000000000..859220c37207 --- /dev/null +++ b/external/icu/icu4c-mkdir.patch @@ -0,0 +1,10 @@ +--- misc/icu/source/dataMakefile.in.sav 2012-04-05 22:49:20.000000000 +0200 ++++ build/icu/source/data/Makefile.in 2012-12-04 14:24:40.548026700 +0100 +@@ -346,6 +346,7 @@ + ifeq ($(PKGDATA_MODE),dll) + SO_VERSION_DATA = $(OUTTMPDIR)/icudata.res + $(SO_VERSION_DATA) : $(MISCSRCDIR)/icudata.rc ++ mkdir -p $(OUTTMPDIR) + rc.exe /i$(srcdir)/../common /i$(top_builddir)/common /fo$@ $(CPPFLAGS) $(SOURCE_FILE) + endif + endif diff --git a/external/icu/icu4c-rpath.patch b/external/icu/icu4c-rpath.patch new file mode 100644 index 000000000000..44ab8a652923 --- /dev/null +++ b/external/icu/icu4c-rpath.patch @@ -0,0 +1,35 @@ +--- misc/icu/source/data/pkgdataMakefile.in 2010-12-22 23:44:02.000000000 +0100 ++++ misc/build/icu/source/data/pkgdataMakefile.in 2011-01-03 17:52:44.000000000 +0100 +@@ -15,6 +15,9 @@ include $(top_builddir)/icudefs.mk + OUTPUTFILE=icupkg.inc + MIDDLE_SO_TARGET= + ++# escape $ with \ when passing to echo; needed to preserve $ORIGIN ++SHLIB.c.shell := $(subst $$,\$$,$(SHLIB.c)) ++ + all : clean + @echo GENCCODE_ASSEMBLY_TYPE=$(GENCCODE_ASSEMBLY) >> $(OUTPUTFILE) + @echo SO=$(SO) >> $(OUTPUTFILE) +@@ -24,7 +27,7 @@ all : clean + @echo LIB_EXT_ORDER=$(FINAL_SO_TARGET) >> $(OUTPUTFILE) + @echo COMPILE="$(COMPILE.c)" >> $(OUTPUTFILE) + @echo LIBFLAGS="-I$(top_srcdir)/common -I$(top_builddir)/common $(SHAREDLIBCPPFLAGS) $(SHAREDLIBCFLAGS)" >> $(OUTPUTFILE) +- @echo GENLIB="$(SHLIB.c)" >> $(OUTPUTFILE) ++ @echo GENLIB="$(SHLIB.c.shell)" >> $(OUTPUTFILE) + @echo LDICUDTFLAGS=$(LDFLAGSICUDT) >> $(OUTPUTFILE) + @echo LD_SONAME=$(LD_SONAME) >> $(OUTPUTFILE) + @echo RPATH_FLAGS=$(RPATH_FLAGS) >> $(OUTPUTFILE) +--- misc/icu/source/config/mh-linux 2010-09-29 20:37:36.000000000 +0200 ++++ misc/build/icu/source/config/mh-linux 2011-03-15 10:56:26.653056004 +0100 +@@ -20,6 +20,11 @@ + LD_RPATH= -Wl,-zorigin,-rpath,'$$'ORIGIN + LD_RPATH_PRE = -Wl,-rpath, + ++## Force RPATH=$ORIGIN to locate own dependencies w/o need for LD_LIBRARY_PATH ++## (incl. the C++ runtime libs potentially found in the URE lib dir): ++ENABLE_RPATH=YES ++RPATHLDFLAGS=${LD_RPATH_PRE}'$$ORIGIN:$$ORIGIN/../ure-link/lib' ++ + ## These are the library specific LDFLAGS + LDFLAGSICUDT=-nodefaultlibs -nostdlib + diff --git a/external/icu/icu4c-solarisgcc.patch b/external/icu/icu4c-solarisgcc.patch new file mode 100644 index 000000000000..cb668d8b49b1 --- /dev/null +++ b/external/icu/icu4c-solarisgcc.patch @@ -0,0 +1,12 @@ +diff -uriwb build/icu.old/source/common/uposixdefs.h misc/build/icu/source/common/uposixdefs.h +--- build/icu.old/source/common/uposixdefs.h 2012-04-05 21:46:18.000000000 +0100 ++++ build/icu/source/common/uposixdefs.h 2012-06-21 15:45:17.613369477 +0100 +@@ -52,7 +52,7 @@ + * + * z/OS needs this definition for timeval and to get usleep. + */ +-#if !defined(_XOPEN_SOURCE_EXTENDED) ++#if !defined(_XOPEN_SOURCE_EXTENDED) && (defined(__IBMC__) || defined(__IBMCPP__)) + # define _XOPEN_SOURCE_EXTENDED 1 + #endif + diff --git a/external/icu/icu4c-warnings.patch b/external/icu/icu4c-warnings.patch new file mode 100644 index 000000000000..1407f3b5a702 --- /dev/null +++ b/external/icu/icu4c-warnings.patch @@ -0,0 +1,21 @@ +--- misc/icu/source/common/unicode/utf16.h ++++ misc/build/icu/source/common/unicode/utf16.h +@@ -316,6 +316,7 @@ + (s)[(i)++]=(uint16_t)(((c)&0x3ff)|0xdc00); \ + } else /* c>0x10ffff or not enough space */ { \ + (isError)=TRUE; \ ++ (void)(isError); \ + } \ + } + +--- misc/icu/source/common/unicode/utypes.h ++++ misc/build/icu/source/common/unicode/utypes.h +@@ -399,7 +399,7 @@ typedef double UDate; + * some Linux/Unix compilers have problems with defining global new/delete. + * On Windows, it is _MSC_VER>=1200 for MSVC 6.0 and higher. + */ +-#if defined(__cplusplus) && U_DEBUG && U_OVERRIDE_CXX_ALLOCATION && (_MSC_VER>=1200) && !defined(U_STATIC_IMPLEMENTATION) && (defined(U_COMMON_IMPLEMENTATION) || defined(U_I18N_IMPLEMENTATION) || defined(U_IO_IMPLEMENTATION) || defined(U_LAYOUT_IMPLEMENTATION) || defined(U_LAYOUTEX_IMPLEMENTATION)) ++#if defined(__cplusplus) && U_DEBUG && U_OVERRIDE_CXX_ALLOCATION && defined (_MSC_VER) && (_MSC_VER>=1200) && !defined(U_STATIC_IMPLEMENTATION) && (defined(U_COMMON_IMPLEMENTATION) || defined(U_I18N_IMPLEMENTATION) || defined(U_IO_IMPLEMENTATION) || defined(U_LAYOUT_IMPLEMENTATION) || defined(U_LAYOUTEX_IMPLEMENTATION)) + + #ifndef U_HIDE_INTERNAL_API + /** diff --git a/external/icu/icu4c-wchar_t.patch b/external/icu/icu4c-wchar_t.patch new file mode 100644 index 000000000000..2360a08f03a6 --- /dev/null +++ b/external/icu/icu4c-wchar_t.patch @@ -0,0 +1,15 @@ +--- misc/icu/source/config/mh-cygwin-msvc 2012-05-10 11:42:22.886869800 +0100 ++++ misc/build/icu/source/config/mh-cygwin-msvc 2012-05-10 11:42:45.110227500 +0100 +@@ -43,10 +43,9 @@ + + # /GF pools strings and places them into read-only memory + # /EHsc enables exception handling +-# /Zc:wchar_t makes wchar_t a native type. Required for C++ ABI compatibility. + # -D_CRT_SECURE_NO_DEPRECATE is needed to quiet warnings about using standard C functions. +-CFLAGS+=/GF /nologo +-CXXFLAGS+=/GF /nologo /EHsc /Zc:wchar_t ++CFLAGS+=/GF /nologo /Zc:wchar_t- ++CXXFLAGS+=/GF /nologo /EHsc /Zc:wchar_t- + CPPFLAGS+=-D_CRT_SECURE_NO_DEPRECATE + DEFS+=-DWIN32 -DCYGWINMSVC + LDFLAGS+=/nologo diff --git a/external/icu/icu4c.10129.wintz.patch b/external/icu/icu4c.10129.wintz.patch new file mode 100644 index 000000000000..1c6ace908425 --- /dev/null +++ b/external/icu/icu4c.10129.wintz.patch @@ -0,0 +1,24 @@ +# Fix for fdo#59850 +# Patch was also submitted with https://ssl.icu-project.org/trac/ticket/10129 +# of which the outcome should be monitored. + +--- misc/icu/source/common/wintz.c ++++ misc/build/icu/source/common/wintz.c +@@ -254,7 +254,6 @@ + char apiStdName[MAX_LENGTH_ID]; + char regStdName[MAX_LENGTH_ID]; + char tmpid[MAX_LENGTH_ID]; +- int32_t apiStdLength = 0; + int32_t len; + int id; + int errorCode; +@@ -280,8 +279,8 @@ + + /* Convert the wchar_t* standard name to char* */ + uprv_memset(apiStdName, 0, sizeof(apiStdName)); +- u_strFromWCS(apiStd, MAX_LENGTH_ID, &apiStdLength, apiTZI.StandardName, -1, &status); +- u_austrncpy(apiStdName, apiStd, apiStdLength); ++ u_strFromWCS(apiStd, MAX_LENGTH_ID, NULL, apiTZI.StandardName, -1, &status); ++ u_austrncpy(apiStdName, apiStd, sizeof(apiStdName) - 1); + + tmpid[0] = 0; diff --git a/external/icu/icu4c.10318.CVE-2013-2924_changeset_34076.patch b/external/icu/icu4c.10318.CVE-2013-2924_changeset_34076.patch new file mode 100644 index 000000000000..90f50ab0318f --- /dev/null +++ b/external/icu/icu4c.10318.CVE-2013-2924_changeset_34076.patch @@ -0,0 +1,36 @@ +Index: /icu/trunk/source/i18n/csrucode.cpp +=================================================================== +--- a/orig.icu/source/i18n/csrucode.cpp (revision 34075) ++++ b/icu/source/i18n/csrucode.cpp (revision 34076) +@@ -1,5 +1,5 @@ + /* + ********************************************************************** +- * Copyright (C) 2005-2012, International Business Machines ++ * Copyright (C) 2005-2013, International Business Machines + * Corporation and others. All Rights Reserved. + ********************************************************************** +@@ -34,6 +34,7 @@ + const uint8_t *input = textIn->fRawInput; + int32_t confidence = 0; ++ int32_t length = textIn->fRawLength; + +- if (input[0] == 0xFE && input[1] == 0xFF) { ++ if (length >=2 && input[0] == 0xFE && input[1] == 0xFF) { + confidence = 100; + } +@@ -58,6 +59,7 @@ + const uint8_t *input = textIn->fRawInput; + int32_t confidence = 0; ++ int32_t length = textIn->fRawLength; + +- if (input[0] == 0xFF && input[1] == 0xFE && (input[2] != 0x00 || input[3] != 0x00)) { ++ if (length >= 4 && input[0] == 0xFF && input[1] == 0xFE && (input[2] != 0x00 || input[3] != 0x00)) { + confidence = 100; + } +@@ -82,5 +84,5 @@ + int32_t confidence = 0; + +- if (getChar(input, 0) == 0x0000FEFFUL) { ++ if (limit > 0 && getChar(input, 0) == 0x0000FEFFUL) { + hasBOM = TRUE; + } |