From 672bbce65d0a145db2ba99d9bab1767ef2f4efac Mon Sep 17 00:00:00 2001 From: "Zane U. Ji" Date: Sat, 19 Oct 2013 08:44:17 +0800 Subject: [PATCH] Fixed crashes in Xerces-C by using wide file names Xerces-C crashes when a file name is NULL. If the locale is wrong, wxString::mb_str returns NULL. Wide file names also enables opening a file with any characters in its name on Windows. Since there is no wide file names on POSIX, it doesn't make much difference except that the program is more stable. --- Makefile.in | 37 +++- aclocal.m4 | 50 +++--- configure | 338 +++++++++++++++++++------------------ configure.in | 15 ++ src/Makefile.in | 50 +++++- src/binaryfile.cpp | 24 +-- src/binaryfile.h | 3 +- src/housestyle.cpp | 40 ++--- src/housestyle.h | 44 ++--- src/styledialog.cpp | 30 ++-- src/styledialog.h | 7 +- src/validationthread.cpp | 4 +- src/validationthread.h | 5 +- src/wrapaspell.cpp | 12 +- src/wrapaspell.h | 7 +- src/wrapdaisy.cpp | 14 +- src/wrapdaisy.h | 2 +- src/wraplibxml.cpp | 6 +- src/wraplibxml.h | 3 +- src/wrapxerces.cpp | 38 ++++- src/wrapxerces.h | 4 +- src/xmlcopyeditor.h | 2 +- src/xmlctrl.cpp | 6 +- src/xmlctrl.h | 2 +- src/xmlpromptgenerator.cpp | 5 +- src/xmlschemagenerator.cpp | 3 +- 26 files changed, 418 insertions(+), 333 deletions(-) mode change 100755 => 100644 aclocal.m4 mode change 100755 => 100644 configure.in mode change 100755 => 100644 src/binaryfile.cpp mode change 100755 => 100644 src/binaryfile.h mode change 100755 => 100644 src/housestyle.cpp mode change 100755 => 100644 src/housestyle.h mode change 100755 => 100644 src/styledialog.cpp mode change 100755 => 100644 src/styledialog.h mode change 100755 => 100644 src/wrapaspell.cpp mode change 100755 => 100644 src/wrapaspell.h mode change 100755 => 100644 src/wrapdaisy.cpp mode change 100755 => 100644 src/wrapdaisy.h mode change 100755 => 100644 src/wraplibxml.cpp mode change 100755 => 100644 src/wraplibxml.h mode change 100755 => 100644 src/wrapxerces.cpp mode change 100755 => 100644 src/wrapxerces.h mode change 100755 => 100644 src/xmlcopyeditor.h mode change 100755 => 100644 src/xmlctrl.cpp mode change 100755 => 100644 src/xmlctrl.h mode change 100755 => 100644 src/xmlpromptgenerator.cpp diff --git a/Makefile.in b/Makefile.in index 7d698c7..7efb433 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.11.3 from Makefile.am. +# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -15,6 +15,23 @@ @SET_MAKE@ VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -56,6 +73,11 @@ RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ @@ -449,13 +471,10 @@ distdir: $(DISTFILES) done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ - test -d "$(distdir)/$$subdir" \ - || $(MKDIR_P) "$(distdir)/$$subdir" \ - || exit 1; \ - fi; \ - done - @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ @@ -541,7 +560,7 @@ distcheck: dist *.zip*) \ unzip $(distdir).zip ;;\ esac - chmod -R a-w $(distdir); chmod a+w $(distdir) + chmod -R a-w $(distdir); chmod u+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) diff --git a/aclocal.m4 b/aclocal.m4 old mode 100755 new mode 100644 index b7d128f..fe1f7d4 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,4 +1,4 @@ -# generated automatically by aclocal 1.11.3 -*- Autoconf -*- +# generated automatically by aclocal 1.11.6 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, @@ -14,8 +14,8 @@ m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],, -[m4_warning([this file was generated for autoconf 2.68. +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, +[m4_warning([this file was generated for autoconf 2.69. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) @@ -1338,7 +1338,14 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) - LD="${LD-ld} -m elf_i386" + case `/usr/bin/file conftest.o` in + *x86-64*) + LD="${LD-ld} -m elf32_x86_64" + ;; + *) + LD="${LD-ld} -m elf_i386" + ;; + esac ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" @@ -1702,7 +1709,8 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` - if test -n "$lt_cv_sys_max_cmd_len"; then + if test -n "$lt_cv_sys_max_cmd_len" && \ + test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else @@ -2526,17 +2534,6 @@ freebsd* | dragonfly*) esac ;; -gnu*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no @@ -2653,7 +2650,7 @@ linux*oldld* | linux*aout* | linux*coff*) ;; # This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no @@ -3269,10 +3266,6 @@ freebsd* | dragonfly*) fi ;; -gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - haiku*) lt_cv_deplibs_check_method=pass_all ;; @@ -3311,7 +3304,7 @@ irix5* | irix6* | nonstopux*) ;; # This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; @@ -4063,7 +4056,7 @@ m4_if([$1], [CXX], [ ;; esac ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # KAI C++ Compiler @@ -4362,7 +4355,7 @@ m4_if([$1], [CXX], [ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) @@ -6251,9 +6244,6 @@ if test "$_lt_caught_CXX_error" != yes; then _LT_TAGVAR(ld_shlibs, $1)=yes ;; - gnu*) - ;; - haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes @@ -6415,7 +6405,7 @@ if test "$_lt_caught_CXX_error" != yes; then _LT_TAGVAR(inherit_rpath, $1)=yes ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler @@ -8804,7 +8794,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.11' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.11.3], [], +m4_if([$1], [1.11.6], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -8820,7 +8810,7 @@ m4_define([_AM_AUTOCONF_VERSION], []) # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.11.3])dnl +[AM_AUTOMAKE_VERSION([1.11.6])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) diff --git a/configure b/configure index 2ab4e6a..021d585 100755 --- a/configure +++ b/configure @@ -1,11 +1,9 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68. +# Generated by GNU Autoconf 2.69. # # -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software -# Foundation, Inc. +# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation @@ -134,6 +132,31 @@ export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH +# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +as_fn_exit 255 + fi + # We don't want this to propagate to other subprocesses. + { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh @@ -167,7 +190,8 @@ if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi -test x\$exitcode = x0 || exit 1" +test x\$exitcode = x0 || exit 1 +test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && @@ -220,21 +244,25 @@ IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : - # We cannot yet assume a decent shell, so we have to provide a - # neutralization value for shells without unset; and this also - # works around shells that cannot unset nonexistent variables. - # Preserve -v and -x to the replacement shell. - BASH_ENV=/dev/null - ENV=/dev/null - (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV - export CONFIG_SHELL - case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; - esac - exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} + export CONFIG_SHELL + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 fi if test x$as_have_required = xno; then : @@ -336,6 +364,14 @@ $as_echo X"$as_dir" | } # as_fn_mkdir_p + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take @@ -457,6 +493,10 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). @@ -491,16 +531,16 @@ if (echo >conf$$.file) 2>/dev/null; then # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. + # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' + as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null @@ -512,28 +552,8 @@ else as_mkdir_p=false fi -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x +as_test_x='test -x' +as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -1222,8 +1242,6 @@ target=$target_alias if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe - $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used" >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi @@ -1494,9 +1512,9 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF configure -generated by GNU Autoconf 2.68 +generated by GNU Autoconf 2.69 -Copyright (C) 2010 Free Software Foundation, Inc. +Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -1610,7 +1628,7 @@ $as_echo "$ac_try_echo"; } >&5 test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext + test -x conftest$ac_exeext }; then : ac_retval=0 else @@ -1870,7 +1888,7 @@ $as_echo "$ac_try_echo"; } >&5 test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext + test -x conftest$ac_exeext }; then : ac_retval=0 else @@ -2067,7 +2085,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was -generated by GNU Autoconf 2.68. Invocation command line was +generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2482,7 +2500,7 @@ case $as_dir/ in #(( # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. @@ -2651,7 +2669,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2691,7 +2709,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2742,7 +2760,7 @@ do test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do - { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue + as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ @@ -2795,7 +2813,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2950,7 +2968,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2994,7 +3012,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CXX="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3812,7 +3830,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3852,7 +3870,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3905,7 +3923,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3946,7 +3964,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue @@ -4004,7 +4022,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -4048,7 +4066,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -4244,8 +4262,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include -#include -#include +struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); @@ -4480,7 +4497,7 @@ do for ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue + as_fn_executable_p "$ac_path_SED" || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in @@ -4556,7 +4573,7 @@ do for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue + as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in @@ -4622,7 +4639,7 @@ do for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue + as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in @@ -4689,7 +4706,7 @@ do for ac_prog in fgrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue + as_fn_executable_p "$ac_path_FGREP" || continue # Check for GNU ac_path_FGREP and select it if it is found. # Check for GNU $ac_path_FGREP case `"$ac_path_FGREP" --version 2>&1` in @@ -4945,7 +4962,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -4989,7 +5006,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -5178,7 +5195,8 @@ else ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` - if test -n "$lt_cv_sys_max_cmd_len"; then + if test -n "$lt_cv_sys_max_cmd_len" && \ + test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else @@ -5413,7 +5431,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -5453,7 +5471,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -5579,10 +5597,6 @@ freebsd* | dragonfly*) fi ;; -gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - haiku*) lt_cv_deplibs_check_method=pass_all ;; @@ -5621,7 +5635,7 @@ irix5* | irix6* | nonstopux*) ;; # This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; @@ -5759,7 +5773,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -5799,7 +5813,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -5903,7 +5917,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AR="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -5947,7 +5961,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6072,7 +6086,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6112,7 +6126,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6171,7 +6185,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6211,7 +6225,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6719,7 +6733,14 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) - LD="${LD-ld} -m elf_i386" + case `/usr/bin/file conftest.o` in + *x86-64*) + LD="${LD-ld} -m elf32_x86_64" + ;; + *) + LD="${LD-ld} -m elf_i386" + ;; + esac ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" @@ -6860,7 +6881,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6900,7 +6921,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6980,7 +7001,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -7020,7 +7041,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -7072,7 +7093,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -7112,7 +7133,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_NMEDIT="nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -7164,7 +7185,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_LIPO="${ac_tool_prefix}lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -7204,7 +7225,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_LIPO="lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -7256,7 +7277,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL="${ac_tool_prefix}otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -7296,7 +7317,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL="otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -7348,7 +7369,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -7388,7 +7409,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL64="otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -8553,7 +8574,7 @@ lt_prog_compiler_static= lt_prog_compiler_static='-non_shared' ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) @@ -10723,17 +10744,6 @@ freebsd* | dragonfly*) esac ;; -gnu*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no @@ -10850,7 +10860,7 @@ linux*oldld* | linux*aout* | linux*coff*) ;; # This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no @@ -12673,9 +12683,6 @@ fi ld_shlibs_CXX=yes ;; - gnu*) - ;; - haiku*) archive_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' link_all_deplibs_CXX=yes @@ -12837,7 +12844,7 @@ fi inherit_rpath_CXX=yes ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler @@ -13697,7 +13704,7 @@ lt_prog_compiler_static_CXX= ;; esac ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # KAI C++ Compiler @@ -14569,17 +14576,6 @@ freebsd* | dragonfly*) esac ;; -gnu*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no @@ -14696,7 +14692,7 @@ linux*oldld* | linux*aout* | linux*coff*) ;; # This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no @@ -15241,6 +15237,30 @@ fi +# Check unicode strings used in xercesc +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we support the unicode strings used in xercesc" >&5 +$as_echo_n "checking if we support the unicode strings used in xercesc... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include + #include + + int main() { + BOOST_STATIC_ASSERT(sizeof(XMLCh) == 1 || sizeof(XMLCh) == 2 || sizeof(XMLCh) == 4); + return 0; + } + +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + as_fn_error $? "no" "$LINENO" 5 + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + # Check expat is available ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' @@ -15285,7 +15305,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -15328,7 +15348,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -15935,16 +15955,16 @@ if (echo >conf$$.file) 2>/dev/null; then # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. + # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' + as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null @@ -16004,28 +16024,16 @@ else as_mkdir_p=false fi -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -16047,7 +16055,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # values after options handling. ac_log=" This file was extended by $as_me, which was -generated by GNU Autoconf 2.68. Invocation command line was +generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -16104,10 +16112,10 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ config.status -configured by $0, generated by GNU Autoconf 2.68, +configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" -Copyright (C) 2010 Free Software Foundation, Inc. +Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -16187,7 +16195,7 @@ fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then - set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' diff --git a/configure.in b/configure.in old mode 100755 new mode 100644 index 66900bc..587dd2d --- a/configure.in +++ b/configure.in @@ -108,6 +108,21 @@ AC_LANG(C++) AC_CHECK_HEADER(xercesc/util/PlatformUtils.hpp, , AC_MSG_ERROR([Xerces-C headers not found])) +# Check unicode strings used in xercesc +AC_MSG_CHECKING([if we support the unicode strings used in xercesc]) +AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ + #include + #include + + int main() { + BOOST_STATIC_ASSERT(sizeof(XMLCh) == 1 || sizeof(XMLCh) == 2 || sizeof(XMLCh) == 4); + return 0; + } + ]])], + [AC_MSG_RESULT([yes])], + [AC_MSG_ERROR([no]) +]) + # Check expat is available AC_LANG(C++) AC_CHECK_HEADER(expat.h, , diff --git a/src/Makefile.in b/src/Makefile.in index 12f98e7..1550dff 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.11.3 from Makefile.am. +# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -18,6 +18,23 @@ VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -98,6 +115,11 @@ CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(xmlcopyeditor_SOURCES) DIST_SOURCES = $(xmlcopyeditor_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ @@ -345,9 +367,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign src/Makefile + $(AUTOMAKE) --gnu src/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ @@ -368,8 +390,11 @@ $(ACLOCAL_M4): $(am__aclocal_m4_deps) $(am__aclocal_m4_deps): install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) - test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ + fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p || test -f $$p1; \ @@ -506,8 +531,11 @@ clean-libtool: -rm -rf .libs _libs install-applicationsDATA: $(applications_DATA) @$(NORMAL_INSTALL) - test -z "$(applicationsdir)" || $(MKDIR_P) "$(DESTDIR)$(applicationsdir)" @list='$(applications_DATA)'; test -n "$(applicationsdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(applicationsdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(applicationsdir)" || exit 1; \ + fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ @@ -524,15 +552,18 @@ uninstall-applicationsDATA: dir='$(DESTDIR)$(applicationsdir)'; $(am__uninstall_files_from_dir) install-nobase_dist_xmlcopyeditorDATA: $(nobase_dist_xmlcopyeditor_DATA) @$(NORMAL_INSTALL) - test -z "$(xmlcopyeditordir)" || $(MKDIR_P) "$(DESTDIR)$(xmlcopyeditordir)" @list='$(nobase_dist_xmlcopyeditor_DATA)'; test -n "$(xmlcopyeditordir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(xmlcopyeditordir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(xmlcopyeditordir)" || exit 1; \ + fi; \ $(am__nobase_list) | while read dir files; do \ xfiles=; for file in $$files; do \ if test -f "$$file"; then xfiles="$$xfiles $$file"; \ else xfiles="$$xfiles $(srcdir)/$$file"; fi; done; \ test -z "$$xfiles" || { \ test "x$$dir" = x. || { \ - echo "$(MKDIR_P) '$(DESTDIR)$(xmlcopyeditordir)/$$dir'"; \ + echo " $(MKDIR_P) '$(DESTDIR)$(xmlcopyeditordir)/$$dir'"; \ $(MKDIR_P) "$(DESTDIR)$(xmlcopyeditordir)/$$dir"; }; \ echo " $(INSTALL_DATA) $$xfiles '$(DESTDIR)$(xmlcopyeditordir)/$$dir'"; \ $(INSTALL_DATA) $$xfiles "$(DESTDIR)$(xmlcopyeditordir)/$$dir" || exit $$?; }; \ @@ -545,8 +576,11 @@ uninstall-nobase_dist_xmlcopyeditorDATA: dir='$(DESTDIR)$(xmlcopyeditordir)'; $(am__uninstall_files_from_dir) install-pixmapDATA: $(pixmap_DATA) @$(NORMAL_INSTALL) - test -z "$(pixmapdir)" || $(MKDIR_P) "$(DESTDIR)$(pixmapdir)" @list='$(pixmap_DATA)'; test -n "$(pixmapdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(pixmapdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(pixmapdir)" || exit 1; \ + fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ diff --git a/src/binaryfile.cpp b/src/binaryfile.cpp old mode 100755 new mode 100644 index e170a7e..e5b7711 --- a/src/binaryfile.cpp +++ b/src/binaryfile.cpp @@ -18,25 +18,20 @@ */ #include "binaryfile.h" -#include +#include -BinaryFile::BinaryFile ( const char *fname ) : m_data ( 0 ), m_dataLen ( 0 ) +BinaryFile::BinaryFile ( const wxString &fname ) : m_data ( 0 ), m_dataLen ( 0 ) { - FILE *pFile; + wxFileInputStream stream ( fname ); size_t lSize; char *buffer; - size_t result; - pFile = fopen ( fname, "rb" ); - if ( pFile == NULL ) + if ( !stream.IsOk() ) { return; } - // obtain file size - fseek ( pFile , 0 , SEEK_END ); - lSize = ftell ( pFile ); - rewind ( pFile ); + lSize = stream.GetSize(); // allocate memory to contain the whole file: @@ -48,18 +43,15 @@ BinaryFile::BinaryFile ( const char *fname ) : m_data ( 0 ), m_dataLen ( 0 ) } // copy the file into the buffer: - result = fread ( buffer, 1, lSize, pFile ); - if ( result != lSize ) + stream.Read ( buffer, lSize ); + if ( stream.LastRead() != lSize ) { - if ( !feof ( pFile ) ) + if ( !stream.Eof() ) return; } /* the whole file is now loaded in the memory buffer. */ - // terminate - fclose ( pFile ); - m_data = buffer; m_dataLen = lSize; } diff --git a/src/binaryfile.h b/src/binaryfile.h old mode 100755 new mode 100644 index a6b5fd0..4e9218b --- a/src/binaryfile.h +++ b/src/binaryfile.h @@ -22,11 +22,12 @@ #include #include +#include class BinaryFile { public: - BinaryFile ( const char *fname ); + BinaryFile ( const wxString &fname ); ~BinaryFile(); const char *getData(); size_t getDataLen(); diff --git a/src/housestyle.cpp b/src/housestyle.cpp old mode 100755 new mode 100644 index afe56c2..09e6c79 --- a/src/housestyle.cpp +++ b/src/housestyle.cpp @@ -25,14 +25,14 @@ HouseStyle::HouseStyle ( int typeParameter, const std::string& bufferParameter, - const std::string& ruleDirectoryParameter, - const std::string& ruleFileParameter, - const std::string& filterDirectoryParameter, - const std::string& filterFileParameter, - const std::string& pathSeparatorParameter, + const wxString& ruleDirectoryParameter, + const wxString& ruleFileParameter, + const wxString& filterDirectoryParameter, + const wxString& filterFileParameter, + const wxString& pathSeparatorParameter, #ifdef __WXMSW__ - const std::string& aspellDataPathParameter, - const std::string& aspellDictPathParameter, + const wxString& aspellDataPathParameter, + const wxString& aspellDictPathParameter, #endif int contextRangeParameter ) : type ( typeParameter ), @@ -43,21 +43,21 @@ HouseStyle::HouseStyle ( filterFile ( filterFileParameter ), pathSeparator ( pathSeparatorParameter ), #ifdef __WXMSW__ - aspellDataPath ( aspellDataPathParameter ), - aspellDictPath ( aspellDictPathParameter ), + aspellDataPath ( aspellDataPathParameter ), + aspellDictPath ( aspellDictPathParameter ), #endif contextRange ( contextRangeParameter ), ruleVector ( new std::vector > ), dictionary ( new StringSet ), passiveDictionary ( new StringSet ) -{ +{ } HouseStyle::~HouseStyle() {} void HouseStyle::collectFilter ( - std::string& fileName, + const std::string& fileName, std::set& excludeSet, int *filterCount ) { @@ -123,7 +123,7 @@ void HouseStyle::collectFilter ( */ } -void HouseStyle::collectRules ( string& fileName, +void HouseStyle::collectRules ( const std::string& fileName, boost::shared_ptr > > ruleVector, std::set& excludeSet, int *ruleCount ) @@ -132,7 +132,7 @@ void HouseStyle::collectRules ( string& fileName, return; std::string filePath, buffer; - filePath = ruleDirectory + pathSeparator + fileName; + filePath = (const char *) ( ruleDirectory + pathSeparator ).mb_str() + fileName; if ( !ReadFile::run ( filePath, buffer ) ) return; @@ -180,7 +180,7 @@ bool HouseStyle::createReport() { if ( type == HS_TYPE_STYLE && !updateRules() ) { - error = "no rules found"; + error = _ ( "no rules found" ); return false; } @@ -190,7 +190,7 @@ bool HouseStyle::createReport() auto_ptr xtr ( new HouseStyleReader ( filterMap ) ); if ( !xtr->parse ( buffer ) ) { - error = "file is not well-formed"; + error = _ ( "file is not well-formed" ); return false; } */ @@ -219,7 +219,7 @@ bool HouseStyle::createReport() } catch (...) { - error = "Cannot initialise spellcheck"; + error = _ ( "Cannot initialise spellcheck" ); return false; } @@ -314,12 +314,12 @@ bool HouseStyle::createReport() return true; } -std::string HouseStyle::getLastError() +const wxString &HouseStyle::getLastError() { return error; } -std::vector HouseStyle::getMatchVector() +const std::vector &HouseStyle::getMatchVector() { return matchVector; } @@ -332,7 +332,7 @@ int HouseStyle::updateRules() int ruleCount = 0; set excludeSet; - collectRules ( ruleFile, ruleVector, excludeSet, &ruleCount ); + collectRules ( ( const char * ) ruleFile.mb_str(), ruleVector, excludeSet, &ruleCount ); return ruleCount; } @@ -341,7 +341,7 @@ int HouseStyle::updateFilter() filterMap.clear(); int filterCount = 0; set excludeSet; - collectFilter ( filterFile, excludeSet, &filterCount ); + collectFilter ( ( const char * ) filterFile.mb_str(), excludeSet, &filterCount ); return filterCount; } diff --git a/src/housestyle.h b/src/housestyle.h old mode 100755 new mode 100644 index 4529bcd..58d3412 --- a/src/housestyle.h +++ b/src/housestyle.h @@ -45,46 +45,46 @@ class HouseStyle HouseStyle ( int type, const std::string& bufferParameter, - const std::string& ruleDirectoryParameter, - const std::string& ruleFileParameter, - const std::string& filterDirectoryParameter, - const std::string& filterFileParameter, - const std::string& pathSeparatorParameter, + const wxString& ruleDirectoryParameter, + const wxString& ruleFileParameter, + const wxString& filterDirectoryParameter, + const wxString& filterFileParameter, + const wxString& pathSeparatorParameter, #ifdef __WXMSW__ - const std::string& aspellDataPathParameter, - const std::string& aspellDictPathParameter, + const wxString& aspellDataPathParameter, + const wxString& aspellDictPathParameter, #endif int contextRangeParameter ); ~HouseStyle(); bool createReport(); - std::string getLastError(); - std::vector getMatchVector(); + const wxString &getLastError(); + const std::vector &getMatchVector(); private: int type; - std::string buffer - , ruleDirectory - , ruleFile - , filterDirectory - , filterFile - , pathSeparator - , error + std::string buffer; + wxString ruleDirectory + , ruleFile + , filterDirectory + , filterFile + , pathSeparator + , error #ifdef __WXMSW__ - , aspellDataPath - , aspellDictPath + , aspellDataPath + , aspellDictPath #endif - ; + ; int contextRange; boost::shared_ptr > > ruleVector; std::map > > - filterMap; + filterMap; std::vector matchVector; boost::shared_ptr > dictionary, passiveDictionary; void collectFilter ( - std::string& fileName, + const std::string& fileName, std::set& excludeSet, int *filterCount ); void collectRules ( - string& fileName, + const std::string& fileName, boost::shared_ptr > > ruleVector, std::set& excludeSet, int *ruleCount ); diff --git a/src/styledialog.cpp b/src/styledialog.cpp old mode 100755 new mode 100644 index be72465..0cf6343 --- a/src/styledialog.cpp +++ b/src/styledialog.cpp @@ -89,8 +89,8 @@ StyleDialog::StyleDialog ( const wxString& ruleSetPresetParameter, const wxString& filterPresetParameter, #if !defined(USE_ENCHANT) && defined(__WXMSW__) - const std::string& aspellDataPathParameter, - const std::string& aspellDictPathParameter, + const wxString& aspellDataPathParameter, + const wxString& aspellDictPathParameter, #endif int typeParameter, bool readOnlyParameter, @@ -278,8 +278,8 @@ StyleDialog::StyleDialog ( config = new_aspell_config(); #ifdef __WXMSW__ - aspell_config_replace ( config, "data-dir", aspellDataPath.c_str() ); //ASPELL_DATA_PATH ); - aspell_config_replace ( config, "dict-dir", aspellDictPath.c_str() ); //ASPELL_DICT_PATH ); + aspell_config_replace ( config, "data-dir", aspellDataPath.mb_str() ); //ASPELL_DATA_PATH ); + aspell_config_replace ( config, "dict-dir", aspellDictPath.mb_str() ); //ASPELL_DICT_PATH ); #endif dlist = get_aspell_dict_info_list( config ); @@ -454,32 +454,26 @@ void StyleDialog::OnReport ( wxCommandEvent& event ) ruleSet.Replace ( _(" "), _T("_") ); filter = filterPreset + _T ( ".xml" ); - std::string ruleSetDirectoryLocal ( ruleSetDirectory.mb_str ( wxConvLocal ) ); - std::string ruleSetUtf8 ( ruleSet.mb_str ( wxConvUTF8 ) ); - std::string filterDirectoryLocal ( filterDirectory.mb_str ( wxConvLocal ) ); - std::string filterUtf8 ( filter.mb_str ( wxConvUTF8 ) ); wxString separator = wxFileName::GetPathSeparator(); - std::string pathSeparatorLocal ( separator.mb_str ( wxConvLocal ) ); std::auto_ptr hs ( new HouseStyle ( (type == ID_TYPE_SPELL) ? HS_TYPE_SPELL : HS_TYPE_STYLE, bufferUtf8, - ruleSetDirectoryLocal, - ruleSetUtf8, - filterDirectoryLocal, - filterUtf8, - pathSeparatorLocal, + ruleSetDirectory, + ruleSet, + filterDirectory, + filter, + separator, #ifdef __WXMSW__ - aspellDataPath, - aspellDictPath, + aspellDataPath, + aspellDictPath, #endif 5 ) ); status->SetStatusText ( _ ( "Checking document..." ) ); if ( !hs->createReport() ) { - std::string lastError = hs->getLastError(); - wxString error = wxString ( lastError.c_str(), wxConvUTF8, lastError.size() ); + const wxString &error = hs->getLastError(); status->SetStatusText ( _ ( "Cannot check document: " ) + error ); return; } diff --git a/src/styledialog.h b/src/styledialog.h old mode 100755 new mode 100644 index 201e9c8..8761456 --- a/src/styledialog.h +++ b/src/styledialog.h @@ -73,8 +73,8 @@ class StyleDialog : public wxDialog const wxString& ruleSetPresetParameter, const wxString& filterPresetParameter, #ifdef __WXMSW__ - const std::string& aspellDataPath, - const std::string& aspellDictPath, + const wxString& aspellDataPath, + const wxString& aspellDictPath, #endif int type = ID_TYPE_STYLE, bool readOnlyParameter = false, @@ -118,7 +118,8 @@ class StyleDialog : public wxDialog wxComboBox *ruleSetCombo, *filterCombo; wxListCtrl *table; wxStatusBar *status; - std::string bufferUtf8, aspellDataPath, aspellDictPath; + std::string bufferUtf8; + wxString aspellDataPath, aspellDictPath; std::set tempFiles; wxString fileName, ruleSetDirectory, filterDirectory; wxString ruleSetPreset, filterPreset; diff --git a/src/validationthread.cpp b/src/validationthread.cpp index 79e0416..722ba1a 100644 --- a/src/validationthread.cpp +++ b/src/validationthread.cpp @@ -13,7 +13,7 @@ DEFINE_EVENT_TYPE(wxEVT_COMMAND_VALIDATION_COMPLETED); ValidationThread::ValidationThread ( wxEvtHandler *handler, const char *buffer, - const char *system ) + const wxString &system ) : wxThread ( wxTHREAD_JOINABLE ) , mStopping ( false ) { @@ -40,7 +40,7 @@ void *ValidationThread::Entry() myIsSucceeded = validator->validateMemory ( myBuffer.c_str(), myBuffer.size(), - mySystem.c_str(), + mySystem, this ); if ( TestDestroy() ) diff --git a/src/validationthread.h b/src/validationthread.h index 543fbba..bfb0384 100644 --- a/src/validationthread.h +++ b/src/validationthread.h @@ -14,7 +14,7 @@ public: ValidationThread ( wxEvtHandler *handler, const char *buffer, - const char *system ); + const wxString &system ); virtual void *Entry(); void setBuffer ( const char *buffer, const char *system ); bool isSucceeded () { return myIsSucceeded; } @@ -29,7 +29,8 @@ public: protected: wxEvtHandler *myEventHandler; - std::string myBuffer, mySystem; + std::string myBuffer; + wxString mySystem; bool myIsSucceeded; std::pair myPosition; wxString myMessage; diff --git a/src/wrapaspell.cpp b/src/wrapaspell.cpp old mode 100755 new mode 100644 index 96822fe..180218e --- a/src/wrapaspell.cpp +++ b/src/wrapaspell.cpp @@ -30,11 +30,11 @@ #include "getword.h" WrapAspell::WrapAspell ( - std::string lang + const wxString lang #if !defined(USE_ENCHANT) && defined(__WXMSW__) , - const std::string& aspellDataPathParameter, - const std::string& aspellDictPathParameter + const wxString& aspellDataPathParameter, + const wxString& aspellDictPathParameter #endif ) { @@ -45,11 +45,11 @@ WrapAspell::WrapAspell ( spell_config = new_aspell_config(); #ifdef __WXMSW__ - aspell_config_replace ( spell_config, "data-dir", aspellDataPathParameter.c_str() );//ASPELL_DATA_PATH ); - aspell_config_replace ( spell_config, "dict-dir", aspellDictPathParameter.c_str() );//ASPELL_DICT_PATH ); + aspell_config_replace ( spell_config, "data-dir", aspellDataPathParameter.mb_str() );//ASPELL_DATA_PATH ); + aspell_config_replace ( spell_config, "dict-dir", aspellDictPathParameter.mb_str() );//ASPELL_DICT_PATH ); #endif - aspell_config_replace ( spell_config, "lang", lang.c_str() ); + aspell_config_replace ( spell_config, "lang", lang.mb_str() ); AspellCanHaveError * possible_err = new_aspell_speller ( spell_config ); spell_checker = 0; if ( aspell_error_number ( possible_err ) != 0) diff --git a/src/wrapaspell.h b/src/wrapaspell.h old mode 100755 new mode 100644 index 4c512f9..ca59799 --- a/src/wrapaspell.h +++ b/src/wrapaspell.h @@ -22,6 +22,7 @@ #include #include +#include #include "contexthandler.h" #if !defined(USE_ENCHANT) #include "aspell.h" @@ -37,10 +38,10 @@ class WrapAspell { public: WrapAspell ( - std::string lang// = "en_US", + const wxString lang// = "en_US", #if !defined(USE_ENCHANT) && defined(__WXMSW__) - , const std::string& aspellDataPathParameter, - const std::string& aspellDictPath + , const wxString& aspellDataPathParameter, + const wxString& aspellDictPath #endif ); ~WrapAspell(); diff --git a/src/wrapdaisy.cpp b/src/wrapdaisy.cpp old mode 100755 new mode 100644 index c12f717..0be42f3 --- a/src/wrapdaisy.cpp +++ b/src/wrapdaisy.cpp @@ -145,9 +145,9 @@ bool WrapDaisy::run ( } else // no stylesheet { - BinaryFile bf( stdFileIn.c_str() ); - if ( !bf.getData() ) - { + BinaryFile bf( fileIn ); + if ( !bf.getData() ) + { output.append ( bf.getData(), bf.getDataLen() ); error = _( "Cannot read [b]" ) + fileIn + ( _("[/b]") ); return false; @@ -727,15 +727,13 @@ bool WrapDaisy::run ( _T("z3986") + wxFileName::GetPathSeparator(); fileWithSmilAttribs = folderWithSmilFile + fn.GetFullName(); - std::string file = ( const char *) fileWithSmilAttribs.mb_str ( wxConvUTF8 ); - auto_ptr ma ( new Mp3Album() ); BinaryFile *binaryfile; - binaryfile = new BinaryFile ( file.c_str() ); + binaryfile = new BinaryFile ( fileWithSmilAttribs ); if ( !binaryfile->getData() ) { - error.Printf ( _ ( "Cannot open %s" ), file.c_str() ); + error.Printf ( _ ( "Cannot open %s" ), fileWithSmilAttribs.c_str() ); return false; } @@ -800,7 +798,7 @@ bool WrapDaisy::run ( return true; } -wxString WrapDaisy::getLastError() +const wxString &WrapDaisy::getLastError() { return error; } diff --git a/src/wrapdaisy.h b/src/wrapdaisy.h old mode 100755 new mode 100644 index 556fd30..3f0dee5 --- a/src/wrapdaisy.h +++ b/src/wrapdaisy.h @@ -23,7 +23,7 @@ public: bool doc, bool fullDaisy, bool mp3Album ); - wxString getLastError(); + const wxString &getLastError(); private: MyFrame *frame; wxString daisyDir, path, blankImage, classPath, commandLineUI, baseCmd, error, diff --git a/src/wraplibxml.cpp b/src/wraplibxml.cpp old mode 100755 new mode 100644 index afe21ce..67a91cd --- a/src/wraplibxml.cpp +++ b/src/wraplibxml.cpp @@ -32,7 +32,7 @@ class Initializer { public: - Initializer ( const std::string &catalogPath ) throw () + Initializer ( const wxString &catalogPath ) throw () { xmlSetGenericErrorFunc ( xmlGenericErrorContext, &Initializer::OnXmlGenericError ); @@ -40,7 +40,7 @@ public: LIBXML_TEST_VERSION xmlInitializeCatalog(); - xmlLoadCatalog ( catalogPath.c_str() ); + xmlLoadCatalog ( catalogPath.mb_str() ); initGenericErrorDefaultFunc ( NULL ); } @@ -83,7 +83,7 @@ public: } }; -void WrapLibxml::Init ( const std::string &catalogPath ) throw() +void WrapLibxml::Init ( const wxString &catalogPath ) throw() { static Initializer dummy ( catalogPath ); } diff --git a/src/wraplibxml.h b/src/wraplibxml.h old mode 100755 new mode 100644 index 4c24292..1d1a73c --- a/src/wraplibxml.h +++ b/src/wraplibxml.h @@ -34,11 +34,12 @@ #include #include #include +#include class WrapLibxml { public: - static void Init ( const std::string &catalogPath = "catalog" ) throw(); + static void Init ( const wxString &catalogPath = _T ( "catalog" ) ) throw(); WrapLibxml ( bool netAccessParameter = false ); virtual ~WrapLibxml(); diff --git a/src/wrapxerces.cpp b/src/wrapxerces.cpp old mode 100755 new mode 100644 index 971e23d..ae43294 --- a/src/wrapxerces.cpp +++ b/src/wrapxerces.cpp @@ -27,6 +27,7 @@ #include #include #include +#include using namespace xercesc; @@ -114,7 +115,7 @@ bool WrapXerces::validate ( const std::string& fileName ) bool WrapXerces::validateMemory ( const char *buffer, size_t len, - const char *system, + const wxString &system, wxThread *thread /*= NULL*/ ) { std::auto_ptr parser ( XMLReaderFactory::createXMLReader() ); @@ -135,8 +136,11 @@ bool WrapXerces::validateMemory ( parser->setEntityResolver ( catalogResolver ); XMLByte* xmlBuffer = (XMLByte*) buffer; - MemBufInputSource source ( xmlBuffer, len, system ); - + MemBufInputSource source + ( xmlBuffer + , len + , ( const XMLCh * ) ( const char * ) system.mb_str ( getMBConv() ) + ); try { if ( thread == NULL ) @@ -189,9 +193,31 @@ std::pair WrapXerces::getErrorPosition() return errorPosition; } +const wxMBConv &WrapXerces::getMBConv() +{ + switch ( sizeof ( XMLCh ) ) + { + case 1: + return wxConvUTF8; + case 2: + { + const static wxMBConvUTF16 conv; + return conv; + } + case 4: + { + const static wxMBConvUTF32 conv; + return conv; + } + default: + BOOST_STATIC_ASSERT_MSG ( sizeof ( XMLCh ) == 2 + , "Xerces-C doesn't use UTF-16 strings any more"); + break; + } + return wxConvUTF8; +} + wxString WrapXerces::toString ( const XMLCh *str ) { - static wxMBConvUTF16 conv; - - return wxString ( ( const char * ) str, conv ); + return wxString ( ( const char * ) str, getMBConv() ); } diff --git a/src/wrapxerces.h b/src/wrapxerces.h old mode 100755 new mode 100644 index 58b2f41..52e5f43 --- a/src/wrapxerces.h +++ b/src/wrapxerces.h @@ -21,6 +21,7 @@ #define WRAP_XERCES #include +#include #include #include @@ -42,9 +43,10 @@ class WrapXerces virtual ~WrapXerces(); bool validate ( const std::string& fileName ); bool validateMemory ( const char *buffer, size_t len, - const char *system, wxThread *thread = NULL ); + const wxString &system, wxThread *thread = NULL ); const wxString &getLastError(); std::pair getErrorPosition(); + static const wxMBConv &getMBConv(); static wxString toString ( const XMLCh *str ); private: XercesCatalogResolver *catalogResolver; diff --git a/src/xmlcopyeditor.h b/src/xmlcopyeditor.h old mode 100755 new mode 100644 index 9f5b54b..376b5b9 --- a/src/xmlcopyeditor.h +++ b/src/xmlcopyeditor.h @@ -372,7 +372,7 @@ class MyFrame : public wxFrame MyNotebook *mainBook; MyHtmlPane *htmlReport; - std::string catalogPath, xslDtdPath, rssDtdPath, lzxDtdPath, xtmDtdPath, + wxString catalogPath, xslDtdPath, rssDtdPath, lzxDtdPath, xtmDtdPath, xliffDtdPath, aspellDataPath, aspellDictPath; std::pair controlCoordinates; std::map > > diff --git a/src/xmlctrl.cpp b/src/xmlctrl.cpp old mode 100755 new mode 100644 index 21f45c6..1e69de5 --- a/src/xmlctrl.cpp +++ b/src/xmlctrl.cpp @@ -1954,14 +1954,14 @@ bool XmlCtrl::backgroundValidate() return backgroundValidate ( bufferUtf8.c_str(), - basePath.mb_str(), + basePath, bufferUtf8.size() ); } bool XmlCtrl::backgroundValidate ( const char *buffer, - const char *system, - size_t bufferLen + const wxString &system, + size_t bufferLen ) { if ( !validationRequired ) diff --git a/src/xmlctrl.h b/src/xmlctrl.h old mode 100755 new mode 100644 index 3b67645..10d749c --- a/src/xmlctrl.h +++ b/src/xmlctrl.h @@ -139,7 +139,7 @@ class XmlCtrl: public wxStyledTextCtrl bool backgroundValidate ( ); bool backgroundValidate ( const char *buffer, - const char *system, + const wxString &system, size_t bufferLen ); std::string myGetTextRaw(); // alternative to faulty stc implementation bool getValidationRequired(); diff --git a/src/xmlpromptgenerator.cpp b/src/xmlpromptgenerator.cpp old mode 100755 new mode 100644 index 8b19c09..27678fb --- a/src/xmlpromptgenerator.cpp +++ b/src/xmlpromptgenerator.cpp @@ -431,7 +431,10 @@ void XmlPromptGenerator::handleSchema ( parser->setDoSchema ( true ); parser->setValidationSchemaFullChecking ( true ); - Grammar *rootGrammar = parser->loadGrammar ( schemaPath.mb_str(), Grammar::SchemaGrammarType ); + Grammar *rootGrammar = parser->loadGrammar + ( ( const XMLCh * ) ( const char * ) schemaPath.mb_str ( WrapXerces::getMBConv() ) + , Grammar::SchemaGrammarType + ); if ( !rootGrammar ) { return; diff --git a/src/xmlschemagenerator.cpp b/src/xmlschemagenerator.cpp index 6947809..74d9022 100644 --- a/src/xmlschemagenerator.cpp +++ b/src/xmlschemagenerator.cpp @@ -203,9 +203,8 @@ void XmlSchemaGenerator::generateData ( const wxString &elementName, continue; for ( attrItr = attrMap.begin(); attrItr != attrMap.end(); attrItr++ ) { - const static wxMBConvUTF16 conv; if ( attrs->getNamedItem ( ( const XMLCh * ) ( const char * ) - attrItr->first.mb_str ( conv ) ) == NULL ) + attrItr->first.mb_str ( WrapXerces::getMBConv() ) ) == NULL ) { optAttrs.insert ( attrItr->first ); }