Merge pull request #23 from Tripwire/dev/2435
Open Source Tripwire 2.4.3.5
This commit is contained in:
commit
7af2781a19
|
@ -12,6 +12,7 @@ src/tripwire/tripwire
|
||||||
src/twadmin/twadmin
|
src/twadmin/twadmin
|
||||||
src/twprint/twprint
|
src/twprint/twprint
|
||||||
src/twtest/twtest
|
src/twtest/twtest
|
||||||
|
src/test-harness/twtest
|
||||||
**/Makefile
|
**/Makefile
|
||||||
**/*.o
|
**/*.o
|
||||||
**/*.dylib
|
**/*.dylib
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
2017-03-30 Brian Cox <bcox@tripwire.com>
|
||||||
|
* Bump version to 2.4.3.5
|
||||||
|
* Fix ‘install-strip’, ‘check’, ‘uninstall’, and ‘distcheck’ make targets.
|
||||||
|
* Fix GCC 7.0.x warnings; use std::unique_ptr instead of deprecated std::auto_ptr where available.
|
||||||
|
* Add ‘--disable-extrawarnings’ configure option, for old compilers that don’t support the ’-Wextra’ compile option.
|
||||||
|
* Clean up unit tests & enable disabled tests.
|
||||||
|
* Address more static analyzer warnings, including from CppCheck & Flawfinder
|
||||||
|
|
||||||
2017-03-05 Brian Cox <bcox@tripwire.com>
|
2017-03-05 Brian Cox <bcox@tripwire.com>
|
||||||
* Bump version to 2.4.3.4
|
* Bump version to 2.4.3.4
|
||||||
* Fix issue with printing level 2 reports, introduced by fixing a Clang static analyzer quibble in 2.4.3.3. Sigh.
|
* Fix issue with printing level 2 reports, introduced by fixing a Clang static analyzer quibble in 2.4.3.3. Sigh.
|
||||||
|
|
11
Makefile.am
11
Makefile.am
|
@ -6,4 +6,13 @@ install-data-hook:
|
||||||
export INSTALL_STRIP_FLAG
|
export INSTALL_STRIP_FLAG
|
||||||
prefix="$(prefix)" sysconfdir="$(sysconfdir)" \
|
prefix="$(prefix)" sysconfdir="$(sysconfdir)" \
|
||||||
path_to_vi="$(path_to_vi)" path_to_sendmail="$(path_to_sendmail)" \
|
path_to_vi="$(path_to_vi)" path_to_sendmail="$(path_to_sendmail)" \
|
||||||
./installer/install.sh
|
$(top_srcdir)/installer/install.sh
|
||||||
|
|
||||||
|
uninstall-hook:
|
||||||
|
rm -f ${prefix}/sbin/tripwire $(prefix)/sbin/twadmin $(prefix)/sbin/twprint $(prefix)/sbin/siggen
|
||||||
|
rm -Rf $(prefix)/doc
|
||||||
|
|
||||||
|
check:
|
||||||
|
rm -Rf $(top_srcdir)/src/test-harness/twtest
|
||||||
|
cd $(top_srcdir)/src/test-harness && perl ./twtest.pl
|
||||||
|
$(top_srcdir)/bin/twtest all
|
||||||
|
|
18
Makefile.in
18
Makefile.in
|
@ -774,9 +774,10 @@ ps: ps-recursive
|
||||||
ps-am:
|
ps-am:
|
||||||
|
|
||||||
uninstall-am:
|
uninstall-am:
|
||||||
|
@$(NORMAL_INSTALL)
|
||||||
|
$(MAKE) $(AM_MAKEFLAGS) uninstall-hook
|
||||||
.MAKE: $(am__recursive_targets) all install-am install-data-am \
|
.MAKE: $(am__recursive_targets) all install-am install-data-am \
|
||||||
install-strip
|
install-strip uninstall-am
|
||||||
|
|
||||||
.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
|
.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
|
||||||
am--refresh check check-am clean clean-cscope clean-generic \
|
am--refresh check check-am clean clean-cscope clean-generic \
|
||||||
|
@ -792,7 +793,7 @@ uninstall-am:
|
||||||
install-strip installcheck installcheck-am installdirs \
|
install-strip installcheck installcheck-am installdirs \
|
||||||
installdirs-am maintainer-clean maintainer-clean-generic \
|
installdirs-am maintainer-clean maintainer-clean-generic \
|
||||||
mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \
|
mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \
|
||||||
tags-am uninstall uninstall-am
|
tags-am uninstall uninstall-am uninstall-hook
|
||||||
|
|
||||||
.PRECIOUS: Makefile
|
.PRECIOUS: Makefile
|
||||||
|
|
||||||
|
@ -801,7 +802,16 @@ install-data-hook:
|
||||||
export INSTALL_STRIP_FLAG
|
export INSTALL_STRIP_FLAG
|
||||||
prefix="$(prefix)" sysconfdir="$(sysconfdir)" \
|
prefix="$(prefix)" sysconfdir="$(sysconfdir)" \
|
||||||
path_to_vi="$(path_to_vi)" path_to_sendmail="$(path_to_sendmail)" \
|
path_to_vi="$(path_to_vi)" path_to_sendmail="$(path_to_sendmail)" \
|
||||||
./installer/install.sh
|
$(top_srcdir)/installer/install.sh
|
||||||
|
|
||||||
|
uninstall-hook:
|
||||||
|
rm -f ${prefix}/sbin/tripwire $(prefix)/sbin/twadmin $(prefix)/sbin/twprint $(prefix)/sbin/siggen
|
||||||
|
rm -Rf $(prefix)/doc
|
||||||
|
|
||||||
|
check:
|
||||||
|
rm -Rf $(top_srcdir)/src/test-harness/twtest
|
||||||
|
cd $(top_srcdir)/src/test-harness && perl ./twtest.pl
|
||||||
|
$(top_srcdir)/bin/twtest all
|
||||||
|
|
||||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||||
|
|
40
ReadMe-2.4.3
40
ReadMe-2.4.3
|
@ -1,4 +1,14 @@
|
||||||
What's new in Open Source Tripwire 2.4.3.2:
|
What's new in Open Source Tripwire 2.4.3.x:
|
||||||
|
|
||||||
|
* Useful ‘install-strip’, ‘check’, ‘uninstall’ & ‘distcheck’ make targets as of OST 2.4.3.5. Check target invokes both the test-harness framework and twtest unit tests.
|
||||||
|
|
||||||
|
* Verify OST builds without errors w/ GCC 7.0.x; fix new warnings from the new compiler, including deprecation warnings; use std::unique_ptr instead of std::auto_ptr where available.
|
||||||
|
|
||||||
|
* Add ‘--disable-extrawarnings’ configure option, for old compilers that don’t support the ’-Wextra’ compile option.
|
||||||
|
|
||||||
|
* Clean up unit tests, enable various disabled tests, make results more useful.
|
||||||
|
|
||||||
|
* Additional cleanup due to static analysis tool results (CppCheck, Flawfinder, Clang analyzer).
|
||||||
|
|
||||||
* OST now includes optional iconv support when configured with --enable-iconv.
|
* OST now includes optional iconv support when configured with --enable-iconv.
|
||||||
When enabled, binary database & report files store paths as UTF-16, making these files more
|
When enabled, binary database & report files store paths as UTF-16, making these files more
|
||||||
|
@ -29,11 +39,6 @@ specifying a build directory outside the source dir now works as expected.
|
||||||
* Assorted platform tweaks: Add DOS/FreeDOS + DJGPP as a new platform; support Cygwin
|
* Assorted platform tweaks: Add DOS/FreeDOS + DJGPP as a new platform; support Cygwin
|
||||||
//host/share/path syntax for UNC paths; passphrase & tempfile fixes for AROS.
|
//host/share/path syntax for UNC paths; passphrase & tempfile fixes for AROS.
|
||||||
|
|
||||||
|
|
||||||
======================================
|
|
||||||
|
|
||||||
What was new in earlier 2.4.3 versions:
|
|
||||||
|
|
||||||
* This update fixes compilation errors on modern compilers (GCC 4.7+ and LLVM/clang),
|
* This update fixes compilation errors on modern compilers (GCC 4.7+ and LLVM/clang),
|
||||||
as well as some additional errors encountered on various platforms. This is intended
|
as well as some additional errors encountered on various platforms. This is intended
|
||||||
to supersede patches against 2.4.2.x, e.g. http://www.linuxfromscratch.org/blfs/view/svn/postlfs/tripwire.html
|
to supersede patches against 2.4.2.x, e.g. http://www.linuxfromscratch.org/blfs/view/svn/postlfs/tripwire.html
|
||||||
|
@ -66,15 +71,22 @@ defined incorrectly otherwise.
|
||||||
The update has been tested on a variety of platforms:
|
The update has been tested on a variety of platforms:
|
||||||
|
|
||||||
Linuxes
|
Linuxes
|
||||||
- CentOS 7 (amd64) + gcc 4.8.5
|
|
||||||
- Ubuntu 14.0.4 (amd64) + gcc 4.x
|
|
||||||
- RHEL 3.4 (Itanium) + gcc 3.4.3
|
|
||||||
- Alpine Linux 3.3.3 + gcc 5.3.0
|
- Alpine Linux 3.3.3 + gcc 5.3.0
|
||||||
- Android 6.0 (arm) + gcc 4.9
|
- Alpine Linux 3.5.1 + gcc 6.2.1
|
||||||
- Raspbian 7 (wheezy) (armv6l) + gcc 4.6.3
|
- Arch Linux 232 + gcc 6.3.1
|
||||||
- openSuSE Tumbleweed (20160408) (i586) + gcc 5.3.1
|
- Amazon Linux AMI 2016.09 + gcc 4.8.3
|
||||||
- RHEL 6.0 (powerpc64) + gcc 4.4.4
|
- Android 6.0 (arm) + gcc 4.9 (NDK)
|
||||||
|
- CentOS 7 (amd64) + gcc 4.8.5
|
||||||
- Fedora 24 Alpha 7 (amd64) + gcc 6.0.0
|
- Fedora 24 Alpha 7 (amd64) + gcc 6.0.0
|
||||||
|
- Fedora 27 Rawhide (amd64) + gcc 7.0.1
|
||||||
|
- Raspbian 7 (wheezy) (armv6l) + gcc 4.6.3
|
||||||
|
- RHEL 3.4 (Itanium) + gcc 3.4.3
|
||||||
|
- RHEL 6.0 (powerpc64) + gcc 4.4.4
|
||||||
|
- openSuSE Tumbleweed (20160408) (i586) + gcc 5.3.1
|
||||||
|
- Oracle Linux 6.8 + gcc 4.4.7
|
||||||
|
- Ubuntu 14.0.4 (amd64) + gcc 4.x
|
||||||
|
- Ubuntu 16.0.4 (amd64) + gcc 5.4.0
|
||||||
|
- Wind River Pulsar Linux 8 + gcc 5.2.0
|
||||||
|
|
||||||
OSX
|
OSX
|
||||||
- Mac OS X 10.11 + LLVM 7.0.2 / clang-700.1.81
|
- Mac OS X 10.11 + LLVM 7.0.2 / clang-700.1.81
|
||||||
|
@ -90,7 +102,7 @@ BSDs
|
||||||
UNIXes
|
UNIXes
|
||||||
- Solaris 10 SPARC + gcc 3.4.6
|
- Solaris 10 SPARC + gcc 3.4.6
|
||||||
- Solaris 10 x86 + gcc 3.4.3
|
- Solaris 10 x86 + gcc 3.4.3
|
||||||
- OpenIndiana 151 + gcc 4.8.5 [an OpenSolaris/illumos distro]
|
- OpenIndiana 151 + gcc 4.8.5
|
||||||
- AIX 5.2 + gcc 4.3.1
|
- AIX 5.2 + gcc 4.3.1
|
||||||
- HP-UX 11.23 + gcc 4.2.3
|
- HP-UX 11.23 + gcc 4.2.3
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# From configure.ac Revision: 2.4.3.4 .
|
# From configure.ac Revision: 2.4.3.5 .
|
||||||
# Guess values for system-dependent variables and create Makefiles.
|
# Guess values for system-dependent variables and create Makefiles.
|
||||||
# Generated by GNU Autoconf 2.69 for tripwire 2.4.3.4.
|
# Generated by GNU Autoconf 2.69 for tripwire 2.4.3.5.
|
||||||
#
|
#
|
||||||
# Report bugs to <https://github.com/Tripwire/tripwire-open-source/issues>.
|
# Report bugs to <https://github.com/Tripwire/tripwire-open-source/issues>.
|
||||||
#
|
#
|
||||||
|
@ -584,8 +584,8 @@ MAKEFLAGS=
|
||||||
# Identity of this package.
|
# Identity of this package.
|
||||||
PACKAGE_NAME='tripwire'
|
PACKAGE_NAME='tripwire'
|
||||||
PACKAGE_TARNAME='tripwire'
|
PACKAGE_TARNAME='tripwire'
|
||||||
PACKAGE_VERSION='2.4.3.4'
|
PACKAGE_VERSION='2.4.3.5'
|
||||||
PACKAGE_STRING='tripwire 2.4.3.4'
|
PACKAGE_STRING='tripwire 2.4.3.5'
|
||||||
PACKAGE_BUGREPORT='https://github.com/Tripwire/tripwire-open-source/issues'
|
PACKAGE_BUGREPORT='https://github.com/Tripwire/tripwire-open-source/issues'
|
||||||
PACKAGE_URL='https://github.com/Tripwire/tripwire-open-source'
|
PACKAGE_URL='https://github.com/Tripwire/tripwire-open-source'
|
||||||
|
|
||||||
|
@ -748,6 +748,7 @@ ac_subst_files=''
|
||||||
ac_user_opts='
|
ac_user_opts='
|
||||||
enable_option_checking
|
enable_option_checking
|
||||||
enable_silent_rules
|
enable_silent_rules
|
||||||
|
enable_extrawarnings
|
||||||
enable_static
|
enable_static
|
||||||
enable_debug
|
enable_debug
|
||||||
enable_dependency_tracking
|
enable_dependency_tracking
|
||||||
|
@ -1321,7 +1322,7 @@ if test "$ac_init_help" = "long"; then
|
||||||
# Omit some internal or obsolete options to make the list less imposing.
|
# Omit some internal or obsolete options to make the list less imposing.
|
||||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||||
cat <<_ACEOF
|
cat <<_ACEOF
|
||||||
\`configure' configures tripwire 2.4.3.4 to adapt to many kinds of systems.
|
\`configure' configures tripwire 2.4.3.5 to adapt to many kinds of systems.
|
||||||
|
|
||||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||||
|
|
||||||
|
@ -1393,7 +1394,7 @@ fi
|
||||||
|
|
||||||
if test -n "$ac_init_help"; then
|
if test -n "$ac_init_help"; then
|
||||||
case $ac_init_help in
|
case $ac_init_help in
|
||||||
short | recursive ) echo "Configuration of tripwire 2.4.3.4:";;
|
short | recursive ) echo "Configuration of tripwire 2.4.3.5:";;
|
||||||
esac
|
esac
|
||||||
cat <<\_ACEOF
|
cat <<\_ACEOF
|
||||||
|
|
||||||
|
@ -1403,6 +1404,7 @@ Optional Features:
|
||||||
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
|
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
|
||||||
--enable-silent-rules less verbose build output (undo: "make V=1")
|
--enable-silent-rules less verbose build output (undo: "make V=1")
|
||||||
--disable-silent-rules verbose build output (undo: "make V=0")
|
--disable-silent-rules verbose build output (undo: "make V=0")
|
||||||
|
—-disable-extrawarnings do not compile with -Wextra warnings enabled
|
||||||
--enable-static compile static binaries
|
--enable-static compile static binaries
|
||||||
--enable-debug compile with debuging enabled
|
--enable-debug compile with debuging enabled
|
||||||
--enable-dependency-tracking
|
--enable-dependency-tracking
|
||||||
|
@ -1504,7 +1506,7 @@ fi
|
||||||
test -n "$ac_init_help" && exit $ac_status
|
test -n "$ac_init_help" && exit $ac_status
|
||||||
if $ac_init_version; then
|
if $ac_init_version; then
|
||||||
cat <<\_ACEOF
|
cat <<\_ACEOF
|
||||||
tripwire configure 2.4.3.4
|
tripwire configure 2.4.3.5
|
||||||
generated by GNU Autoconf 2.69
|
generated by GNU Autoconf 2.69
|
||||||
|
|
||||||
Copyright (C) 2012 Free Software Foundation, Inc.
|
Copyright (C) 2012 Free Software Foundation, Inc.
|
||||||
|
@ -2391,7 +2393,7 @@ cat >config.log <<_ACEOF
|
||||||
This file contains any messages produced by compilers while
|
This file contains any messages produced by compilers while
|
||||||
running configure, to aid debugging if configure makes a mistake.
|
running configure, to aid debugging if configure makes a mistake.
|
||||||
|
|
||||||
It was created by tripwire $as_me 2.4.3.4, which was
|
It was created by tripwire $as_me 2.4.3.5, which was
|
||||||
generated by GNU Autoconf 2.69. Invocation command line was
|
generated by GNU Autoconf 2.69. Invocation command line was
|
||||||
|
|
||||||
$ $0 $@
|
$ $0 $@
|
||||||
|
@ -3365,7 +3367,7 @@ fi
|
||||||
|
|
||||||
# Define the identity of the package.
|
# Define the identity of the package.
|
||||||
PACKAGE='tripwire'
|
PACKAGE='tripwire'
|
||||||
VERSION='2.4.3.4'
|
VERSION='2.4.3.5'
|
||||||
|
|
||||||
|
|
||||||
cat >>confdefs.h <<_ACEOF
|
cat >>confdefs.h <<_ACEOF
|
||||||
|
@ -3460,15 +3462,21 @@ fi
|
||||||
|
|
||||||
ac_config_headers="$ac_config_headers config.h"
|
ac_config_headers="$ac_config_headers config.h"
|
||||||
|
|
||||||
|
CFLAGS=${CFLAGS:-"-O -pipe -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"}
|
||||||
|
CXXFLAGS=${CXXFLAGS:-"-O -pipe -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"}
|
||||||
|
|
||||||
|
|
||||||
|
# This is primarily to support old compilers that don’t understand -Wextra
|
||||||
|
# Check whether --enable-extrawarnings was given.
|
||||||
|
if test "${enable_extrawarnings+set}" = set; then :
|
||||||
|
enableval=$enable_extrawarnings;
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "x$enable_extrawarnings" != "xno"
|
||||||
rm -f src/tripwire/syslog.h 2> /dev/null
|
then
|
||||||
chmod 755 install-sh 2> /dev/null
|
CFLAGS="${CFLAGS} -Wextra -Wno-unused-parameter"
|
||||||
|
CXXFLAGS="${CXXFLAGS} -Wextra -Wno-unused-parameter"
|
||||||
CFLAGS=${CFLAGS:-"-O -pipe -Wall -Wextra -Wno-unused-parameter -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"}
|
fi
|
||||||
CXXFLAGS=${CXXFLAGS:-"-O -pipe -Wall -Wextra -Wno-unused-parameter -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"}
|
|
||||||
|
|
||||||
# Check whether --enable-static was given.
|
# Check whether --enable-static was given.
|
||||||
if test "${enable_static+set}" = set; then :
|
if test "${enable_static+set}" = set; then :
|
||||||
|
@ -3478,6 +3486,7 @@ fi
|
||||||
if test "x$enable_static" = xyes
|
if test "x$enable_static" = xyes
|
||||||
then LDFLAGS="${LDFLAGS} -static"
|
then LDFLAGS="${LDFLAGS} -static"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check whether --enable-debug was given.
|
# Check whether --enable-debug was given.
|
||||||
if test "${enable_debug+set}" = set; then :
|
if test "${enable_debug+set}" = set; then :
|
||||||
enableval=$enable_debug;
|
enableval=$enable_debug;
|
||||||
|
@ -4349,7 +4358,7 @@ if test -z "$CXX"; then
|
||||||
CXX=$CCC
|
CXX=$CCC
|
||||||
else
|
else
|
||||||
if test -n "$ac_tool_prefix"; then
|
if test -n "$ac_tool_prefix"; then
|
||||||
for ac_prog in g++ clang++ sunCC aCC xlC_r xlC cl.exe
|
for ac_prog in g++ c++ clang++ sunCC aCC xlC_r xlC cl.exe
|
||||||
do
|
do
|
||||||
# Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
|
# Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
|
||||||
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
|
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
|
||||||
|
@ -4393,7 +4402,7 @@ fi
|
||||||
fi
|
fi
|
||||||
if test -z "$CXX"; then
|
if test -z "$CXX"; then
|
||||||
ac_ct_CXX=$CXX
|
ac_ct_CXX=$CXX
|
||||||
for ac_prog in g++ clang++ sunCC aCC xlC_r xlC cl.exe
|
for ac_prog in g++ c++ clang++ sunCC aCC xlC_r xlC cl.exe
|
||||||
do
|
do
|
||||||
# Extract the first word of "$ac_prog", so it can be a program name with args.
|
# Extract the first word of "$ac_prog", so it can be a program name with args.
|
||||||
set dummy $ac_prog; ac_word=$2
|
set dummy $ac_prog; ac_word=$2
|
||||||
|
@ -7633,7 +7642,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
|
||||||
# report actual input values of CONFIG_FILES etc. instead of their
|
# report actual input values of CONFIG_FILES etc. instead of their
|
||||||
# values after options handling.
|
# values after options handling.
|
||||||
ac_log="
|
ac_log="
|
||||||
This file was extended by tripwire $as_me 2.4.3.4, which was
|
This file was extended by tripwire $as_me 2.4.3.5, which was
|
||||||
generated by GNU Autoconf 2.69. Invocation command line was
|
generated by GNU Autoconf 2.69. Invocation command line was
|
||||||
|
|
||||||
CONFIG_FILES = $CONFIG_FILES
|
CONFIG_FILES = $CONFIG_FILES
|
||||||
|
@ -7700,7 +7709,7 @@ _ACEOF
|
||||||
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
||||||
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
|
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
|
||||||
ac_cs_version="\\
|
ac_cs_version="\\
|
||||||
tripwire config.status 2.4.3.4
|
tripwire config.status 2.4.3.5
|
||||||
configured by $0, generated by GNU Autoconf 2.69,
|
configured by $0, generated by GNU Autoconf 2.69,
|
||||||
with options \\"\$ac_cs_config\\"
|
with options \\"\$ac_cs_config\\"
|
||||||
|
|
||||||
|
|
26
configure.ac
26
configure.ac
|
@ -2,34 +2,38 @@ dnl Process this file with autoconf to produce a configure script.
|
||||||
dnl
|
dnl
|
||||||
dnl
|
dnl
|
||||||
|
|
||||||
AC_INIT([tripwire], [2.4.3.4], [https://github.com/Tripwire/tripwire-open-source/issues], [tripwire], [https://github.com/Tripwire/tripwire-open-source])
|
AC_INIT([tripwire], [2.4.3.5], [https://github.com/Tripwire/tripwire-open-source/issues], [tripwire], [https://github.com/Tripwire/tripwire-open-source])
|
||||||
AC_CONFIG_SRCDIR([src/tw/tw.cpp])
|
AC_CONFIG_SRCDIR([src/tw/tw.cpp])
|
||||||
AC_CANONICAL_TARGET([])
|
AC_CANONICAL_TARGET([])
|
||||||
AM_INIT_AUTOMAKE
|
AM_INIT_AUTOMAKE
|
||||||
AM_CONFIG_HEADER(config.h)
|
AM_CONFIG_HEADER(config.h)
|
||||||
|
|
||||||
AC_COPYRIGHT([The developer of the original code and/or files is Tripwire, Inc. Portions created by Tripwire, Inc. are copyright 2000-2017 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights reserved.])
|
AC_COPYRIGHT([The developer of the original code and/or files is Tripwire, Inc. Portions created by Tripwire, Inc. are copyright 2000-2017 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights reserved.])
|
||||||
AC_REVISION([$Revision: 2.4.3.4 $])
|
AC_REVISION([$Revision: 2.4.3.5 $])
|
||||||
|
|
||||||
dnl #################################
|
|
||||||
dnl Cleanup Cruft Leftover From Patch
|
|
||||||
dnl #################################
|
|
||||||
rm -f src/tripwire/syslog.h 2> /dev/null
|
|
||||||
chmod 755 install-sh 2> /dev/null
|
|
||||||
|
|
||||||
dnl ###############
|
dnl ###############
|
||||||
dnl Setup defaults
|
dnl Setup defaults
|
||||||
dnl ###############
|
dnl ###############
|
||||||
CFLAGS=${CFLAGS:-"-O -pipe -Wall -Wextra -Wno-unused-parameter -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"}
|
CFLAGS=${CFLAGS:-"-O -pipe -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"}
|
||||||
CXXFLAGS=${CXXFLAGS:-"-O -pipe -Wall -Wextra -Wno-unused-parameter -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"}
|
CXXFLAGS=${CXXFLAGS:-"-O -pipe -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"}
|
||||||
|
|
||||||
dnl #####################
|
dnl #####################
|
||||||
dnl Configuration options
|
dnl Configuration options
|
||||||
dnl #####################
|
dnl #####################
|
||||||
|
|
||||||
|
# This is primarily to support old compilers that don’t understand -Wextra
|
||||||
|
AC_ARG_ENABLE(extrawarnings, [ —-disable-extrawarnings do not compile with -Wextra warnings enabled])
|
||||||
|
if test "x$enable_extrawarnings" != "xno"
|
||||||
|
then
|
||||||
|
CFLAGS="${CFLAGS} -Wextra -Wno-unused-parameter"
|
||||||
|
CXXFLAGS="${CXXFLAGS} -Wextra -Wno-unused-parameter"
|
||||||
|
fi
|
||||||
|
|
||||||
AC_ARG_ENABLE(static, [ --enable-static compile static binaries])
|
AC_ARG_ENABLE(static, [ --enable-static compile static binaries])
|
||||||
if test "x$enable_static" = xyes
|
if test "x$enable_static" = xyes
|
||||||
then LDFLAGS="${LDFLAGS} -static"
|
then LDFLAGS="${LDFLAGS} -static"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_ARG_ENABLE(debug, [ --enable-debug compile with debuging enabled])
|
AC_ARG_ENABLE(debug, [ --enable-debug compile with debuging enabled])
|
||||||
if test "x$enable_debug" = xyes
|
if test "x$enable_debug" = xyes
|
||||||
then
|
then
|
||||||
|
@ -42,7 +46,7 @@ dnl ###################
|
||||||
dnl Checks for programs
|
dnl Checks for programs
|
||||||
dnl ###################
|
dnl ###################
|
||||||
AC_PROG_CC([gcc clang suncc aCC xlC_r xlC cl.exe])
|
AC_PROG_CC([gcc clang suncc aCC xlC_r xlC cl.exe])
|
||||||
AC_PROG_CXX([g++ clang++ sunCC aCC xlC_r xlC cl.exe])
|
AC_PROG_CXX([g++ c++ clang++ sunCC aCC xlC_r xlC cl.exe])
|
||||||
AC_PROG_RANLIB
|
AC_PROG_RANLIB
|
||||||
AC_PROG_YACC
|
AC_PROG_YACC
|
||||||
AC_PROG_LN_S
|
AC_PROG_LN_S
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
## from Larry Wall's metaconfig.
|
## from Larry Wall's metaconfig.
|
||||||
##-------------------------------------------------------
|
##-------------------------------------------------------
|
||||||
|
|
||||||
PATH='.:/bin:/usr/bin'
|
PATH=".:/bin:/usr/bin:/usr/local/bin:$PATH"
|
||||||
export PATH || (echo 'You must use sh to run this script'; kill $$)
|
export PATH || (echo 'You must use sh to run this script'; kill $$)
|
||||||
if [ ! -t 0 ] ; then
|
if [ ! -t 0 ] ; then
|
||||||
echo "Say 'sh install.sh', not 'sh < install.sh'"
|
echo "Say 'sh install.sh', not 'sh < install.sh'"
|
||||||
|
@ -42,18 +42,6 @@ else
|
||||||
c=""
|
c=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
##-------------------------------------------------------
|
|
||||||
## Better have a copy of tar!
|
|
||||||
## If /bin/sh does not exist or is not readable (seems
|
|
||||||
## fairly unlikely), then this will fail.
|
|
||||||
##-------------------------------------------------------
|
|
||||||
|
|
||||||
(tar cvf /dev/null /bin/sh) 2> /dev/null 1>&2
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "tar command not found -- aborting install."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
##-------------------------------------------------------
|
##-------------------------------------------------------
|
||||||
## Can't live without sed.
|
## Can't live without sed.
|
||||||
##-------------------------------------------------------
|
##-------------------------------------------------------
|
||||||
|
@ -78,52 +66,24 @@ for p in $awknames; do
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
##-------------------------------------------------------
|
|
||||||
## Does this system have a copy of grep we can use?
|
|
||||||
## Some greps don't return status (amazing, huh?),
|
|
||||||
## so we look for a copy of grep that
|
|
||||||
## returns 0 status for an exact match
|
|
||||||
## returns 0 status for a case-insensitive match
|
|
||||||
## returns 0 status for a wildcard match
|
|
||||||
## returns non-zero status for a failed match
|
|
||||||
##-------------------------------------------------------
|
|
||||||
|
|
||||||
GREP=""
|
|
||||||
grepnames="grep egrep"
|
|
||||||
lcgrepstr="findensiemich" # all lower case
|
|
||||||
mcgrepstr="FindenSieMich" # mixed case
|
|
||||||
wcgrepstr="sie.ich$" # wild card match
|
|
||||||
nogrepstr="WoBistDu" # should not be able to find this
|
|
||||||
for p in $grepnames; do
|
|
||||||
(echo "$lcgrepstr" | $p "$lcgrepstr") 2> /dev/null 1>&2
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
(echo "$lcgrepstr" | $p -i "$mcgrepstr") 2> /dev/null 1>&2
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
(echo "$lcgrepstr" | $p "$wcgrepstr") 2> /dev/null 1>&2
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
(echo "$lcgrepstr" | $p "$nogrepstr") 2> /dev/null 1>&2
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
GREP=$p
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
##-------------------------------------------------------
|
##-------------------------------------------------------
|
||||||
## Does this system have a pager that we can use?
|
## Does this system have a pager that we can use?
|
||||||
## Use cat if desperate.
|
## Use cat if desperate.
|
||||||
##-------------------------------------------------------
|
##-------------------------------------------------------
|
||||||
|
|
||||||
MORE="cat"
|
MORE="cat"
|
||||||
morenames="more less cat"
|
morenames="less more most pg cat"
|
||||||
for p in $morenames; do
|
for p in $morenames; do
|
||||||
($p $0 < /dev/null) 2> /dev/null 1>&2
|
pagerpath=`command -v $p`
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
MORE=$p
|
if [ -z $pagerpath ]; then
|
||||||
break
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -x $pagerpath ]; then
|
||||||
|
MORE=$pagerpath
|
||||||
|
break
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
##-------------------------------------------------------
|
##-------------------------------------------------------
|
||||||
|
@ -243,9 +203,8 @@ cat << END_OF_TEXT
|
||||||
Installer program for:
|
Installer program for:
|
||||||
Tripwire(R) 2.4 Open Source
|
Tripwire(R) 2.4 Open Source
|
||||||
|
|
||||||
Copyright (C) 1998-2000 Tripwire (R) Security Systems, Inc. Tripwire (R)
|
Copyright (C) 1998-2017 Tripwire, Inc.
|
||||||
is a registered trademark of the Purdue Research Foundation and is
|
Tripwire is a registered trademark of Tripwire, Inc. All rights reserved.
|
||||||
licensed exclusively to Tripwire (R) Security Systems, Inc.
|
|
||||||
|
|
||||||
END_OF_TEXT
|
END_OF_TEXT
|
||||||
|
|
||||||
|
@ -417,15 +376,21 @@ else
|
||||||
##-------------------------------------------------------
|
##-------------------------------------------------------
|
||||||
## Verify that the specified editor program exists
|
## Verify that the specified editor program exists
|
||||||
##-------------------------------------------------------
|
##-------------------------------------------------------
|
||||||
|
|
||||||
TWEDITOR=${TWEDITOR:-'/bin/vi'}
|
DEFAULTEDITOR=${EDITOR:-‘/bin/vi’}
|
||||||
|
TWEDITOR=${TWEDITOR:-$DEFAULTEDITOR}
|
||||||
|
TWEDITOR_PATH=`command -v $TWEDITOR`
|
||||||
|
|
||||||
|
if [ -n ${TWEDITOR_PATH} ]; then
|
||||||
|
TWEDITOR=$TWEDITOR_PATH
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -x ${TWEDITOR} ]; then
|
if [ -x ${TWEDITOR} ]; then
|
||||||
echo "${TWEDITOR} exists. Continuing installation."
|
echo "${TWEDITOR} exists. Continuing installation."
|
||||||
echo
|
echo
|
||||||
else
|
else
|
||||||
echo "${TWEDITOR} does not exist. Exiting."
|
echo "${TWEDITOR} not found. Continuing, but your configuration may need to be edited after installation."
|
||||||
exit 1
|
echo
|
||||||
fi
|
fi
|
||||||
|
|
||||||
##-------------------------------------------------------
|
##-------------------------------------------------------
|
||||||
|
@ -584,9 +549,12 @@ f10=' ff=${POLICYSRC} ; d="/policy" ; dd=$TWPOLICY ; rr=0640 '
|
||||||
#f16=' ff=twadmin.8 ; d="/man/man8" ; dd=$TWMAN/man8 ; rr=0444 '
|
#f16=' ff=twadmin.8 ; d="/man/man8" ; dd=$TWMAN/man8 ; rr=0444 '
|
||||||
#f17=' ff=twintro.8 ; d="/man/man8" ; dd=$TWMAN/man8 ; rr=0444 '
|
#f17=' ff=twintro.8 ; d="/man/man8" ; dd=$TWMAN/man8 ; rr=0444 '
|
||||||
#f18=' ff=twprint.8 ; d="/man/man8" ; dd=$TWMAN/man8 ; rr=0444 '
|
#f18=' ff=twprint.8 ; d="/man/man8" ; dd=$TWMAN/man8 ; rr=0444 '
|
||||||
|
f19=' ff=COMMERCIAL ; d="" ; dd=$TWDOCS ; rr=0444 '
|
||||||
|
f20=' ff=ReadMe-2.4.3 ; d="" ; dd=$TWDOCS ; rr=0444 '
|
||||||
|
f21=' ff=ChangeLog ; d="" ; dd=$TWDOCS ; rr=0444 '
|
||||||
|
|
||||||
# Binaries and manpages are already installed by the install target
|
# Binaries and manpages are already installed by the install target
|
||||||
loosefiles="f3 f4 f5 f6 f7 f8 f9 f10"
|
loosefiles="f3 f4 f5 f6 f7 f8 f9 f10 f19 f20 f21"
|
||||||
|
|
||||||
for i in $loosefiles; do
|
for i in $loosefiles; do
|
||||||
eval "eval \"\$$i\""
|
eval "eval \"\$$i\""
|
||||||
|
@ -607,7 +575,9 @@ done
|
||||||
|
|
||||||
if [ -n "$INSTALL_STRIP_FLAG" ] ; then
|
if [ -n "$INSTALL_STRIP_FLAG" ] ; then
|
||||||
echo "INSTALL_STRIP_FLAG is set, stripping binaries"
|
echo "INSTALL_STRIP_FLAG is set, stripping binaries"
|
||||||
strip "$TWBIN/siggen" "$TWBIN/tripwire" "$TWBIN/twadmin" "$TWBIN/twprint"
|
chmod u+w "$TWBIN/siggen" "$TWBIN/tripwire" "$TWBIN/twadmin" "$TWBIN/twprint"
|
||||||
|
strip "$TWBIN/siggen" "$TWBIN/tripwire" "$TWBIN/twadmin" "$TWBIN/twprint"
|
||||||
|
chmod u-w "$TWBIN/siggen" "$TWBIN/tripwire" "$TWBIN/twadmin" "$TWBIN/twprint"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#Make extra sure we don't install the unit test binary to sbin
|
#Make extra sure we don't install the unit test binary to sbin
|
||||||
|
@ -923,7 +893,7 @@ cat << END_OF_TEXT
|
||||||
----------------------------------------------
|
----------------------------------------------
|
||||||
The installation succeeded.
|
The installation succeeded.
|
||||||
|
|
||||||
Please refer to $README_LOC
|
Please refer to documentation in $TWDOCS
|
||||||
for release information and to the printed user documentation
|
for release information and to the printed user documentation
|
||||||
for further instructions on using Tripwire 2.4 Open Source.
|
for further instructions on using Tripwire 2.4 Open Source.
|
||||||
|
|
||||||
|
|
|
@ -12,11 +12,11 @@ libcore_a_SOURCES = \
|
||||||
displayutil.cpp error.cpp errorbucketimpl.cpp errortable.cpp \
|
displayutil.cpp error.cpp errorbucketimpl.cpp errortable.cpp \
|
||||||
errorutil.cpp fileerror.cpp fileheader.cpp fsservices.cpp \
|
errorutil.cpp fileerror.cpp fileheader.cpp fsservices.cpp \
|
||||||
growheap.cpp hashtable.cpp haval.cpp msystem.cpp ntmbs.cpp \
|
growheap.cpp hashtable.cpp haval.cpp msystem.cpp ntmbs.cpp \
|
||||||
objectpool.cpp refcountobj.cpp serializable.cpp serializer.cpp \
|
refcountobj.cpp serializable.cpp serializer.cpp \
|
||||||
serializerimpl.cpp serializerutil.cpp serstring.cpp \
|
serializerimpl.cpp serializerutil.cpp serstring.cpp \
|
||||||
srefcountobj.cpp srefcounttbl.cpp stdcore.cpp stringutil.cpp \
|
srefcountobj.cpp srefcounttbl.cpp stdcore.cpp stringutil.cpp \
|
||||||
timebomb.cpp timeconvert.cpp tw_signal.cpp twlimits.cpp twlocale.cpp \
|
timebomb.cpp timeconvert.cpp tw_signal.cpp twlimits.cpp twlocale.cpp \
|
||||||
unixexcept.cpp usernotify.cpp usernotifystdout.cpp utf8.cpp \
|
unixexcept.cpp usernotify.cpp usernotifystdout.cpp \
|
||||||
wchar16.cpp
|
wchar16.cpp
|
||||||
|
|
||||||
libcore_a_HEADERS = archive.h charutil.h cmdlineparser.h codeconvert.h \
|
libcore_a_HEADERS = archive.h charutil.h cmdlineparser.h codeconvert.h \
|
||||||
|
@ -24,12 +24,12 @@ libcore_a_HEADERS = archive.h charutil.h cmdlineparser.h codeconvert.h \
|
||||||
displayutil.h error.h errorbucket.h errorbucketimpl.h errorgeneral.h \
|
displayutil.h error.h errorbucket.h errorbucketimpl.h errorgeneral.h \
|
||||||
errortable.h errorutil.h file.h fileerror.h fileheader.h fixedfilebuf.h \
|
errortable.h errorutil.h file.h fileerror.h fileheader.h fixedfilebuf.h \
|
||||||
fsservices.h growheap.h hashtable.h haval.h md5.h msystem.h ntdbs.h \
|
fsservices.h growheap.h hashtable.h haval.h md5.h msystem.h ntdbs.h \
|
||||||
ntmbs.h objectpool.h package.h platform.h refcountobj.h resources.h \
|
ntmbs.h package.h platform.h refcountobj.h resources.h \
|
||||||
serializable.h serializer.h serializerimpl.h serializerutil.h serstring.h \
|
serializable.h serializer.h serializerimpl.h serializerutil.h serstring.h \
|
||||||
sha.h srefcountobj.h srefcounttbl.h stdcore.h stringutil.h tasktimer.h \
|
sha.h srefcountobj.h srefcounttbl.h stdcore.h stringutil.h tasktimer.h \
|
||||||
tchar.h timebomb.h timeconvert.h tw_signal.h twlimits.h twlocale.h \
|
tchar.h timebomb.h timeconvert.h tw_signal.h twlimits.h twlocale.h \
|
||||||
twstringslang.h typed.h types.h unixexcept.h unixfsservices.h upperbound.h \
|
twstringslang.h typed.h types.h unixexcept.h unixfsservices.h upperbound.h \
|
||||||
usernotify.h usernotifystdout.h utf8.h wchar16.h
|
usernotify.h usernotifystdout.h wchar16.h
|
||||||
|
|
||||||
libcore_a_LIBADD = @CORE_CRYPT_O@
|
libcore_a_LIBADD = @CORE_CRYPT_O@
|
||||||
libcore_a_DEPENDENCIES = @CORE_CRYPT_O@
|
libcore_a_DEPENDENCIES = @CORE_CRYPT_O@
|
||||||
|
|
|
@ -118,15 +118,14 @@ am_libcore_a_OBJECTS = file_unix.$(OBJEXT) unixfsservices.$(OBJEXT) \
|
||||||
errorutil.$(OBJEXT) fileerror.$(OBJEXT) fileheader.$(OBJEXT) \
|
errorutil.$(OBJEXT) fileerror.$(OBJEXT) fileheader.$(OBJEXT) \
|
||||||
fsservices.$(OBJEXT) growheap.$(OBJEXT) hashtable.$(OBJEXT) \
|
fsservices.$(OBJEXT) growheap.$(OBJEXT) hashtable.$(OBJEXT) \
|
||||||
haval.$(OBJEXT) msystem.$(OBJEXT) ntmbs.$(OBJEXT) \
|
haval.$(OBJEXT) msystem.$(OBJEXT) ntmbs.$(OBJEXT) \
|
||||||
objectpool.$(OBJEXT) refcountobj.$(OBJEXT) \
|
refcountobj.$(OBJEXT) serializable.$(OBJEXT) \
|
||||||
serializable.$(OBJEXT) serializer.$(OBJEXT) \
|
serializer.$(OBJEXT) serializerimpl.$(OBJEXT) \
|
||||||
serializerimpl.$(OBJEXT) serializerutil.$(OBJEXT) \
|
serializerutil.$(OBJEXT) serstring.$(OBJEXT) \
|
||||||
serstring.$(OBJEXT) srefcountobj.$(OBJEXT) \
|
srefcountobj.$(OBJEXT) srefcounttbl.$(OBJEXT) \
|
||||||
srefcounttbl.$(OBJEXT) stdcore.$(OBJEXT) stringutil.$(OBJEXT) \
|
stdcore.$(OBJEXT) stringutil.$(OBJEXT) timebomb.$(OBJEXT) \
|
||||||
timebomb.$(OBJEXT) timeconvert.$(OBJEXT) tw_signal.$(OBJEXT) \
|
timeconvert.$(OBJEXT) tw_signal.$(OBJEXT) twlimits.$(OBJEXT) \
|
||||||
twlimits.$(OBJEXT) twlocale.$(OBJEXT) unixexcept.$(OBJEXT) \
|
twlocale.$(OBJEXT) unixexcept.$(OBJEXT) usernotify.$(OBJEXT) \
|
||||||
usernotify.$(OBJEXT) usernotifystdout.$(OBJEXT) utf8.$(OBJEXT) \
|
usernotifystdout.$(OBJEXT) wchar16.$(OBJEXT)
|
||||||
wchar16.$(OBJEXT)
|
|
||||||
libcore_a_OBJECTS = $(am_libcore_a_OBJECTS)
|
libcore_a_OBJECTS = $(am_libcore_a_OBJECTS)
|
||||||
AM_V_P = $(am__v_P_@AM_V@)
|
AM_V_P = $(am__v_P_@AM_V@)
|
||||||
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
|
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
|
||||||
|
@ -339,11 +338,11 @@ libcore_a_SOURCES = \
|
||||||
displayutil.cpp error.cpp errorbucketimpl.cpp errortable.cpp \
|
displayutil.cpp error.cpp errorbucketimpl.cpp errortable.cpp \
|
||||||
errorutil.cpp fileerror.cpp fileheader.cpp fsservices.cpp \
|
errorutil.cpp fileerror.cpp fileheader.cpp fsservices.cpp \
|
||||||
growheap.cpp hashtable.cpp haval.cpp msystem.cpp ntmbs.cpp \
|
growheap.cpp hashtable.cpp haval.cpp msystem.cpp ntmbs.cpp \
|
||||||
objectpool.cpp refcountobj.cpp serializable.cpp serializer.cpp \
|
refcountobj.cpp serializable.cpp serializer.cpp \
|
||||||
serializerimpl.cpp serializerutil.cpp serstring.cpp \
|
serializerimpl.cpp serializerutil.cpp serstring.cpp \
|
||||||
srefcountobj.cpp srefcounttbl.cpp stdcore.cpp stringutil.cpp \
|
srefcountobj.cpp srefcounttbl.cpp stdcore.cpp stringutil.cpp \
|
||||||
timebomb.cpp timeconvert.cpp tw_signal.cpp twlimits.cpp twlocale.cpp \
|
timebomb.cpp timeconvert.cpp tw_signal.cpp twlimits.cpp twlocale.cpp \
|
||||||
unixexcept.cpp usernotify.cpp usernotifystdout.cpp utf8.cpp \
|
unixexcept.cpp usernotify.cpp usernotifystdout.cpp \
|
||||||
wchar16.cpp
|
wchar16.cpp
|
||||||
|
|
||||||
libcore_a_HEADERS = archive.h charutil.h cmdlineparser.h codeconvert.h \
|
libcore_a_HEADERS = archive.h charutil.h cmdlineparser.h codeconvert.h \
|
||||||
|
@ -351,12 +350,12 @@ libcore_a_HEADERS = archive.h charutil.h cmdlineparser.h codeconvert.h \
|
||||||
displayutil.h error.h errorbucket.h errorbucketimpl.h errorgeneral.h \
|
displayutil.h error.h errorbucket.h errorbucketimpl.h errorgeneral.h \
|
||||||
errortable.h errorutil.h file.h fileerror.h fileheader.h fixedfilebuf.h \
|
errortable.h errorutil.h file.h fileerror.h fileheader.h fixedfilebuf.h \
|
||||||
fsservices.h growheap.h hashtable.h haval.h md5.h msystem.h ntdbs.h \
|
fsservices.h growheap.h hashtable.h haval.h md5.h msystem.h ntdbs.h \
|
||||||
ntmbs.h objectpool.h package.h platform.h refcountobj.h resources.h \
|
ntmbs.h package.h platform.h refcountobj.h resources.h \
|
||||||
serializable.h serializer.h serializerimpl.h serializerutil.h serstring.h \
|
serializable.h serializer.h serializerimpl.h serializerutil.h serstring.h \
|
||||||
sha.h srefcountobj.h srefcounttbl.h stdcore.h stringutil.h tasktimer.h \
|
sha.h srefcountobj.h srefcounttbl.h stdcore.h stringutil.h tasktimer.h \
|
||||||
tchar.h timebomb.h timeconvert.h tw_signal.h twlimits.h twlocale.h \
|
tchar.h timebomb.h timeconvert.h tw_signal.h twlimits.h twlocale.h \
|
||||||
twstringslang.h typed.h types.h unixexcept.h unixfsservices.h upperbound.h \
|
twstringslang.h typed.h types.h unixexcept.h unixfsservices.h upperbound.h \
|
||||||
usernotify.h usernotifystdout.h utf8.h wchar16.h
|
usernotify.h usernotifystdout.h wchar16.h
|
||||||
|
|
||||||
libcore_a_LIBADD = @CORE_CRYPT_O@
|
libcore_a_LIBADD = @CORE_CRYPT_O@
|
||||||
libcore_a_DEPENDENCIES = @CORE_CRYPT_O@
|
libcore_a_DEPENDENCIES = @CORE_CRYPT_O@
|
||||||
|
|
|
@ -324,28 +324,5 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
// TODO: fill these out
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
// class cMMFileArchive --
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
class cMMFileArchive : public cMemMappedArchive
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
};
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
// class cNetArchive --
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
class cNetArchive : public cArchive
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -1016,7 +1016,7 @@ cDoubleIconvConverter::Convert(
|
||||||
//
|
//
|
||||||
size_t nBufBytes = nChars * MB_LEN_MAX;
|
size_t nBufBytes = nChars * MB_LEN_MAX;
|
||||||
ntmbs_t pszBuffer = (ntmbs_t)::operator new( nBufBytes + 1 );
|
ntmbs_t pszBuffer = (ntmbs_t)::operator new( nBufBytes + 1 );
|
||||||
std::auto_ptr<mbchar_t> pBuf( pszBuffer );
|
TW_UNIQUE_PTR<mbchar_t> pBuf( pszBuffer );
|
||||||
|
|
||||||
//
|
//
|
||||||
// do first conversion
|
// do first conversion
|
||||||
|
@ -1074,7 +1074,7 @@ cDoubleIconvConverter::Convert(
|
||||||
//
|
//
|
||||||
size_t nBufBytes = nBytes * MB_LEN_MAX;
|
size_t nBufBytes = nBytes * MB_LEN_MAX;
|
||||||
ntmbs_t pszBuffer = (ntmbs_t)::operator new( nBufBytes + 1 );
|
ntmbs_t pszBuffer = (ntmbs_t)::operator new( nBufBytes + 1 );
|
||||||
std::auto_ptr<mbchar_t> pBuf( pszBuffer );
|
TW_UNIQUE_PTR<mbchar_t> pBuf( pszBuffer );
|
||||||
|
|
||||||
//
|
//
|
||||||
// do first conversion
|
// do first conversion
|
||||||
|
|
|
@ -98,11 +98,9 @@ TSS_REGISTER_ERROR( eFileFlush(), _T("File could not be flushed.") )
|
||||||
TSS_REGISTER_ERROR( eFileRewind(), _T("File could not be rewound.") )
|
TSS_REGISTER_ERROR( eFileRewind(), _T("File could not be rewound.") )
|
||||||
|
|
||||||
|
|
||||||
/// Win32
|
/// General API failures
|
||||||
|
|
||||||
#if IS_UNIX
|
|
||||||
TSS_REGISTER_ERROR(eUnix(), _T("Unix API failure.") )
|
TSS_REGISTER_ERROR(eUnix(), _T("Unix API failure.") )
|
||||||
#endif
|
|
||||||
|
|
||||||
/// FSServices
|
/// FSServices
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ cDebug::cDebug(const char* label)
|
||||||
|
|
||||||
cDebug::cDebug(const cDebug &rhs)
|
cDebug::cDebug(const cDebug &rhs)
|
||||||
{
|
{
|
||||||
strcpy(mLabel, rhs.mLabel);
|
strncpy(mLabel, rhs.mLabel, MAX_LABEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
cDebug::~cDebug()
|
cDebug::~cDebug()
|
||||||
|
@ -102,7 +102,7 @@ void cDebug::DoTrace(const char *format, va_list &args)
|
||||||
char out[2048];
|
char out[2048];
|
||||||
size_t guard2 = 0xBABABABA;
|
size_t guard2 = 0xBABABABA;
|
||||||
|
|
||||||
vsprintf(out, format, args);
|
vsnprintf(out, 2048, format, args);
|
||||||
|
|
||||||
ASSERT(guard1 == 0xBABABABA && guard2 == 0xBABABABA); // string was too long
|
ASSERT(guard1 == 0xBABABABA && guard2 == 0xBABABABA); // string was too long
|
||||||
ASSERT(strlen(out) < 1024);
|
ASSERT(strlen(out) < 1024);
|
||||||
|
@ -304,7 +304,7 @@ void cDebug::DebugOut( const char* lpOutputString, ... )
|
||||||
// create the output buffer
|
// create the output buffer
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, lpOutputString);
|
va_start(args, lpOutputString);
|
||||||
vsprintf(buf, lpOutputString, args);
|
vsnprintf(buf, 2048, lpOutputString, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
|
|
|
@ -208,16 +208,10 @@ inline void cDebug::DebugOut ( const char*, ... ) {}
|
||||||
// ASSERT macro
|
// ASSERT macro
|
||||||
//////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#define ASSERTMSG( exp, s ) assert( (exp) != 0 )
|
||||||
#if IS_UNIX
|
#define ASSERT( exp ) assert( (exp) != 0 )
|
||||||
|
// if we are not windows we will just use the standard assert()
|
||||||
#define ASSERTMSG( exp, s ) assert( (exp) != 0 )
|
#define TSS_DebugBreak() ASSERT( false );
|
||||||
#define ASSERT( exp ) assert( (exp) != 0 )
|
|
||||||
// if we are not windows we will just use the standard assert()
|
|
||||||
#define TSS_DebugBreak() ASSERT( false );
|
|
||||||
|
|
||||||
#endif// IS_UNIX
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef ASSERT
|
#ifndef ASSERT
|
||||||
#error ASSERT did not get defined!!!
|
#error ASSERT did not get defined!!!
|
||||||
|
|
|
@ -81,6 +81,8 @@ inline bool IsSingleTCHAR( TSTRING::const_iterator first,
|
||||||
class iCharEncoder
|
class iCharEncoder
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
virtual ~iCharEncoder() {};
|
||||||
|
|
||||||
virtual bool NeedsEncoding( TSTRING::const_iterator first,
|
virtual bool NeedsEncoding( TSTRING::const_iterator first,
|
||||||
TSTRING::const_iterator last ) const = 0;
|
TSTRING::const_iterator last ) const = 0;
|
||||||
// Determines if character identified by [first,last) needs encoding.
|
// Determines if character identified by [first,last) needs encoding.
|
||||||
|
@ -107,7 +109,7 @@ class iCharEncoder
|
||||||
|
|
||||||
static TCHAR EscapeChar() { return char_escape; }
|
static TCHAR EscapeChar() { return char_escape; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
static TCHAR char_escape;
|
static TCHAR char_escape;
|
||||||
};
|
};
|
||||||
|
@ -116,6 +118,8 @@ class iCharEncoder
|
||||||
class cNonNarrowableCharEncoder : public iCharEncoder
|
class cNonNarrowableCharEncoder : public iCharEncoder
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
virtual ~cNonNarrowableCharEncoder() {}
|
||||||
|
|
||||||
virtual bool NeedsEncoding( TSTRING::const_iterator first,
|
virtual bool NeedsEncoding( TSTRING::const_iterator first,
|
||||||
TSTRING::const_iterator last ) const;
|
TSTRING::const_iterator last ) const;
|
||||||
|
|
||||||
|
@ -141,7 +145,9 @@ class cNonPrintableCharEncoder : public iCharEncoder
|
||||||
cNonPrintableCharEncoder( bool f_allowWS )
|
cNonPrintableCharEncoder( bool f_allowWS )
|
||||||
: m_allowWS( f_allowWS ) {};
|
: m_allowWS( f_allowWS ) {};
|
||||||
|
|
||||||
virtual bool NeedsEncoding( TSTRING::const_iterator first,
|
virtual ~cNonPrintableCharEncoder() {}
|
||||||
|
|
||||||
|
virtual bool NeedsEncoding( TSTRING::const_iterator first,
|
||||||
TSTRING::const_iterator last ) const;
|
TSTRING::const_iterator last ) const;
|
||||||
|
|
||||||
virtual TSTRING EncodeRoundtrip(TSTRING::const_iterator first,
|
virtual TSTRING EncodeRoundtrip(TSTRING::const_iterator first,
|
||||||
|
@ -164,6 +170,8 @@ class cNonPrintableCharEncoder : public iCharEncoder
|
||||||
class cQuoteCharEncoder : public iCharEncoder
|
class cQuoteCharEncoder : public iCharEncoder
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
virtual ~cQuoteCharEncoder() {}
|
||||||
|
|
||||||
virtual bool NeedsEncoding( TSTRING::const_iterator first,
|
virtual bool NeedsEncoding( TSTRING::const_iterator first,
|
||||||
TSTRING::const_iterator last ) const;
|
TSTRING::const_iterator last ) const;
|
||||||
|
|
||||||
|
@ -187,6 +195,8 @@ class cQuoteCharEncoder : public iCharEncoder
|
||||||
class cBackslashCharEncoder : public iCharEncoder
|
class cBackslashCharEncoder : public iCharEncoder
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
virtual ~cBackslashCharEncoder() {}
|
||||||
|
|
||||||
virtual bool NeedsEncoding( TSTRING::const_iterator first,
|
virtual bool NeedsEncoding( TSTRING::const_iterator first,
|
||||||
TSTRING::const_iterator last ) const;
|
TSTRING::const_iterator last ) const;
|
||||||
|
|
||||||
|
@ -506,11 +516,8 @@ bool cCharEncoderUtil::IsPrintable( TCHAR ch )
|
||||||
return( ! isprint( ch ) ); // kludge for KAI
|
return( ! isprint( ch ) ); // kludge for KAI
|
||||||
|
|
||||||
#else // USE_CLIB_LOCALE
|
#else // USE_CLIB_LOCALE
|
||||||
|
|
||||||
#if IS_UNIX
|
|
||||||
return( ! std::isprint<TCHAR>( ch, std::locale() ) );
|
|
||||||
|
|
||||||
#endif
|
return( ! std::isprint<TCHAR>( ch, std::locale() ) );
|
||||||
|
|
||||||
#endif // USE_CLIB_LOCALE
|
#endif // USE_CLIB_LOCALE
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,18 +40,14 @@
|
||||||
// class eInternal
|
// class eInternal
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
#if IS_UNIX
|
|
||||||
namespace //unique
|
namespace //unique
|
||||||
{
|
{
|
||||||
TCHAR* tw_itot( int value, TCHAR* string, int radix)
|
TCHAR* tw_itot( int value, TCHAR* string, int radix, int size)
|
||||||
{
|
{
|
||||||
_stprintf( string, "%d", value );
|
snprintf( string, size, "%d", value );
|
||||||
return string;
|
return string;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
#define tw_itot _itot
|
|
||||||
#endif //IS_UNIX
|
|
||||||
|
|
||||||
eInternal::eInternal(TCHAR* sourceFile, int lineNum)
|
eInternal::eInternal(TCHAR* sourceFile, int lineNum)
|
||||||
: eError(_T(""))
|
: eError(_T(""))
|
||||||
|
@ -61,7 +57,7 @@ eInternal::eInternal(TCHAR* sourceFile, int lineNum)
|
||||||
mMsg = _T("File: ");
|
mMsg = _T("File: ");
|
||||||
mMsg += sourceFile;
|
mMsg += sourceFile;
|
||||||
mMsg += _T(" Line: ");
|
mMsg += _T(" Line: ");
|
||||||
mMsg += tw_itot(lineNum, buf, 10);
|
mMsg += tw_itot(lineNum, buf, 10, 256);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
|
@ -74,12 +74,7 @@ struct cFile_i;
|
||||||
class cFile
|
class cFile
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
#if IS_UNIX
|
|
||||||
typedef off_t File_t;
|
typedef off_t File_t;
|
||||||
#else //WIN32
|
|
||||||
typedef int64 File_t;
|
|
||||||
|
|
||||||
#endif // IS_UNIX
|
|
||||||
|
|
||||||
enum SeekFrom
|
enum SeekFrom
|
||||||
{
|
{
|
||||||
|
|
|
@ -45,10 +45,7 @@
|
||||||
#define __FIXED_FILEBUF_H
|
#define __FIXED_FILEBUF_H
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
#if IS_UNIX
|
|
||||||
#define fixed_basic_ofstream std::basic_ofstream
|
#define fixed_basic_ofstream std::basic_ofstream
|
||||||
#endif // IS_WIN32/IS_UNIX
|
|
||||||
|
|
||||||
#endif//__FIXED_FILEBUF_H
|
#endif//__FIXED_FILEBUF_H
|
||||||
|
|
||||||
|
|
|
@ -65,16 +65,15 @@
|
||||||
// STANDARD LIBRARY INCLUDES
|
// STANDARD LIBRARY INCLUDES
|
||||||
//=========================================================================
|
//=========================================================================
|
||||||
|
|
||||||
#if IS_UNIX
|
#if HAVE_SYS_PARAM_H
|
||||||
#if HAVE_SYS_PARAM_H
|
# include <sys/param.h>
|
||||||
#include <sys/param.h>
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
#if HAVE_SYS_STAT_H
|
#if HAVE_SYS_STAT_H
|
||||||
#include <sys/stat.h>
|
# include <sys/stat.h>
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//=========================================================================
|
//=========================================================================
|
||||||
// DEFINES AND MACROS
|
// DEFINES AND MACROS
|
||||||
//=========================================================================
|
//=========================================================================
|
||||||
|
@ -209,13 +208,11 @@ class iFSServices
|
||||||
// maximum path length on platform
|
// maximum path length on platform
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
#if IS_UNIX
|
#ifdef MAXPATHLEN
|
||||||
#ifdef MAXPATHLEN
|
|
||||||
TW_MAX_PATH = MAXPATHLEN
|
TW_MAX_PATH = MAXPATHLEN
|
||||||
#else
|
#else
|
||||||
TW_MAX_PATH = 1024
|
TW_MAX_PATH = 1024
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -244,14 +241,14 @@ class iFSServices
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
// major filesystem functions
|
// major filesystem functions
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
virtual void Stat( const TSTRING& strFileName, cFSStatArgs& pStat ) const throw( eFSServices ) = 0;
|
virtual void Stat( const TSTRING& strFileName, cFSStatArgs& pStat ) const = 0;
|
||||||
// fills out the cFSStatArgs structure with the stat info for the named file
|
// fills out the cFSStatArgs structure with the stat info for the named file
|
||||||
virtual void GetTempDirName( TSTRING& strName ) const throw( eFSServices ) = 0;
|
virtual void GetTempDirName( TSTRING& strName ) const = 0;
|
||||||
// makes directory if it doesn't exist already. Dirname will end with a delimiter ( '/' )
|
// makes directory if it doesn't exist already. Dirname will end with a delimiter ( '/' )
|
||||||
|
|
||||||
virtual void SetTempDirName( TSTRING& tmpName ) = 0;
|
virtual void SetTempDirName( TSTRING& tmpName ) = 0;
|
||||||
|
|
||||||
virtual TSTRING& MakeTempFilename( TSTRING& strName ) const throw( eFSServices ) = 0;
|
virtual TSTRING& MakeTempFilename( TSTRING& strName ) const = 0;
|
||||||
// create temporary file
|
// create temporary file
|
||||||
// TSTRING must have the form ("baseXXXXXX"), where the X's are replaced with
|
// TSTRING must have the form ("baseXXXXXX"), where the X's are replaced with
|
||||||
// characters to make it a unique file. There must be at least 6 Xs.
|
// characters to make it a unique file. There must be at least 6 Xs.
|
||||||
|
@ -262,7 +259,7 @@ class iFSServices
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
virtual void GetHostID( TSTRING& name ) const = 0;
|
virtual void GetHostID( TSTRING& name ) const = 0;
|
||||||
|
|
||||||
virtual void GetMachineName( TSTRING& name ) const throw(eFSServices) = 0;
|
virtual void GetMachineName( TSTRING& name ) const = 0;
|
||||||
|
|
||||||
virtual void GetMachineNameFullyQualified( TSTRING& name ) const = 0;
|
virtual void GetMachineNameFullyQualified( TSTRING& name ) const = 0;
|
||||||
|
|
||||||
|
@ -274,11 +271,11 @@ class iFSServices
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
// directory specific functions
|
// directory specific functions
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
virtual void ReadDir( const TSTRING& strName, std::vector<TSTRING> &vDirContents, bool bFullPaths = true ) const throw( eFSServices ) = 0;
|
virtual void ReadDir( const TSTRING& strName, std::vector<TSTRING> &vDirContents, bool bFullPaths = true ) const = 0;
|
||||||
// puts the contents of the specified directory, except for . and .., into the supplied vector.
|
// puts the contents of the specified directory, except for . and .., into the supplied vector.
|
||||||
// if bFullPaths is true, then the vector contains fully qualified path names; otherwise, it only contains the
|
// if bFullPaths is true, then the vector contains fully qualified path names; otherwise, it only contains the
|
||||||
// short names.
|
// short names.
|
||||||
virtual void GetCurrentDir( TSTRING& strCurDir ) const throw( eFSServices ) = 0;
|
virtual void GetCurrentDir( TSTRING& strCurDir ) const = 0;
|
||||||
// returns the current working directory
|
// returns the current working directory
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -66,8 +66,6 @@
|
||||||
|
|
||||||
#include "stdcore.h"
|
#include "stdcore.h"
|
||||||
|
|
||||||
#if IS_UNIX
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* set, reset environment to be passed to mpopem
|
* set, reset environment to be passed to mpopem
|
||||||
*/
|
*/
|
||||||
|
@ -209,6 +207,7 @@ char *getenv(); /* get variable from environment */
|
||||||
* on some systems, this is a library function, so define STRDUP
|
* on some systems, this is a library function, so define STRDUP
|
||||||
* if it is on yours
|
* if it is on yours
|
||||||
*/
|
*/
|
||||||
|
#if 0
|
||||||
#ifdef STRDUP
|
#ifdef STRDUP
|
||||||
# ifndef __STDC__
|
# ifndef __STDC__
|
||||||
char *strdup();
|
char *strdup();
|
||||||
|
@ -226,13 +225,14 @@ char *getenv(); /* get variable from environment */
|
||||||
/*
|
/*
|
||||||
* allocate space for the string, and copy if successful
|
* allocate space for the string, and copy if successful
|
||||||
*/
|
*/
|
||||||
if ((p = (char*)malloc((unsigned)((strlen(str)+1)*sizeof(char))))
|
size_t p_size = (strlen(str)+1)*sizeof(char);
|
||||||
|
if ((p = (char*)malloc((unsigned)(p_size)))
|
||||||
!= NULL)
|
!= NULL)
|
||||||
(void) strcpy(p, str);
|
(void) strncpy(p, str, p_size);
|
||||||
return(p);
|
return(p);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#endif //0
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* allocate space for an array of pointers, OR
|
* allocate space for an array of pointers, OR
|
||||||
|
@ -382,7 +382,7 @@ char *env;
|
||||||
register int n; /* where a previous definition is */
|
register int n; /* where a previous definition is */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* seeif youneed to create the environment list
|
* see if you need to create the environment list
|
||||||
*/
|
*/
|
||||||
if (sz_envp == 0){
|
if (sz_envp == 0){
|
||||||
if ((envp = c2alloc((const char**)envp, &sz_envp)) == NULL){
|
if ((envp = c2alloc((const char**)envp, &sz_envp)) == NULL){
|
||||||
|
@ -403,21 +403,26 @@ char *env;
|
||||||
* just include it from the current environment
|
* just include it from the current environment
|
||||||
* (if not defined there, don't define it here)
|
* (if not defined there, don't define it here)
|
||||||
*/
|
*/
|
||||||
if (strchr(env, '=') == NULL){
|
if (strchr(env, '=') == NULL) {
|
||||||
|
|
||||||
|
q = getenv(env);
|
||||||
|
|
||||||
/* is it defined locally? */
|
/* is it defined locally? */
|
||||||
if ((q = getenv(env)) == NULL){
|
if (NULL == q) {
|
||||||
/* no -- don't define it here */
|
/* no -- don't define it here */
|
||||||
return(SE_NONE);
|
return(SE_NONE);
|
||||||
}
|
}
|
||||||
else if ((p = (char*)malloc((unsigned) (strlen(env)+strlen(q)+2)))
|
|
||||||
== NULL){
|
size_t p_size = strlen(env) + strlen(q) + 2;
|
||||||
|
|
||||||
|
if ((p = (char*)malloc((unsigned)(p_size))) == NULL) {
|
||||||
ERMSG("ran out of memory");
|
ERMSG("ran out of memory");
|
||||||
return(SE_NOMEM);
|
return(SE_NOMEM);
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
(void) strcpy(p, env);
|
(void) strncpy(p, env, p_size);
|
||||||
(void) strcat(p, "=");
|
(void) strncat(p, "=", p_size);
|
||||||
(void) strcat(p, q);
|
(void) strncat(p, q, p_size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((p = strdup(env)) == NULL){
|
else if ((p = strdup(env)) == NULL){
|
||||||
|
@ -1038,6 +1043,3 @@ int pid;
|
||||||
*/
|
*/
|
||||||
return(status);
|
return(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //#if IS_UNIX
|
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@
|
||||||
// NTMBS Utils -- Definition
|
// NTMBS Utils -- Definition
|
||||||
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
#if 0
|
||||||
/*
|
/*
|
||||||
* TSS::mbsdec
|
* TSS::mbsdec
|
||||||
*
|
*
|
||||||
|
@ -96,7 +96,7 @@ tss::mbsdec( const_ntmbs_t beg, const_ntmbs_t curr )
|
||||||
const_ntmbs_t prev = curr - 1;
|
const_ntmbs_t prev = curr - 1;
|
||||||
for ( ; prev > beg && ::mblen( (char*)prev, curr - prev ) == -1; --prev );
|
for ( ; prev > beg && ::mblen( (char*)prev, curr - prev ) == -1; --prev );
|
||||||
|
|
||||||
if ( curr - prev > MB_CUR_MAX )
|
if ( (size_t)(curr - prev) > MB_CUR_MAX )
|
||||||
{
|
{
|
||||||
prev = (curr - 1);
|
prev = (curr - 1);
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ tss::mbsdec( const_ntmbs_t beg, const_ntmbs_t curr )
|
||||||
|
|
||||||
return (ntmbs_t)prev;
|
return (ntmbs_t)prev;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TSS::mbsinc
|
* TSS::mbsinc
|
||||||
|
|
|
@ -117,11 +117,12 @@
|
||||||
TSS_EXCEPTION( eCharacter, eError );
|
TSS_EXCEPTION( eCharacter, eError );
|
||||||
TSS_EXCEPTION( eCharacterEncoding, eCharacter );
|
TSS_EXCEPTION( eCharacterEncoding, eCharacter );
|
||||||
|
|
||||||
|
|
||||||
namespace tss
|
namespace tss
|
||||||
{
|
{
|
||||||
/// Specific Routines (Add as needed)
|
/// Specific Routines (Add as needed)
|
||||||
|
|
||||||
ntmbs_t mbsdec( const_ntmbs_t, const_ntmbs_t );
|
//ntmbs_t mbsdec( const_ntmbs_t, const_ntmbs_t );
|
||||||
ntmbs_t mbsinc( const_ntmbs_t );
|
ntmbs_t mbsinc( const_ntmbs_t );
|
||||||
|
|
||||||
size_t mbsbytes( const_ntmbs_t, size_t );
|
size_t mbsbytes( const_ntmbs_t, size_t );
|
||||||
|
|
|
@ -1,131 +0,0 @@
|
||||||
//
|
|
||||||
// The developer of the original code and/or files is Tripwire, Inc.
|
|
||||||
// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire,
|
|
||||||
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
|
|
||||||
// reserved.
|
|
||||||
//
|
|
||||||
// This program is free software. The contents of this file are subject
|
|
||||||
// to the terms of the GNU General Public License as published by the
|
|
||||||
// Free Software Foundation; either version 2 of the License, or (at your
|
|
||||||
// option) any later version. You may redistribute it and/or modify it
|
|
||||||
// only in compliance with the GNU General Public License.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful.
|
|
||||||
// However, this program is distributed AS-IS WITHOUT ANY
|
|
||||||
// WARRANTY; INCLUDING THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS
|
|
||||||
// FOR A PARTICULAR PURPOSE. Please see the GNU General Public License
|
|
||||||
// for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with this program; if not, write to the Free Software
|
|
||||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
|
||||||
// USA.
|
|
||||||
//
|
|
||||||
// Nothing in the GNU General Public License or any other license to use
|
|
||||||
// the code or files shall permit you to use Tripwire's trademarks,
|
|
||||||
// service marks, or other intellectual property without Tripwire's
|
|
||||||
// prior written consent.
|
|
||||||
//
|
|
||||||
// If you have any questions, please contact Tripwire, Inc. at either
|
|
||||||
// info@tripwire.org or www.tripwire.org.
|
|
||||||
//
|
|
||||||
// objectpool.cpp
|
|
||||||
#include "stdcore.h"
|
|
||||||
#include "objectpool.h"
|
|
||||||
#include "debug.h"
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// cBlockLink
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
class cBlockLink
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
cBlockLink(cBlockLink* pNext) : mpNext(pNext) {}
|
|
||||||
cBlockLink* Next() { return mpNext; }
|
|
||||||
private:
|
|
||||||
cBlockLink* mpNext; // pointer to the next link, or NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// cBlockList
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
// ctor, dtor
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
cBlockList::cBlockList() :
|
|
||||||
mpBlocks(0)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
cBlockList::~cBlockList()
|
|
||||||
{
|
|
||||||
Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Allocate
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
void* cBlockList::Allocate(int size)
|
|
||||||
{
|
|
||||||
char* mem = new char[size + sizeof(cBlockLink)];
|
|
||||||
mpBlocks = new(mem) cBlockLink(mpBlocks);
|
|
||||||
return mem + sizeof(cBlockLink);
|
|
||||||
}
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Clear
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
void cBlockList::Clear()
|
|
||||||
{
|
|
||||||
while(mpBlocks)
|
|
||||||
{
|
|
||||||
cBlockLink* pLink = mpBlocks;
|
|
||||||
mpBlocks = mpBlocks->Next();
|
|
||||||
pLink->~cBlockLink();
|
|
||||||
delete [] (char*)(pLink);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// cObjectPoolBase
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
// ctor, dtor
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
cObjectPoolBase::cObjectPoolBase(int objSize, int chunkSize) :
|
|
||||||
mObjectSize(objSize),
|
|
||||||
mChunkSize(chunkSize),
|
|
||||||
mpNextFree(0)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
cObjectPoolBase::~cObjectPoolBase()
|
|
||||||
{
|
|
||||||
//TODO -- assert that the number of instances left are 0.
|
|
||||||
Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
// AllocNewChunk
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
void cObjectPoolBase::AllocNewChunk()
|
|
||||||
{
|
|
||||||
ASSERT(mpNextFree == 0);
|
|
||||||
|
|
||||||
int size = mObjectSize * mChunkSize;
|
|
||||||
char* pBlock = (char*)mBlockList.Allocate(size);
|
|
||||||
|
|
||||||
char* pLast = pBlock + size - mObjectSize;
|
|
||||||
for(char* pc = pBlock; pc < pLast; pc += mObjectSize)
|
|
||||||
{
|
|
||||||
((cLink*)pc)->mpNext = (cLink*)(pc + mObjectSize);
|
|
||||||
}
|
|
||||||
((cLink*)pLast)->mpNext = 0;
|
|
||||||
|
|
||||||
mpNextFree = (cLink*)pBlock;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -1,140 +0,0 @@
|
||||||
//
|
|
||||||
// The developer of the original code and/or files is Tripwire, Inc.
|
|
||||||
// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire,
|
|
||||||
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
|
|
||||||
// reserved.
|
|
||||||
//
|
|
||||||
// This program is free software. The contents of this file are subject
|
|
||||||
// to the terms of the GNU General Public License as published by the
|
|
||||||
// Free Software Foundation; either version 2 of the License, or (at your
|
|
||||||
// option) any later version. You may redistribute it and/or modify it
|
|
||||||
// only in compliance with the GNU General Public License.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful.
|
|
||||||
// However, this program is distributed AS-IS WITHOUT ANY
|
|
||||||
// WARRANTY; INCLUDING THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS
|
|
||||||
// FOR A PARTICULAR PURPOSE. Please see the GNU General Public License
|
|
||||||
// for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with this program; if not, write to the Free Software
|
|
||||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
|
||||||
// USA.
|
|
||||||
//
|
|
||||||
// Nothing in the GNU General Public License or any other license to use
|
|
||||||
// the code or files shall permit you to use Tripwire's trademarks,
|
|
||||||
// service marks, or other intellectual property without Tripwire's
|
|
||||||
// prior written consent.
|
|
||||||
//
|
|
||||||
// If you have any questions, please contact Tripwire, Inc. at either
|
|
||||||
// info@tripwire.org or www.tripwire.org.
|
|
||||||
//
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
// objectpool.h
|
|
||||||
//
|
|
||||||
// cBlockList -- a linked list of blocks of memory
|
|
||||||
// cObjectPoolBase -- a pool of equal-sized objects; constant time allocation
|
|
||||||
#ifndef __OBJECTPOOL_H
|
|
||||||
#define __OBJECTPOOL_H
|
|
||||||
|
|
||||||
class cBlockLink;
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// cBlockList
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
class cBlockList
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
cBlockList();
|
|
||||||
~cBlockList();
|
|
||||||
|
|
||||||
void* Allocate(int size);
|
|
||||||
void Clear(); // releases everything in the block list
|
|
||||||
private:
|
|
||||||
cBlockLink* mpBlocks; // linked list of blocks
|
|
||||||
};
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// cObjectPoolBase
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
class cObjectPoolBase
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
cObjectPoolBase(int objSize, int chunkSize);
|
|
||||||
~cObjectPoolBase();
|
|
||||||
// NOTE -- dtor is not virtual; therefore it is potentially dangerous to delete a pointer to
|
|
||||||
// this class unless you know for sure the dynamic class type has nothing to clean up.
|
|
||||||
|
|
||||||
void* Alloc ();
|
|
||||||
void Free (void* pObj);
|
|
||||||
void Clear ();
|
|
||||||
//TODO -- add IsPointerValid()
|
|
||||||
private:
|
|
||||||
void AllocNewChunk(); // get another chunk to use...
|
|
||||||
|
|
||||||
struct cLink
|
|
||||||
{
|
|
||||||
cLink* mpNext;
|
|
||||||
};
|
|
||||||
|
|
||||||
cBlockList mBlockList;
|
|
||||||
const int mObjectSize; // how big are the objects?
|
|
||||||
const int mChunkSize; // how big are the chunks we are allocating?
|
|
||||||
cLink* mpNextFree; // the next free object
|
|
||||||
//int mInstanceCount; // number of objects that are currently allocated but not freed.
|
|
||||||
};
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// cObjectPool
|
|
||||||
// Note -- this template only works for classes that are constructed with their
|
|
||||||
// default ctor; I don't know how to extend this model to work for non-default
|
|
||||||
// ctors...
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
template <class T>
|
|
||||||
class cObjectPool : public cObjectPoolBase
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
cObjectPool(int chunkSize) : cObjectPoolBase(sizeof(T), chunkSize) {}
|
|
||||||
|
|
||||||
T* New () { return new(cObjectPoolBase::Alloc()) T(); }
|
|
||||||
void Delete (T* pObj) { pObj->~T(); Free(pObj); }
|
|
||||||
};
|
|
||||||
|
|
||||||
//#############################################################################
|
|
||||||
// inline implementation
|
|
||||||
//#############################################################################
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Alloc
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
inline void* cObjectPoolBase::Alloc()
|
|
||||||
{
|
|
||||||
if(! mpNextFree)
|
|
||||||
AllocNewChunk();
|
|
||||||
|
|
||||||
cLink* pRtn = mpNextFree;
|
|
||||||
mpNextFree = mpNextFree->mpNext;
|
|
||||||
return pRtn;
|
|
||||||
}
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Free
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
inline void cObjectPoolBase::Free(void* pObj)
|
|
||||||
{
|
|
||||||
cLink* pNew = (cLink*)pObj;
|
|
||||||
pNew->mpNext = mpNextFree;
|
|
||||||
mpNextFree = pNew;
|
|
||||||
}
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Clear
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
inline void cObjectPoolBase::Clear()
|
|
||||||
{
|
|
||||||
mBlockList.Clear();
|
|
||||||
mpNextFree = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif //__OBJECTPOOL_H
|
|
||||||
|
|
|
@ -144,7 +144,7 @@
|
||||||
#define OS OS_OPENBSD
|
#define OS OS_OPENBSD
|
||||||
#define IS_OPENBSD 1
|
#define IS_OPENBSD 1
|
||||||
|
|
||||||
#elif defined(_OSX)
|
#elif defined(__APPLE__)
|
||||||
#define OS OS_DARWIN
|
#define OS OS_DARWIN
|
||||||
#define IS_DARWIN 1
|
#define IS_DARWIN 1
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@
|
||||||
#define IS_MIDNIGHTBSD 1
|
#define IS_MIDNIGHTBSD 1
|
||||||
|
|
||||||
|
|
||||||
#elif defined(_SOLARIS) || defined(__sun)
|
#elif defined(__sun)
|
||||||
#define OS OS_SOLARIS
|
#define OS OS_SOLARIS
|
||||||
#define IS_SOLARIS 1
|
#define IS_SOLARIS 1
|
||||||
|
|
||||||
|
@ -165,11 +165,11 @@
|
||||||
#define OS OS_AIX
|
#define OS OS_AIX
|
||||||
#define IS_AIX 1
|
#define IS_AIX 1
|
||||||
|
|
||||||
#elif defined (_HPUX)
|
#elif defined (__hpux)
|
||||||
#define OS OS_HPUX
|
#define OS OS_HPUX
|
||||||
#define IS_HPUX 1
|
#define IS_HPUX 1
|
||||||
|
|
||||||
#elif defined(_IRIX)
|
#elif defined(__sgi)
|
||||||
#define OS OS_IRIX
|
#define OS OS_IRIX
|
||||||
#define IS_IRIX 1
|
#define IS_IRIX 1
|
||||||
|
|
||||||
|
|
|
@ -135,9 +135,6 @@ void cRefCountObj::AddRef() const
|
||||||
|
|
||||||
void cRefCountObj::Release() const
|
void cRefCountObj::Release() const
|
||||||
{
|
{
|
||||||
if (this == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (--mRefCount == 0)
|
if (--mRefCount == 0)
|
||||||
{
|
{
|
||||||
Delete();
|
Delete();
|
||||||
|
|
|
@ -241,14 +241,9 @@ Resource_Class::Get( ConstKeyRef id ) const
|
||||||
|
|
||||||
if ( at == m_table.end() )
|
if ( at == m_table.end() )
|
||||||
{
|
{
|
||||||
#if IS_UNIX
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
std::cerr << "*** Error Resource_Class::Get() [" __FILE__ ":" << __LINE__ << "]: Resource not found\n";
|
std::cerr << "*** Error Resource_Class::Get() [" __FILE__ ":" << __LINE__ << "]: Resource not found\n";
|
||||||
#endif
|
#endif
|
||||||
#else
|
|
||||||
ASSERTMSG( 0, "Resource does not exist!" );
|
|
||||||
#endif
|
|
||||||
// TSS_Raise( eInternal, "Resource does not exist!" );
|
|
||||||
|
|
||||||
return DefaultValueRef();
|
return DefaultValueRef();
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,6 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#if IS_UNIX
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// cUnixTimeFn -- Unix version, inserts proper function call and overloads
|
// cUnixTimeFn -- Unix version, inserts proper function call and overloads
|
||||||
// operator()
|
// operator()
|
||||||
|
@ -98,7 +97,7 @@ private:
|
||||||
typedef cTaskTimer<cUnixTimeFn, cUnixTimeFn::DataType> cUnixTaskTimer;
|
typedef cTaskTimer<cUnixTimeFn, cUnixTimeFn::DataType> cUnixTaskTimer;
|
||||||
typedef cUnixTaskTimer cGenericTaskTimer;
|
typedef cUnixTaskTimer cGenericTaskTimer;
|
||||||
|
|
||||||
#endif // IS_UNIX
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// inline implementation
|
// inline implementation
|
||||||
|
|
|
@ -60,16 +60,12 @@
|
||||||
// A little macro that's useful for finding the number of characters in a TCHAR ARRAY
|
// A little macro that's useful for finding the number of characters in a TCHAR ARRAY
|
||||||
#define countof( x ) ( sizeof( x ) / sizeof( x[0] ) )
|
#define countof( x ) ( sizeof( x ) / sizeof( x[0] ) )
|
||||||
|
|
||||||
#if IS_UNIX
|
|
||||||
|
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define TCHAR char
|
#define TCHAR char
|
||||||
#define _tmain main
|
#define _tmain main
|
||||||
|
|
||||||
|
@ -129,7 +125,5 @@ typedef std::ifstream TIFSTREAM;
|
||||||
#define __cdecl
|
#define __cdecl
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // WIN32
|
|
||||||
|
|
||||||
#endif // __TCHAR_H
|
#endif // __TCHAR_H
|
||||||
|
|
||||||
|
|
|
@ -38,9 +38,7 @@
|
||||||
|
|
||||||
static void util_SignalHandler( int sig );
|
static void util_SignalHandler( int sig );
|
||||||
|
|
||||||
#if IS_UNIX
|
|
||||||
static void tw_psignal( int sig, const TCHAR* s );
|
static void tw_psignal( int sig, const TCHAR* s );
|
||||||
#endif
|
|
||||||
|
|
||||||
tw_sighandler_t tw_signal(int sig, tw_sighandler_t pFunc)
|
tw_sighandler_t tw_signal(int sig, tw_sighandler_t pFunc)
|
||||||
{
|
{
|
||||||
|
@ -69,15 +67,10 @@ void util_SignalHandler( int sig )
|
||||||
{
|
{
|
||||||
//If we're on unix, let's print out a nice error message telling
|
//If we're on unix, let's print out a nice error message telling
|
||||||
//the user which signal we've recieved.
|
//the user which signal we've recieved.
|
||||||
#if IS_UNIX
|
|
||||||
tw_psignal( sig, (TSS_GetString( cCore, core::STR_SIGNAL).c_str() ) );
|
tw_psignal( sig, (TSS_GetString( cCore, core::STR_SIGNAL).c_str() ) );
|
||||||
#endif
|
|
||||||
|
|
||||||
exit( 8 );
|
exit( 8 );
|
||||||
}
|
}
|
||||||
|
|
||||||
#if IS_UNIX
|
|
||||||
|
|
||||||
/* For the morbidly curious, here's a thread where a POSIX standards committee
|
/* For the morbidly curious, here's a thread where a POSIX standards committee
|
||||||
wrings its hands about how to define NSIG: http://austingroupbugs.net/view.php?id=741#c1834 */
|
wrings its hands about how to define NSIG: http://austingroupbugs.net/view.php?id=741#c1834 */
|
||||||
#ifndef NSIG
|
#ifndef NSIG
|
||||||
|
@ -126,5 +119,5 @@ void tw_psignal(int sig, const TCHAR *str)
|
||||||
|
|
||||||
_ftprintf(stderr, _T("%s %s\n"), str, sig < NSIG ? siglist[sig] : siglist[0]);
|
_ftprintf(stderr, _T("%s %s\n"), str, sig < NSIG ? siglist[sig] : siglist[0]);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
|
@ -187,5 +187,16 @@ inline int64 SWAPBYTES64(int64 i)
|
||||||
|
|
||||||
#endif //WORDS_BIGENDIAN
|
#endif //WORDS_BIGENDIAN
|
||||||
|
|
||||||
|
////////////////////////////////////////////
|
||||||
|
|
||||||
|
#if __cplusplus >= 201103L
|
||||||
|
# define TW_UNIQUE_PTR std::unique_ptr
|
||||||
|
#else
|
||||||
|
# define TW_UNIQUE_PTR std::auto_ptr
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // __TYPES_H
|
#endif // __TYPES_H
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,6 @@
|
||||||
eUnix::eUnix( const TCHAR* szFunctionName, const TCHAR* szObjectName, bool fCallGetLastError)
|
eUnix::eUnix( const TCHAR* szFunctionName, const TCHAR* szObjectName, bool fCallGetLastError)
|
||||||
: eError( _T(""))
|
: eError( _T(""))
|
||||||
{
|
{
|
||||||
#if IS_UNIX
|
|
||||||
ASSERT( szFunctionName || szObjectName || fCallGetLastError );
|
ASSERT( szFunctionName || szObjectName || fCallGetLastError );
|
||||||
//
|
//
|
||||||
// construct the error message:
|
// construct the error message:
|
||||||
|
@ -78,7 +77,6 @@ eUnix::eUnix( const TCHAR* szFunctionName, const TCHAR* szObjectName, bool fCall
|
||||||
mMsg += strErr;
|
mMsg += strErr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // IS_UNIX
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// eof - unixexcept.cpp
|
// eof - unixexcept.cpp
|
||||||
|
|
|
@ -183,10 +183,10 @@ TCHAR cUnixFSServices::GetPathSeparator() const
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !USES_DEVICE_PATH
|
#if !USES_DEVICE_PATH
|
||||||
void cUnixFSServices::ReadDir(const TSTRING& strFilename, std::vector<TSTRING> &v, bool bFullPaths) const throw(eFSServices)
|
void cUnixFSServices::ReadDir(const TSTRING& strFilename, std::vector<TSTRING> &v, bool bFullPaths) const
|
||||||
{
|
{
|
||||||
#else
|
#else
|
||||||
void cUnixFSServices::ReadDir(const TSTRING& strFilenameC, std::vector<TSTRING>& v, bool bFullPaths) const throw(eFSServices)
|
void cUnixFSServices::ReadDir(const TSTRING& strFilenameC, std::vector<TSTRING>& v, bool bFullPaths) const
|
||||||
{
|
{
|
||||||
TSTRING strFilename = cDevicePath::AsNative(strFilenameC);
|
TSTRING strFilename = cDevicePath::AsNative(strFilenameC);
|
||||||
#endif
|
#endif
|
||||||
|
@ -237,7 +237,7 @@ void cUnixFSServices::ReadDir(const TSTRING& strFilenameC, std::vector<TSTRING>&
|
||||||
}
|
}
|
||||||
|
|
||||||
/* needs to and with S_IFMT, check EQUALITY with S_*, and return more types
|
/* needs to and with S_IFMT, check EQUALITY with S_*, and return more types
|
||||||
cFSStatArgs::FileType cUnixFSServices::GetFileType(const cFCOName &filename) throw(eFSServices)
|
cFSStatArgs::FileType cUnixFSServices::GetFileType(const cFCOName &filename)
|
||||||
{
|
{
|
||||||
cFSStatArgs stat;
|
cFSStatArgs stat;
|
||||||
Stat(filename, stat);
|
Stat(filename, stat);
|
||||||
|
@ -245,7 +245,7 @@ cFSStatArgs::FileType cUnixFSServices::GetFileType(const cFCOName &filename) thr
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void cUnixFSServices::GetCurrentDir( TSTRING& strCurDir ) const throw(eFSServices)
|
void cUnixFSServices::GetCurrentDir( TSTRING& strCurDir ) const
|
||||||
{
|
{
|
||||||
TCHAR pathname[iFSServices::TW_MAX_PATH];
|
TCHAR pathname[iFSServices::TW_MAX_PATH];
|
||||||
pathname[0] = '\0';
|
pathname[0] = '\0';
|
||||||
|
@ -258,13 +258,13 @@ void cUnixFSServices::GetCurrentDir( TSTRING& strCurDir ) const throw(eFSService
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TSTRING& cUnixFSServices::MakeTempFilename( TSTRING& strName ) const throw(eFSServices)
|
TSTRING& cUnixFSServices::MakeTempFilename( TSTRING& strName ) const
|
||||||
{
|
{
|
||||||
char* pchTempFileName;
|
char* pchTempFileName;
|
||||||
char szTemplate[iFSServices::TW_MAX_PATH];
|
char szTemplate[iFSServices::TW_MAX_PATH];
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
strcpy( szTemplate, strName.c_str() );
|
strncpy( szTemplate, strName.c_str(), iFSServices::TW_MAX_PATH );
|
||||||
|
|
||||||
#ifdef HAVE_MKSTEMP
|
#ifdef HAVE_MKSTEMP
|
||||||
// create temp filename and check to see if mkstemp failed
|
// create temp filename and check to see if mkstemp failed
|
||||||
|
@ -295,7 +295,7 @@ TSTRING& cUnixFSServices::MakeTempFilename( TSTRING& strName ) const throw(eFSSe
|
||||||
return( strName );
|
return( strName );
|
||||||
}
|
}
|
||||||
|
|
||||||
void cUnixFSServices::GetTempDirName( TSTRING& strName ) const throw(eFSServices)
|
void cUnixFSServices::GetTempDirName( TSTRING& strName ) const
|
||||||
{
|
{
|
||||||
strName = mTempPath;
|
strName = mTempPath;
|
||||||
}
|
}
|
||||||
|
@ -307,10 +307,10 @@ void cUnixFSServices::SetTempDirName(TSTRING& tmpPath) {
|
||||||
|
|
||||||
|
|
||||||
#if !USES_DEVICE_PATH
|
#if !USES_DEVICE_PATH
|
||||||
void cUnixFSServices::Stat( const TSTRING& strName, cFSStatArgs &stat ) const throw(eFSServices)
|
void cUnixFSServices::Stat( const TSTRING& strName, cFSStatArgs &stat ) const
|
||||||
{
|
{
|
||||||
#else
|
#else
|
||||||
void cUnixFSServices::Stat( const TSTRING& strNameC, cFSStatArgs& stat) const throw(eFSServices)
|
void cUnixFSServices::Stat( const TSTRING& strNameC, cFSStatArgs& stat) const
|
||||||
{
|
{
|
||||||
TSTRING strName = cDevicePath::AsNative(strNameC);
|
TSTRING strName = cDevicePath::AsNative(strNameC);
|
||||||
#endif
|
#endif
|
||||||
|
@ -375,7 +375,7 @@ void cUnixFSServices::Stat( const TSTRING& strNameC, cFSStatArgs& stat) const th
|
||||||
else stat.mFileType = cFSStatArgs::TY_INVALID;
|
else stat.mFileType = cFSStatArgs::TY_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cUnixFSServices::GetMachineName( TSTRING& strName ) const throw( eFSServices )
|
void cUnixFSServices::GetMachineName( TSTRING& strName ) const
|
||||||
{
|
{
|
||||||
#if HAVE_SYS_UTSNAME_H
|
#if HAVE_SYS_UTSNAME_H
|
||||||
struct utsname namebuf;
|
struct utsname namebuf;
|
||||||
|
@ -604,8 +604,8 @@ bool cUnixFSServices::GetGroupName( gid_t group_id, TSTRING& tstrGroup ) const
|
||||||
//
|
//
|
||||||
void cUnixFSServices::ConvertModeToString( uint64 perm, TSTRING& tstrPerm ) const
|
void cUnixFSServices::ConvertModeToString( uint64 perm, TSTRING& tstrPerm ) const
|
||||||
{
|
{
|
||||||
TCHAR szPerm[11]; //10 permission bits plus the NULL
|
TCHAR szPerm[12]; //10 permission bits plus the NULL
|
||||||
_tcscpy( szPerm, _T("----------") );
|
strncpy( szPerm, _T("----------"), 11);
|
||||||
|
|
||||||
ASSERT( sizeof(unsigned short) <= sizeof(uint32) );
|
ASSERT( sizeof(unsigned short) <= sizeof(uint32) );
|
||||||
// We do this in case an "unsigned short" is ever larger than the
|
// We do this in case an "unsigned short" is ever larger than the
|
||||||
|
@ -912,7 +912,7 @@ bool util_PathFind( TSTRING& strFullPath, const TSTRING& strFilename )
|
||||||
//
|
//
|
||||||
// get the path environment variable
|
// get the path environment variable
|
||||||
//
|
//
|
||||||
TCHAR* pszPathVar = _tgetenv("PATH");
|
TCHAR* pszPathVar = getenv("PATH");
|
||||||
if( pszPathVar != NULL )
|
if( pszPathVar != NULL )
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
#define __UNIXFSSERVICES_H
|
#define __UNIXFSSERVICES_H
|
||||||
|
|
||||||
#if !IS_UNIX
|
#if !IS_UNIX
|
||||||
#error unixfsservices.h should only be included for instantiating cUnixFSServices objects. If you just want to use iFSServices methods, include fsservices.h. Same goes for cWin32FSServices.
|
#error unixfsservices.h should only be included for instantiating cUnixFSServices objects. If you just want to use iFSServices methods, include fsservices.h.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//=========================================================================
|
//=========================================================================
|
||||||
|
@ -83,16 +83,16 @@ class cUnixFSServices : public iFSServices
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
// major filesystem functions
|
// major filesystem functions
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
virtual void Stat( const TSTRING& strFileName, cFSStatArgs& pStat ) const throw( eFSServices );
|
virtual void Stat( const TSTRING& strFileName, cFSStatArgs& pStat ) const ;
|
||||||
// fills out the cFSStatArgs structure with the stat info for the named file
|
// fills out the cFSStatArgs structure with the stat info for the named file
|
||||||
|
|
||||||
virtual void GetTempDirName( TSTRING& strName ) const throw( eFSServices );
|
virtual void GetTempDirName( TSTRING& strName ) const ;
|
||||||
// makes directory if it doesn't exist already. Dirname will end with a delimiter ( '/' )
|
// makes directory if it doesn't exist already. Dirname will end with a delimiter ( '/' )
|
||||||
|
|
||||||
virtual void SetTempDirName(TSTRING& tmpName);
|
virtual void SetTempDirName(TSTRING& tmpName);
|
||||||
// set the default dir name which GetTempDirName will use...
|
// set the default dir name which GetTempDirName will use...
|
||||||
|
|
||||||
virtual TSTRING& MakeTempFilename( TSTRING& strName ) const throw( eFSServices );
|
virtual TSTRING& MakeTempFilename( TSTRING& strName ) const ;
|
||||||
// create temporary file
|
// create temporary file
|
||||||
// strName must have the form ("baseXXXXXX"), where the X's are replaced with
|
// strName must have the form ("baseXXXXXX"), where the X's are replaced with
|
||||||
// characters to make it a unique file. There must be at least 6 Xs.
|
// characters to make it a unique file. There must be at least 6 Xs.
|
||||||
|
@ -103,7 +103,7 @@ class cUnixFSServices : public iFSServices
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
virtual void GetHostID( TSTRING& name ) const;
|
virtual void GetHostID( TSTRING& name ) const;
|
||||||
|
|
||||||
virtual void GetMachineName( TSTRING& name) const throw(eFSServices);
|
virtual void GetMachineName( TSTRING& name) const;
|
||||||
|
|
||||||
virtual void GetMachineNameFullyQualified( TSTRING& name ) const;
|
virtual void GetMachineNameFullyQualified( TSTRING& name ) const;
|
||||||
|
|
||||||
|
@ -115,9 +115,9 @@ class cUnixFSServices : public iFSServices
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
// directory specific functions
|
// directory specific functions
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
virtual void ReadDir( const TSTRING& strName, std::vector<TSTRING> &vDirContents, bool bFullPaths = true ) const throw( eFSServices );
|
virtual void ReadDir( const TSTRING& strName, std::vector<TSTRING> &vDirContents, bool bFullPaths = true ) const;
|
||||||
// puts the contents of the specified directory, except for . and .., into the supplied vector.
|
// puts the contents of the specified directory, except for . and .., into the supplied vector.
|
||||||
virtual void GetCurrentDir( TSTRING& strCurDir ) const throw( eFSServices );
|
virtual void GetCurrentDir( TSTRING& strCurDir ) const;
|
||||||
// returns the current working directory
|
// returns the current working directory
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,152 +0,0 @@
|
||||||
//
|
|
||||||
// The developer of the original code and/or files is Tripwire, Inc.
|
|
||||||
// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire,
|
|
||||||
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
|
|
||||||
// reserved.
|
|
||||||
//
|
|
||||||
// This program is free software. The contents of this file are subject
|
|
||||||
// to the terms of the GNU General Public License as published by the
|
|
||||||
// Free Software Foundation; either version 2 of the License, or (at your
|
|
||||||
// option) any later version. You may redistribute it and/or modify it
|
|
||||||
// only in compliance with the GNU General Public License.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful.
|
|
||||||
// However, this program is distributed AS-IS WITHOUT ANY
|
|
||||||
// WARRANTY; INCLUDING THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS
|
|
||||||
// FOR A PARTICULAR PURPOSE. Please see the GNU General Public License
|
|
||||||
// for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with this program; if not, write to the Free Software
|
|
||||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
|
||||||
// USA.
|
|
||||||
//
|
|
||||||
// Nothing in the GNU General Public License or any other license to use
|
|
||||||
// the code or files shall permit you to use Tripwire's trademarks,
|
|
||||||
// service marks, or other intellectual property without Tripwire's
|
|
||||||
// prior written consent.
|
|
||||||
//
|
|
||||||
// If you have any questions, please contact Tripwire, Inc. at either
|
|
||||||
// info@tripwire.org or www.tripwire.org.
|
|
||||||
//
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
// utf8.h
|
|
||||||
//
|
|
||||||
#include "stdcore.h"
|
|
||||||
#include "utf8.h" // Required Deps
|
|
||||||
#include "tchar.h"
|
|
||||||
//#include "integ/tss.integ.strings.h"
|
|
||||||
//#include "integ/tss.integ.strings.inl"
|
|
||||||
|
|
||||||
#ifdef _UNICODE
|
|
||||||
|
|
||||||
|
|
||||||
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
// CLASS UTF8: Member Definitions
|
|
||||||
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
|
|
||||||
// NOTES: utf8 uses "lazy evaluation" so that members are only allocated
|
|
||||||
// if they are used. However, once they are evaluated, the evaluation results
|
|
||||||
// will be saved so that values may henceforth simply be returned. This
|
|
||||||
// scheme gives the best time vs. space performance possible as the complexity
|
|
||||||
// of each operation is at most, linear.
|
|
||||||
|
|
||||||
|
|
||||||
const char* cUTF8::str() const THROW(std::bad_alloc) // UTF8: Get as Narrow UTF8
|
|
||||||
{
|
|
||||||
if ( mUTF8Str == 0 ) // If mUTF8Str is NULL mUnicodeStr can't be
|
|
||||||
mUTF8Str = cUTF8::allocate( mUnicodeStr );
|
|
||||||
|
|
||||||
return mUTF8Str;
|
|
||||||
}
|
|
||||||
|
|
||||||
const wchar_t* cUTF8::ustr() const THROW(std::bad_alloc) // UTF8: Get as UNICODE NTWCS
|
|
||||||
{
|
|
||||||
if ( mUnicodeStr == 0 )
|
|
||||||
mUnicodeStr = cUTF8::allocate( mUTF8Str ); // If mUnicodeStr is NULL mUTF8WideStr can't be
|
|
||||||
|
|
||||||
return mUnicodeStr;
|
|
||||||
}
|
|
||||||
|
|
||||||
const wchar_t* cUTF8::wstr() const THROW(std::bad_alloc) // UTF8: Get as Wide UTF8
|
|
||||||
{
|
|
||||||
if ( mUTF8WideStr == 0 )
|
|
||||||
{
|
|
||||||
size_t N = ::strlen( str() ); // WARNING: Get strlen NOT mbcslen!!!
|
|
||||||
mUTF8WideStr = new wchar_t[ N + 1 ]; // This may throw bad_alloc to client
|
|
||||||
|
|
||||||
for ( size_t n = 0; n < N; n++ ) // index ordinal, not pointer
|
|
||||||
mUTF8WideStr[n] = wchar_t( BYTE(mUTF8Str[n]) ); // WARNING: First convert to "unsigned char"
|
|
||||||
|
|
||||||
mUTF8WideStr[N] = 0; // add a final NULL
|
|
||||||
}
|
|
||||||
|
|
||||||
return mUTF8WideStr;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// UTF8: UTF8-Unicode Round-trip Conversions
|
|
||||||
|
|
||||||
wchar_t* cUTF8::allocate( const char* in ) THROW( std::bad_alloc )
|
|
||||||
{
|
|
||||||
ASSERT( in /* && TSS_IsValidString( in )*/ ); // Verify Input
|
|
||||||
|
|
||||||
size_t N = ::MultiByteToWideChar( CP_UTF8, 0, in, -1, 0, 0 );
|
|
||||||
wchar_t* out = new wchar_t[ N + 1 ]; // Allocate required size
|
|
||||||
|
|
||||||
|
|
||||||
//--Convert
|
|
||||||
|
|
||||||
out[0] = 0x00; // NOTE: Just in case we fail
|
|
||||||
#ifdef _DEBUG
|
|
||||||
//size_t nWritten =
|
|
||||||
#endif
|
|
||||||
::MultiByteToWideChar( CP_UTF8, 0, in, -1, out, N );
|
|
||||||
out[N] = 0;
|
|
||||||
|
|
||||||
#ifdef _INTEG2 // Verify Output
|
|
||||||
if ( nWritten == 0 )
|
|
||||||
{
|
|
||||||
cDebug d( "cUTF8::allocate" );
|
|
||||||
d.TraceError( "MultiByteToWideChar failed with %x\n", ::GetLastError() );
|
|
||||||
}
|
|
||||||
|
|
||||||
ASSERT( out && TSS_IsValidString( out, nWritten ) );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
char* cUTF8::allocate( const wchar_t* in ) THROW( std::bad_alloc )
|
|
||||||
{
|
|
||||||
ASSERT( in /*&& TSS_IsValidString( in ) */); // Verify Input
|
|
||||||
|
|
||||||
// Allocate required size
|
|
||||||
size_t N = ::WideCharToMultiByte( CP_UTF8, 0, in, -1,0,0,0,0 );
|
|
||||||
char* out = new char[ N + 1 ];
|
|
||||||
|
|
||||||
|
|
||||||
//--Convert
|
|
||||||
|
|
||||||
out[0] = 0x00; // NOTE: Just in case we fail
|
|
||||||
#ifdef _DEBUG
|
|
||||||
//size_t nWritten =
|
|
||||||
#endif
|
|
||||||
::WideCharToMultiByte( CP_UTF8, 0, in, -1, out, N, 0, 0 );
|
|
||||||
out[N] = 0;
|
|
||||||
|
|
||||||
#ifdef _INTEG2 // Verify Output
|
|
||||||
if ( nWritten == 0 )
|
|
||||||
{
|
|
||||||
cDebug d( "cUTF8::allocate" );
|
|
||||||
d.TraceError( "WideCharToMultiByte failed with %x\n", ::GetLastError() );
|
|
||||||
}
|
|
||||||
|
|
||||||
ASSERT( out /*&& TSS_IsValidString( out, nWritten ) */);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif //_UNICODE
|
|
||||||
|
|
187
src/core/utf8.h
187
src/core/utf8.h
|
@ -1,187 +0,0 @@
|
||||||
//
|
|
||||||
// The developer of the original code and/or files is Tripwire, Inc.
|
|
||||||
// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire,
|
|
||||||
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
|
|
||||||
// reserved.
|
|
||||||
//
|
|
||||||
// This program is free software. The contents of this file are subject
|
|
||||||
// to the terms of the GNU General Public License as published by the
|
|
||||||
// Free Software Foundation; either version 2 of the License, or (at your
|
|
||||||
// option) any later version. You may redistribute it and/or modify it
|
|
||||||
// only in compliance with the GNU General Public License.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful.
|
|
||||||
// However, this program is distributed AS-IS WITHOUT ANY
|
|
||||||
// WARRANTY; INCLUDING THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS
|
|
||||||
// FOR A PARTICULAR PURPOSE. Please see the GNU General Public License
|
|
||||||
// for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with this program; if not, write to the Free Software
|
|
||||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
|
||||||
// USA.
|
|
||||||
//
|
|
||||||
// Nothing in the GNU General Public License or any other license to use
|
|
||||||
// the code or files shall permit you to use Tripwire's trademarks,
|
|
||||||
// service marks, or other intellectual property without Tripwire's
|
|
||||||
// prior written consent.
|
|
||||||
//
|
|
||||||
// If you have any questions, please contact Tripwire, Inc. at either
|
|
||||||
// info@tripwire.org or www.tripwire.org.
|
|
||||||
//
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
// utf8.h
|
|
||||||
//
|
|
||||||
|
|
||||||
// UTF8 is used to map UNICODE characters to NTBS targets
|
|
||||||
// that would normally not be able to dealt with. UTF8
|
|
||||||
// ensures symetrical round-trip conversions. In other
|
|
||||||
// words an unmapable UNICODE character converted to UTF8
|
|
||||||
// will always convert back to the same UNICODE value.
|
|
||||||
//
|
|
||||||
// For more information, go to:
|
|
||||||
// mk:@MSITStore:\\SQUID\MSDN%20January%201999\MSDN\kbwindev.chm::/Source/win32sdk/q175392.htm
|
|
||||||
|
|
||||||
#ifndef __UTF8_H
|
|
||||||
#define __UTF8_H
|
|
||||||
|
|
||||||
#include <iostream> // operator<<
|
|
||||||
|
|
||||||
//#ifndef __TSS_INTEG_STRINGS_H
|
|
||||||
//#include "integ/tss.integ.strings.h" // IsValidAddress and IsValidString
|
|
||||||
//#endif
|
|
||||||
#ifndef __DEBUG_H
|
|
||||||
#include "debug.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// convenience macros
|
|
||||||
//
|
|
||||||
// use these when printing a string ( TCHAR* ) to stdout, stderr, of printf-style
|
|
||||||
// function to safely convert the string to something printable
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
#ifdef _UNICODE
|
|
||||||
# define TSS_UTF8( x ) cUTF8( x ).wstr()
|
|
||||||
#else
|
|
||||||
# define TSS_UTF8( x ) x
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _UNICODE // this class is only needed in unicode builds...
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Entities Declared in this Module
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
class cUTF8;
|
|
||||||
|
|
||||||
std::ostream& operator<<( std::ostream&, const cUTF8& );
|
|
||||||
std::wostream& operator<<( std::wostream&, const cUTF8& );
|
|
||||||
|
|
||||||
|
|
||||||
/// Class Declaration
|
|
||||||
|
|
||||||
#ifdef _THROW_SUPPORTED
|
|
||||||
#define THROW( x ) throw( x )
|
|
||||||
#define THROW_0 throw()
|
|
||||||
#else
|
|
||||||
#define THROW( x )
|
|
||||||
#define THROW_0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//=============================================================================
|
|
||||||
// class cUTF8: Encapsulate UTF8 Encoding
|
|
||||||
//
|
|
||||||
// SYNOPSIS:
|
|
||||||
// Allows unmappable UNICODE characters to be embedded into Narrow strings
|
|
||||||
// and displayable by narrow display streams.
|
|
||||||
//
|
|
||||||
// CONSTRAINTS:
|
|
||||||
// Cannot default or copy construct or assign UTF8 instances. Each UTF8
|
|
||||||
// instance is an exclusive owner of its resources for its life-time.
|
|
||||||
// This cuts down on the amount of redundant allocation and copying that
|
|
||||||
// is required by the class.
|
|
||||||
//=============================================================================
|
|
||||||
|
|
||||||
class cUTF8
|
|
||||||
{
|
|
||||||
/// Interface.
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
cUTF8( const char* ) THROW( std::bad_alloc );
|
|
||||||
cUTF8( const wchar_t* ) THROW( std::bad_alloc );
|
|
||||||
~cUTF8();
|
|
||||||
|
|
||||||
const char* str() const THROW( std::bad_alloc ); // Narrow UTF8
|
|
||||||
const wchar_t* wstr() const THROW( std::bad_alloc ); // Wide UTF8
|
|
||||||
const wchar_t* ustr() const THROW( std::bad_alloc ); // Unicode
|
|
||||||
|
|
||||||
|
|
||||||
/// Implementation.
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
static char* allocate( const wchar_t* ) THROW( std::bad_alloc );
|
|
||||||
static wchar_t* allocate( const char* ) THROW( std::bad_alloc );
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
cUTF8( const cUTF8& ); // Disallow
|
|
||||||
cUTF8& operator=( const cUTF8& ); // Disallow
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
mutable wchar_t* mUnicodeStr; // UNICODE String
|
|
||||||
mutable char* mUTF8Str; // UTF8 Bytes String
|
|
||||||
mutable wchar_t* mUTF8WideStr; // UTF8 Wide Character String
|
|
||||||
};
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// UTF8 Inlines: Members and Global Binary Non-Member Operators
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Create from NTBS UTF8
|
|
||||||
inline cUTF8::cUTF8( const char* psz ) THROW( std::bad_alloc )
|
|
||||||
: mUnicodeStr( cUTF8::allocate( psz ) ),
|
|
||||||
mUTF8Str( 0 ),
|
|
||||||
mUTF8WideStr( 0 )
|
|
||||||
{
|
|
||||||
ASSERT( mUnicodeStr || mUTF8Str );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create from NTWCS UNICODE
|
|
||||||
inline cUTF8::cUTF8( const wchar_t* wsz ) THROW( std::bad_alloc )
|
|
||||||
: mUnicodeStr( 0 ),
|
|
||||||
mUTF8Str( cUTF8::allocate( wsz ) ),
|
|
||||||
mUTF8WideStr( 0 )
|
|
||||||
{
|
|
||||||
ASSERT( mUnicodeStr || mUTF8Str );
|
|
||||||
}
|
|
||||||
|
|
||||||
inline cUTF8::~cUTF8()
|
|
||||||
{
|
|
||||||
delete [] mUnicodeStr; // Delete UNICODE (if exists)
|
|
||||||
delete [] mUTF8Str; // Delete UTF8 (NTBS)
|
|
||||||
delete [] mUTF8WideStr; // Delete UTF8 (NTWCS)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// Operators
|
|
||||||
|
|
||||||
inline std::ostream& operator<<( std::ostream& out, const cUTF8& str )
|
|
||||||
{
|
|
||||||
out << str.str();
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline std::wostream& operator<<( std::wostream& wout, const cUTF8& str )
|
|
||||||
{
|
|
||||||
wout << str.wstr(); // CAUTION: Don't send UNICODE string, it won't display!
|
|
||||||
return wout;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif //_UNICODE
|
|
||||||
|
|
||||||
#endif/*_TSS_UTF8_H*/
|
|
||||||
|
|
|
@ -5,6 +5,12 @@
|
||||||
#include "queue.h"
|
#include "queue.h"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
#if __cplusplus >= 201103L
|
||||||
|
# define TW_UNIQUE_PTR std::unique_ptr
|
||||||
|
#else
|
||||||
|
# define TW_UNIQUE_PTR std::auto_ptr
|
||||||
|
#endif
|
||||||
|
|
||||||
Filter::Filter(BufferedTransformation *outQ)
|
Filter::Filter(BufferedTransformation *outQ)
|
||||||
: outQueue(outQ ? outQ : new ByteQueue)
|
: outQueue(outQ ? outQ : new ByteQueue)
|
||||||
{
|
{
|
||||||
|
@ -17,7 +23,7 @@ Filter::Filter(const Filter &source)
|
||||||
|
|
||||||
void Filter::Detach(BufferedTransformation *newOut)
|
void Filter::Detach(BufferedTransformation *newOut)
|
||||||
{
|
{
|
||||||
std::auto_ptr<BufferedTransformation> out(newOut ? newOut : new ByteQueue);
|
TW_UNIQUE_PTR<BufferedTransformation> out(newOut ? newOut : new ByteQueue);
|
||||||
outQueue->Close();
|
outQueue->Close();
|
||||||
outQueue->TransferTo(*out);
|
outQueue->TransferTo(*out);
|
||||||
outQueue.reset(out.release());
|
outQueue.reset(out.release());
|
||||||
|
|
|
@ -5,6 +5,12 @@
|
||||||
#include "queue.h"
|
#include "queue.h"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
#if __cplusplus >= 201103L
|
||||||
|
# define TW_UNIQUE_PTR std::unique_ptr
|
||||||
|
#else
|
||||||
|
# define TW_UNIQUE_PTR std::auto_ptr
|
||||||
|
#endif
|
||||||
|
|
||||||
Fork::Fork(int n, BufferedTransformation *const *givenOutPorts)
|
Fork::Fork(int n, BufferedTransformation *const *givenOutPorts)
|
||||||
: numberOfPorts(n), outPorts(n)
|
: numberOfPorts(n), outPorts(n)
|
||||||
{
|
{
|
||||||
|
@ -21,7 +27,7 @@ void Fork::SelectOutPort(int portNumber)
|
||||||
|
|
||||||
void Fork::Detach(BufferedTransformation *newOut)
|
void Fork::Detach(BufferedTransformation *newOut)
|
||||||
{
|
{
|
||||||
std::auto_ptr<BufferedTransformation> out(newOut ? newOut : new ByteQueue);
|
TW_UNIQUE_PTR<BufferedTransformation> out(newOut ? newOut : new ByteQueue);
|
||||||
outPorts[currentPort]->Close();
|
outPorts[currentPort]->Close();
|
||||||
outPorts[currentPort]->TransferTo(*out);
|
outPorts[currentPort]->TransferTo(*out);
|
||||||
outPorts[currentPort].reset(out.release());
|
outPorts[currentPort].reset(out.release());
|
||||||
|
|
|
@ -236,7 +236,7 @@ int Deflator::longest_match(IPos cur_match)
|
||||||
if (prev_length >= good_match) {
|
if (prev_length >= good_match) {
|
||||||
chain_length >>= 2;
|
chain_length >>= 2;
|
||||||
}
|
}
|
||||||
assert(strstart <= (unsigned)WINDOW_SIZE-MIN_LOOKAHEAD);
|
//assert(strstart <= (unsigned)WINDOW_SIZE-MIN_LOOKAHEAD);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
assert(cur_match < strstart);
|
assert(cur_match < strstart);
|
||||||
|
|
|
@ -140,7 +140,7 @@ void cBlockFile::Close()
|
||||||
void cBlockFile::Flush()
|
void cBlockFile::Flush()
|
||||||
{
|
{
|
||||||
ASSERT( mpArchive );
|
ASSERT( mpArchive );
|
||||||
for( BlockVector::iterator i = mvPagedBlocks.begin(); i != mvPagedBlocks.end(); i++ )
|
for( BlockVector::iterator i = mvPagedBlocks.begin(); i != mvPagedBlocks.end(); ++i )
|
||||||
{
|
{
|
||||||
FlushBlock( &(*i) );
|
FlushBlock( &(*i) );
|
||||||
}
|
}
|
||||||
|
@ -171,7 +171,7 @@ cBlockFile::Block* cBlockFile::GetBlock( int blockNum ) //throw (eArchive)
|
||||||
mTimer++;
|
mTimer++;
|
||||||
if( mTimer == 0 )
|
if( mTimer == 0 )
|
||||||
{
|
{
|
||||||
for( BlockVector::iterator i = mvPagedBlocks.begin(); i != mvPagedBlocks.end(); i++ )
|
for( BlockVector::iterator i = mvPagedBlocks.begin(); i != mvPagedBlocks.end(); ++i )
|
||||||
{
|
{
|
||||||
i->SetTimestamp( 0 );
|
i->SetTimestamp( 0 );
|
||||||
}
|
}
|
||||||
|
@ -179,7 +179,7 @@ cBlockFile::Block* cBlockFile::GetBlock( int blockNum ) //throw (eArchive)
|
||||||
//
|
//
|
||||||
// now, see if the desired block is in memory...
|
// now, see if the desired block is in memory...
|
||||||
//
|
//
|
||||||
for( BlockVector::iterator i = mvPagedBlocks.begin(); i != mvPagedBlocks.end(); i++ )
|
for( BlockVector::iterator i = mvPagedBlocks.begin(); i != mvPagedBlocks.end(); ++i )
|
||||||
{
|
{
|
||||||
if( i->GetBlockNum() == blockNum )
|
if( i->GetBlockNum() == blockNum )
|
||||||
{
|
{
|
||||||
|
@ -201,9 +201,9 @@ cBlockFile::Block* cBlockFile::GetBlock( int blockNum ) //throw (eArchive)
|
||||||
uint32 earliestTime = mvPagedBlocks[0].GetTimestamp();
|
uint32 earliestTime = mvPagedBlocks[0].GetTimestamp();
|
||||||
BlockVector::iterator it = mvPagedBlocks.begin();
|
BlockVector::iterator it = mvPagedBlocks.begin();
|
||||||
BlockVector::iterator earliestIter = it;
|
BlockVector::iterator earliestIter = it;
|
||||||
it++; // since we don't want to check the first one
|
++it; // since we don't want to check the first one
|
||||||
ASSERT(it != mvPagedBlocks.end());
|
ASSERT(it != mvPagedBlocks.end());
|
||||||
for( ; it != mvPagedBlocks.end(); it++ )
|
for( ; it != mvPagedBlocks.end(); ++it )
|
||||||
{
|
{
|
||||||
if( it->GetTimestamp() < earliestTime )
|
if( it->GetTimestamp() < earliestTime )
|
||||||
{
|
{
|
||||||
|
|
|
@ -277,7 +277,7 @@ int cBlockRecordFile::FindRoomForData( int32 dataSize ) //throw (eArchive)
|
||||||
//
|
//
|
||||||
BlockArray::iterator it;
|
BlockArray::iterator it;
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
for( it = mvBlocks.begin(); it != mvBlocks.end(); it++, cnt++ )
|
for( it = mvBlocks.begin(); it != mvBlocks.end(); ++it, ++cnt )
|
||||||
{
|
{
|
||||||
util_InitBlockArray( *it );
|
util_InitBlockArray( *it );
|
||||||
if( it->GetAvailableSpace() >= dataSize )
|
if( it->GetAvailableSpace() >= dataSize )
|
||||||
|
@ -310,7 +310,7 @@ void cBlockRecordFile::TraceContents(int dl) const
|
||||||
{
|
{
|
||||||
// TODO -- this is probably not what I want to do, but it helps me right now...
|
// TODO -- this is probably not what I want to do, but it helps me right now...
|
||||||
//
|
//
|
||||||
for( BlockArray::const_iterator i = mvBlocks.begin(); i != mvBlocks.end(); i++ )
|
for( BlockArray::const_iterator i = mvBlocks.begin(); i != mvBlocks.end(); ++i )
|
||||||
{
|
{
|
||||||
i->TraceContents( dl );
|
i->TraceContents( dl );
|
||||||
}
|
}
|
||||||
|
@ -330,7 +330,7 @@ void cBlockRecordFile::AssertValid() const
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
void cBlockRecordFile::AssertAllBlocksValid()
|
void cBlockRecordFile::AssertAllBlocksValid()
|
||||||
{
|
{
|
||||||
for( BlockArray::iterator i = mvBlocks.begin(); i != mvBlocks.end(); i++ )
|
for( BlockArray::iterator i = mvBlocks.begin(); i != mvBlocks.end(); ++i )
|
||||||
{
|
{
|
||||||
i->AssertValid();
|
i->AssertValid();
|
||||||
}
|
}
|
||||||
|
|
|
@ -405,7 +405,7 @@ bool cHierDatabaseIter::Done() const
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
void cHierDatabaseIter::Next()
|
void cHierDatabaseIter::Next()
|
||||||
{
|
{
|
||||||
mIter++;
|
++mIter;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -552,10 +552,10 @@ void cHierDatabaseIter::CreateEntry( const TSTRING& name ) //throw (eArchive, eH
|
||||||
{
|
{
|
||||||
// altering the previous node...
|
// altering the previous node...
|
||||||
//
|
//
|
||||||
mIter--;
|
--mIter;
|
||||||
mIter->mNext = newAddr;
|
mIter->mNext = newAddr;
|
||||||
util_RewriteObject( mpDb, &(*mIter), GetCurrentAddr() );
|
util_RewriteObject( mpDb, &(*mIter), GetCurrentAddr() );
|
||||||
mIter++;
|
++mIter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -672,10 +672,10 @@ void cHierDatabaseIter::DeleteEntry() //throw (eArchive, eHierDatabase)
|
||||||
{
|
{
|
||||||
// altering the previous node...
|
// altering the previous node...
|
||||||
//
|
//
|
||||||
mIter--;
|
--mIter;
|
||||||
mIter->mNext = (mIter+1)->mNext;
|
mIter->mNext = (mIter+1)->mNext;
|
||||||
util_RewriteObject( mpDb, &(*mIter), GetCurrentAddr() );
|
util_RewriteObject( mpDb, &(*mIter), GetCurrentAddr() );
|
||||||
mIter++;
|
++mIter;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// now, delete the node from the file and from our array...
|
// now, delete the node from the file and from our array...
|
||||||
|
@ -751,7 +751,7 @@ bool cHierDatabaseIter::CompareForUpperBound( const cHierEntry& he, const TCHAR*
|
||||||
class cHierDatabaseIterCallCompare
|
class cHierDatabaseIterCallCompare
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
cHierDatabaseIterCallCompare( const cHierDatabaseIter* pcls )
|
explicit cHierDatabaseIterCallCompare( const cHierDatabaseIter* pcls )
|
||||||
: pc( pcls ) {};
|
: pc( pcls ) {};
|
||||||
|
|
||||||
bool operator()( const cHierEntry& a1, const TCHAR* a2 )
|
bool operator()( const cHierEntry& a1, const TCHAR* a2 )
|
||||||
|
|
|
@ -114,7 +114,7 @@ private:
|
||||||
class cHierDatabaseIter
|
class cHierDatabaseIter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
cHierDatabaseIter( cHierDatabase* pDb ); //throw (eArchive)
|
explicit cHierDatabaseIter( cHierDatabase* pDb ); //throw (eArchive)
|
||||||
~cHierDatabaseIter();
|
~cHierDatabaseIter();
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -68,7 +68,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
cHierNode( Type type = TYPE_INVALID ) : mType( type ) {}
|
explicit cHierNode( Type type = TYPE_INVALID ) : mType( type ) {}
|
||||||
virtual ~cHierNode() {}
|
virtual ~cHierNode() {}
|
||||||
|
|
||||||
int32 mType;
|
int32 mType;
|
||||||
|
|
|
@ -53,7 +53,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
cFCOCompare();
|
cFCOCompare();
|
||||||
cFCOCompare( const cFCOPropVector& propsToCompare);
|
explicit cFCOCompare( const cFCOPropVector& propsToCompare);
|
||||||
virtual ~cFCOCompare();
|
virtual ~cFCOCompare();
|
||||||
|
|
||||||
void SetPropsToCmp(const cFCOPropVector& pv);
|
void SetPropsToCmp(const cFCOPropVector& pv);
|
||||||
|
|
|
@ -46,6 +46,8 @@ public:
|
||||||
enum { CHILDREN_NONE = 0,
|
enum { CHILDREN_NONE = 0,
|
||||||
CHILDREN_ALL = -1 };
|
CHILDREN_ALL = -1 };
|
||||||
|
|
||||||
|
virtual ~iFCODataSource() = 0;
|
||||||
|
|
||||||
// NOTE -- in the act of creating fcos, there are certain properties that we can obtain "for free" just
|
// NOTE -- in the act of creating fcos, there are certain properties that we can obtain "for free" just
|
||||||
// by the act of querying the system we are generating fcos for (for example, a stat() call is required
|
// by the act of querying the system we are generating fcos for (for example, a stat() call is required
|
||||||
// to create file system fcos, which also gives us many of the fsfco's property values). Therefore,
|
// to create file system fcos, which also gives us many of the fsfco's property values). Therefore,
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
//=========================================================================
|
//=========================================================================
|
||||||
|
|
||||||
cFCODataSourceIterImpl::cFCODataSourceIterImpl()
|
cFCODataSourceIterImpl::cFCODataSourceIterImpl()
|
||||||
: mFlags(0)
|
: mpErrorBucket(0), mParentName(), mFlags(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ cFCODataSourceIterImpl& cFCODataSourceIterImpl::operator=( const cFCODataSourceI
|
||||||
//
|
//
|
||||||
// we need to addref all of the fcos we just got...
|
// we need to addref all of the fcos we just got...
|
||||||
//
|
//
|
||||||
for( FCOList::const_iterator i = mPeers.begin(); i != mPeers.end(); i++ )
|
for( FCOList::const_iterator i = mPeers.begin(); i != mPeers.end(); ++i )
|
||||||
{
|
{
|
||||||
(*i)->AddRef();
|
(*i)->AddRef();
|
||||||
}
|
}
|
||||||
|
@ -191,7 +191,7 @@ bool cFCODataSourceIterImpl::Done() const
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
void cFCODataSourceIterImpl::Next()
|
void cFCODataSourceIterImpl::Next()
|
||||||
{
|
{
|
||||||
mCurPos++;
|
++mCurPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -265,7 +265,8 @@ void cFCODataSourceIterImpl::SeekToFCO(const cFCOName& name, bool bCreatePeers)
|
||||||
GeneratePeers();
|
GeneratePeers();
|
||||||
}
|
}
|
||||||
|
|
||||||
SeekToPeerByName( (*mCurPos)->GetName().GetShortName() );
|
if(mCurPos != mPeers.end() && *mCurPos)
|
||||||
|
SeekToPeerByName( (*mCurPos)->GetName().GetShortName() );
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -281,7 +282,7 @@ bool cFCODataSourceIterImpl::IsCaseSensitive() const
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
void cFCODataSourceIterImpl::ClearList()
|
void cFCODataSourceIterImpl::ClearList()
|
||||||
{
|
{
|
||||||
for( mCurPos = mPeers.begin(); mCurPos != mPeers.end(); mCurPos++ )
|
for( mCurPos = mPeers.begin(); mCurPos != mPeers.end(); ++mCurPos )
|
||||||
{
|
{
|
||||||
(*mCurPos)->Release();
|
(*mCurPos)->Release();
|
||||||
}
|
}
|
||||||
|
@ -315,7 +316,7 @@ void cFCODataSourceIterImpl::GeneratePeers()
|
||||||
//
|
//
|
||||||
std::vector<TSTRING>::iterator i;
|
std::vector<TSTRING>::iterator i;
|
||||||
cFCOName curName = mParentName;
|
cFCOName curName = mParentName;
|
||||||
for( i = vChildrenNames.begin(); i != vChildrenNames.end(); i++)
|
for( i = vChildrenNames.begin(); i != vChildrenNames.end(); ++i)
|
||||||
{
|
{
|
||||||
curName.Push( *i );
|
curName.Push( *i );
|
||||||
|
|
||||||
|
@ -368,7 +369,7 @@ void cFCODataSourceIterImpl::TraceContents(int dl) const
|
||||||
d.Trace( dl, "FCO Iterator; parent = %s\n", mParentName.AsString().c_str() );
|
d.Trace( dl, "FCO Iterator; parent = %s\n", mParentName.AsString().c_str() );
|
||||||
d.Trace( dl, "---- Peers ---- (current has a * by it)\n" );
|
d.Trace( dl, "---- Peers ---- (current has a * by it)\n" );
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
for( FCOList::const_iterator iter = mPeers.begin(); iter != mPeers.end(); iter++, cnt++ )
|
for( FCOList::const_iterator iter = mPeers.begin(); iter != mPeers.end(); ++iter, ++cnt )
|
||||||
{
|
{
|
||||||
d.Trace( dl, "[%d]%c\t:%s\n", cnt, iter == mCurPos ? _T('*') : _T(' '), (*iter)->GetName().AsString().c_str() );
|
d.Trace( dl, "[%d]%c\t:%s\n", cnt, iter == mCurPos ? _T('*') : _T(' '), (*iter)->GetName().AsString().c_str() );
|
||||||
}
|
}
|
||||||
|
@ -439,7 +440,7 @@ bool cFCODataSourceIterImpl::CompareForUpperBound( const iFCO* pFCO, const TCHAR
|
||||||
class cFCODataSourceIterImplCallCompare
|
class cFCODataSourceIterImplCallCompare
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
cFCODataSourceIterImplCallCompare( const cFCODataSourceIterImpl* pcls )
|
explicit cFCODataSourceIterImplCallCompare( const cFCODataSourceIterImpl* pcls )
|
||||||
: pc( pcls ) {};
|
: pc( pcls ) {};
|
||||||
|
|
||||||
bool operator()( const iFCO* a1, const TCHAR* a2 )
|
bool operator()( const iFCO* a1, const TCHAR* a2 )
|
||||||
|
|
|
@ -177,7 +177,7 @@ void cFCOName::SetNameInfo(iFCONameInfo* pNI)
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// operator=
|
// operator=
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
void cFCOName::operator = (const cFCOName& rhs)
|
cFCOName& cFCOName::operator = (const cFCOName& rhs)
|
||||||
{
|
{
|
||||||
mpPathName->Release();
|
mpPathName->Release();
|
||||||
// TODO -- I am sure this won't work (const-ness)
|
// TODO -- I am sure this won't work (const-ness)
|
||||||
|
@ -188,16 +188,19 @@ void cFCOName::operator = (const cFCOName& rhs)
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
mDebugStrName = AsString();
|
mDebugStrName = AsString();
|
||||||
#endif
|
#endif
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
void cFCOName::operator = (const TSTRING& rhs)
|
|
||||||
|
cFCOName& cFCOName::operator = (const TSTRING& rhs)
|
||||||
{
|
{
|
||||||
*this = rhs.c_str();
|
*this = rhs.c_str();
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
mDebugStrName = AsString();
|
mDebugStrName = AsString();
|
||||||
#endif
|
#endif
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cFCOName::operator = (const TCHAR* rhs)
|
cFCOName& cFCOName::operator = (const TCHAR* rhs)
|
||||||
{
|
{
|
||||||
// if I have the only handle on this vector, I can reuse it
|
// if I have the only handle on this vector, I can reuse it
|
||||||
// otherwise, I have to release it.
|
// otherwise, I have to release it.
|
||||||
|
@ -210,6 +213,7 @@ void cFCOName::operator = (const TCHAR* rhs)
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
mDebugStrName = AsString();
|
mDebugStrName = AsString();
|
||||||
#endif
|
#endif
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cFCOName::ParseString( const TCHAR* pszin )
|
void cFCOName::ParseString( const TCHAR* pszin )
|
||||||
|
@ -284,7 +288,7 @@ TSTRING cFCOName::AsString() const
|
||||||
TSTRING current = (*i)->GetString();
|
TSTRING current = (*i)->GetString();
|
||||||
// the loop is constructed in this odd fashion because I don't want a trailing mDelimiter
|
// the loop is constructed in this odd fashion because I don't want a trailing mDelimiter
|
||||||
str += current;
|
str += current;
|
||||||
i++;
|
++i;
|
||||||
|
|
||||||
if(i != mpPathName->mNames.end() && current != "/")
|
if(i != mpPathName->mNames.end() && current != "/")
|
||||||
str += mDelimiter;
|
str += mDelimiter;
|
||||||
|
@ -339,7 +343,7 @@ cFCOName::Relationship cFCOName::GetRelationship(const cFCOName& rhs) const
|
||||||
|
|
||||||
for(myIter = mpPathName->mNames.begin(), rhsIter = rhs.mpPathName->mNames.begin();
|
for(myIter = mpPathName->mNames.begin(), rhsIter = rhs.mpPathName->mNames.begin();
|
||||||
(myIter != mpPathName->mNames.end() && rhsIter != rhs.mpPathName->mNames.end());
|
(myIter != mpPathName->mNames.end() && rhsIter != rhs.mpPathName->mNames.end());
|
||||||
myIter++, rhsIter++)
|
++myIter, ++rhsIter)
|
||||||
{
|
{
|
||||||
if(bCaseSensitive)
|
if(bCaseSensitive)
|
||||||
bEqual = (*myIter == *rhsIter);
|
bEqual = (*myIter == *rhsIter);
|
||||||
|
@ -518,7 +522,7 @@ bool cFCOName::operator<(const cFCOName& rhs) const
|
||||||
|
|
||||||
for(myIter = mpPathName->mNames.begin(), rhsIter = rhs.mpPathName->mNames.begin();
|
for(myIter = mpPathName->mNames.begin(), rhsIter = rhs.mpPathName->mNames.begin();
|
||||||
(myIter != mpPathName->mNames.end() && rhsIter != rhs.mpPathName->mNames.end());
|
(myIter != mpPathName->mNames.end() && rhsIter != rhs.mpPathName->mNames.end());
|
||||||
myIter++, rhsIter++)
|
++myIter, ++rhsIter)
|
||||||
{
|
{
|
||||||
if(bCaseSensitive)
|
if(bCaseSensitive)
|
||||||
{
|
{
|
||||||
|
@ -589,7 +593,7 @@ void cFCONameIter::SeekBegin()
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
void cFCONameIter::Next()
|
void cFCONameIter::Next()
|
||||||
{
|
{
|
||||||
mIter++;
|
++mIter;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -615,7 +619,7 @@ const TCHAR* cFCONameIter::GetName() const
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
void cFCONameIter::Prev()
|
void cFCONameIter::Prev()
|
||||||
{
|
{
|
||||||
mIter--;
|
--mIter;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -58,7 +58,7 @@ class cFCOName : public iTypedSerializable
|
||||||
public:
|
public:
|
||||||
typedef cFCONameIter iterator;
|
typedef cFCONameIter iterator;
|
||||||
|
|
||||||
cFCOName(iFCONameInfo* iNI = NULL);
|
explicit cFCOName(iFCONameInfo* iNI = NULL);
|
||||||
cFCOName(const cFCOName& rhs);
|
cFCOName(const cFCOName& rhs);
|
||||||
|
|
||||||
explicit cFCOName(const TSTRING& rhs, iFCONameInfo* iNI = NULL);
|
explicit cFCOName(const TSTRING& rhs, iFCONameInfo* iNI = NULL);
|
||||||
|
@ -67,9 +67,9 @@ public:
|
||||||
// do it unexpectedly
|
// do it unexpectedly
|
||||||
virtual ~cFCOName();
|
virtual ~cFCOName();
|
||||||
|
|
||||||
void operator = (const cFCOName& rhs);
|
cFCOName& operator = (const cFCOName& rhs);
|
||||||
void operator = (const TSTRING& rhs);
|
cFCOName& operator = (const TSTRING& rhs);
|
||||||
void operator = (const TCHAR* rhs);
|
cFCOName& operator = (const TCHAR* rhs);
|
||||||
|
|
||||||
bool operator < (const cFCOName& rhs) const;
|
bool operator < (const cFCOName& rhs) const;
|
||||||
// defines an arbitrary order for cFCONames. This is so that names can
|
// defines an arbitrary order for cFCONames. This is so that names can
|
||||||
|
@ -165,7 +165,7 @@ class cFCONameIter_i;
|
||||||
class cFCONameIter
|
class cFCONameIter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
cFCONameIter(const cFCOName& name);
|
explicit cFCONameIter(const cFCOName& name);
|
||||||
~cFCONameIter();
|
~cFCONameIter();
|
||||||
|
|
||||||
int GetSize() const; // returns the number of entries in the fco name
|
int GetSize() const; // returns the number of entries in the fco name
|
||||||
|
|
|
@ -39,8 +39,6 @@
|
||||||
//#############################################################################
|
//#############################################################################
|
||||||
// cFCONameTblNode
|
// cFCONameTblNode
|
||||||
//#############################################################################
|
//#############################################################################
|
||||||
// uncomment this to allocate fconametblnodes from a pool.
|
|
||||||
//cObjectPoolBase cFCONameTblNode::msAllocator(sizeof(cFCONameTblNode), 1000);
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -112,8 +110,9 @@ void cFCONameTblNode::SetString(const TSTRING& newStr)
|
||||||
mpString = NULL;
|
mpString = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
mpString = (TCHAR*)util_AllocMem( sizeof(TCHAR)*(newStr.length()+1) );
|
size_t alloc_size = sizeof(TCHAR)*(newStr.length()+1);
|
||||||
_tcscpy( mpString, newStr.c_str() );
|
mpString = (TCHAR*)util_AllocMem(alloc_size);
|
||||||
|
strncpy( mpString, newStr.c_str(), alloc_size );
|
||||||
|
|
||||||
// NOTE -- the lower case pointer is now invalid.
|
// NOTE -- the lower case pointer is now invalid.
|
||||||
}
|
}
|
||||||
|
@ -188,7 +187,7 @@ cFCONameTblNode* cFCONameTbl::CreateNode(const TSTRING& nodeName)
|
||||||
// TODO:BAM -- does this have any meaning in mb?
|
// TODO:BAM -- does this have any meaning in mb?
|
||||||
for(i = lowStr.begin(); i != lowStr.end(); ++i)
|
for(i = lowStr.begin(); i != lowStr.end(); ++i)
|
||||||
{
|
{
|
||||||
*i = _totlower(*i);
|
*i = tolower(*i);
|
||||||
}
|
}
|
||||||
// see if this exists in the table (it could potentially look up itself!)
|
// see if this exists in the table (it could potentially look up itself!)
|
||||||
if(mTable.Lookup(lowStr.c_str(), pLowerNode))
|
if(mTable.Lookup(lowStr.c_str(), pLowerNode))
|
||||||
|
|
|
@ -46,15 +46,6 @@
|
||||||
#include "core/hashtable.h"
|
#include "core/hashtable.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// uncomment this to allocate fconametblnodes from a pool.
|
|
||||||
/*
|
|
||||||
#ifndef __OBJECTPOOL_H
|
|
||||||
#include "objectpool.h"
|
|
||||||
#endif
|
|
||||||
*/
|
|
||||||
// end TODO
|
|
||||||
|
|
||||||
|
|
||||||
class cFCONameTbl_i;
|
class cFCONameTbl_i;
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -119,7 +110,7 @@ private:
|
||||||
class cFCONameTbl
|
class cFCONameTbl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
cFCONameTbl(int defSize = HASH_VERY_LARGE);
|
explicit cFCONameTbl(int defSize = HASH_VERY_LARGE);
|
||||||
// defSize is the initial hash table size
|
// defSize is the initial hash table size
|
||||||
~cFCONameTbl();
|
~cFCONameTbl();
|
||||||
|
|
||||||
|
|
|
@ -394,7 +394,6 @@ void cFCOPropVector::Read(iSerializer* pSerializer, int32 version)
|
||||||
if (version > 0)
|
if (version > 0)
|
||||||
ThrowAndAssert(eSerializerVersionMismatch(_T("Property Vector Read")));
|
ThrowAndAssert(eSerializerVersionMismatch(_T("Property Vector Read")));
|
||||||
|
|
||||||
int i;
|
|
||||||
int32 newSize;
|
int32 newSize;
|
||||||
pSerializer->ReadInt32(newSize);
|
pSerializer->ReadInt32(newSize);
|
||||||
ASSERT(newSize > 0);
|
ASSERT(newSize > 0);
|
||||||
|
@ -409,7 +408,7 @@ void cFCOPropVector::Read(iSerializer* pSerializer, int32 version)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (i=0; i <= mSize / msBitlength; ++i)
|
for (int i=0; i <= mSize / msBitlength; ++i)
|
||||||
{
|
{
|
||||||
int32 mask;
|
int32 mask;
|
||||||
pSerializer->ReadInt32(mask);
|
pSerializer->ReadInt32(mask);
|
||||||
|
@ -421,7 +420,6 @@ void cFCOPropVector::Read(iSerializer* pSerializer, int32 version)
|
||||||
|
|
||||||
void cFCOPropVector::Write(iSerializer* pSerializer) const
|
void cFCOPropVector::Write(iSerializer* pSerializer) const
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
pSerializer->WriteInt32(mSize);
|
pSerializer->WriteInt32(mSize);
|
||||||
|
|
||||||
if (mpBuf == NULL)
|
if (mpBuf == NULL)
|
||||||
|
@ -430,7 +428,7 @@ void cFCOPropVector::Write(iSerializer* pSerializer) const
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (i=0; i <= mSize / msBitlength; ++i)
|
for (int i=0; i <= mSize / msBitlength; ++i)
|
||||||
pSerializer->WriteInt32((*mpBuf)[i]);
|
pSerializer->WriteInt32((*mpBuf)[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
class cFCOPropVector : public iSerializable // note: this is not iTypedSerializable
|
class cFCOPropVector : public iSerializable // note: this is not iTypedSerializable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
cFCOPropVector (int size = 32);
|
explicit cFCOPropVector (int size = 32);
|
||||||
cFCOPropVector (const cFCOPropVector& rhs);
|
cFCOPropVector (const cFCOPropVector& rhs);
|
||||||
virtual ~cFCOPropVector (void);
|
virtual ~cFCOPropVector (void);
|
||||||
bool operator== (const cFCOPropVector& rhs) const;
|
bool operator== (const cFCOPropVector& rhs) const;
|
||||||
|
|
|
@ -80,7 +80,7 @@ cFCOSetImpl::cFCOSetImpl(const cFCOSetImpl& rhs) : iFCOSet()
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// operator=
|
// operator=
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
void cFCOSetImpl::operator=(const cFCOSetImpl& rhs)
|
cFCOSetImpl& cFCOSetImpl::operator=(const cFCOSetImpl& rhs)
|
||||||
{
|
{
|
||||||
std::set<cFCONode>::const_iterator i;
|
std::set<cFCONode>::const_iterator i;
|
||||||
for(i = rhs.mFCOSet.begin(); i != rhs.mFCOSet.end(); ++i)
|
for(i = rhs.mFCOSet.begin(); i != rhs.mFCOSet.end(); ++i)
|
||||||
|
@ -88,6 +88,8 @@ void cFCOSetImpl::operator=(const cFCOSetImpl& rhs)
|
||||||
i->mpFCO->AddRef();
|
i->mpFCO->AddRef();
|
||||||
mFCOSet.insert(cFCONode(i->mpFCO));
|
mFCOSet.insert(cFCONode(i->mpFCO));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -202,7 +204,7 @@ void cFCOSetImpl::Write(iSerializer* pSerializer) const
|
||||||
pSerializer->WriteInt32(mFCOSet.size());
|
pSerializer->WriteInt32(mFCOSet.size());
|
||||||
|
|
||||||
std::set<cFCONode>::const_iterator itr;
|
std::set<cFCONode>::const_iterator itr;
|
||||||
for( itr = mFCOSet.begin(); itr != mFCOSet.end(); itr++)
|
for( itr = mFCOSet.begin(); itr != mFCOSet.end(); ++itr)
|
||||||
{
|
{
|
||||||
pSerializer->WriteObjectDynCreate(itr->mpFCO);
|
pSerializer->WriteObjectDynCreate(itr->mpFCO);
|
||||||
}
|
}
|
||||||
|
@ -284,7 +286,7 @@ bool cFCOIterImpl::IsEmpty() const
|
||||||
void cFCOIterImpl::Next() const
|
void cFCOIterImpl::Next() const
|
||||||
{
|
{
|
||||||
ASSERT(mpSet != 0);
|
ASSERT(mpSet != 0);
|
||||||
mIter++;
|
++mIter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ public:
|
||||||
cFCOSetImpl();
|
cFCOSetImpl();
|
||||||
cFCOSetImpl(const cFCOSetImpl& rhs);
|
cFCOSetImpl(const cFCOSetImpl& rhs);
|
||||||
virtual ~cFCOSetImpl();
|
virtual ~cFCOSetImpl();
|
||||||
void operator=(const cFCOSetImpl& rhs);
|
cFCOSetImpl& operator=(const cFCOSetImpl& rhs);
|
||||||
|
|
||||||
virtual const iFCOIter* Lookup(const cFCOName& name) const;
|
virtual const iFCOIter* Lookup(const cFCOName& name) const;
|
||||||
virtual iFCOIter* Lookup(const cFCOName& name);
|
virtual iFCOIter* Lookup(const cFCOName& name);
|
||||||
|
@ -85,8 +85,9 @@ private:
|
||||||
const cFCOName* mpFCOName;
|
const cFCOName* mpFCOName;
|
||||||
|
|
||||||
cFCONode() : mpFCO(0), mpFCOName(0) {}
|
cFCONode() : mpFCO(0), mpFCOName(0) {}
|
||||||
cFCONode(iFCO* pFCO) : mpFCO(pFCO), mpFCOName(&pFCO->GetName()) {}
|
//TODO: make the iFCO* constructor explicit
|
||||||
cFCONode(const cFCOName& name) : mpFCO(0), mpFCOName(&name) {}
|
cFCONode(iFCO* pFCO) : mpFCO(pFCO), mpFCOName(&pFCO->GetName()) {}
|
||||||
|
explicit cFCONode(const cFCOName& name) : mpFCO(0), mpFCOName(&name) {}
|
||||||
cFCONode(const cFCONode& rhs) : mpFCO(rhs.mpFCO), mpFCOName(rhs.mpFCOName) {}
|
cFCONode(const cFCONode& rhs) : mpFCO(rhs.mpFCO), mpFCOName(rhs.mpFCOName) {}
|
||||||
bool operator < (const cFCONode& rhs) const { if(mpFCOName) return (*mpFCOName < *rhs.mpFCOName); else return false; }
|
bool operator < (const cFCONode& rhs) const { if(mpFCOName) return (*mpFCOName < *rhs.mpFCOName); else return false; }
|
||||||
bool operator ==(const cFCONode& rhs) const { if(mpFCOName) return (*mpFCOName == *rhs.mpFCOName); else return false; }
|
bool operator ==(const cFCONode& rhs) const { if(mpFCOName) return (*mpFCOName == *rhs.mpFCOName); else return false; }
|
||||||
|
@ -101,8 +102,8 @@ class cFCOIterImpl : public iFCOIter
|
||||||
friend class cFCOSetImpl;
|
friend class cFCOSetImpl;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
cFCOIterImpl(cFCOSetImpl* pSet);
|
explicit cFCOIterImpl(cFCOSetImpl* pSet);
|
||||||
cFCOIterImpl(const cFCOSetImpl* pSet);
|
explicit cFCOIterImpl(const cFCOSetImpl* pSet);
|
||||||
|
|
||||||
virtual void SeekBegin() const;
|
virtual void SeekBegin() const;
|
||||||
virtual bool Done() const;
|
virtual bool Done() const;
|
||||||
|
|
|
@ -94,7 +94,7 @@ private:
|
||||||
class cFCOSpecAttrEmailIter
|
class cFCOSpecAttrEmailIter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
cFCOSpecAttrEmailIter(const cFCOSpecAttr& attr);
|
explicit cFCOSpecAttrEmailIter(const cFCOSpecAttr& attr);
|
||||||
~cFCOSpecAttrEmailIter();
|
~cFCOSpecAttrEmailIter();
|
||||||
|
|
||||||
void SeekBegin() const;
|
void SeekBegin() const;
|
||||||
|
@ -171,7 +171,7 @@ inline bool cFCOSpecAttrEmailIter::IsEmpty() const
|
||||||
}
|
}
|
||||||
inline void cFCOSpecAttrEmailIter::Next() const
|
inline void cFCOSpecAttrEmailIter::Next() const
|
||||||
{
|
{
|
||||||
mIter++;
|
++mIter;
|
||||||
}
|
}
|
||||||
inline const TSTRING& cFCOSpecAttrEmailIter::EmailAddress() const
|
inline const TSTRING& cFCOSpecAttrEmailIter::EmailAddress() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -221,7 +221,7 @@ void cFCOSpecStopPointSet::Add(const cFCOName& name)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
i++;
|
++i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,7 +306,7 @@ iFCOSpecHelper::CompareResult cFCOSpecStopPointSet::Compare(const iFCOSpecHelper
|
||||||
|
|
||||||
std::set<cFCOName>::const_iterator myIter = mStopPoints.begin(),
|
std::set<cFCOName>::const_iterator myIter = mStopPoints.begin(),
|
||||||
rhsIter = pStopPtSet->mStopPoints.begin();
|
rhsIter = pStopPtSet->mStopPoints.begin();
|
||||||
for(; myIter != mStopPoints.end(); myIter++, rhsIter++)
|
for(; myIter != mStopPoints.end(); ++myIter, ++rhsIter)
|
||||||
{
|
{
|
||||||
if(*myIter != *rhsIter)
|
if(*myIter != *rhsIter)
|
||||||
return ((*myIter < *rhsIter) ? CMP_LT : CMP_GT);
|
return ((*myIter < *rhsIter) ? CMP_LT : CMP_GT);
|
||||||
|
|
|
@ -159,7 +159,7 @@ protected:
|
||||||
class cFCOSpecStopPointIter
|
class cFCOSpecStopPointIter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
cFCOSpecStopPointIter(cFCOSpecStopPointSet& set);
|
explicit cFCOSpecStopPointIter(cFCOSpecStopPointSet& set);
|
||||||
|
|
||||||
void SeekBegin() const;
|
void SeekBegin() const;
|
||||||
// seeks to the beginning of the stop point list
|
// seeks to the beginning of the stop point list
|
||||||
|
@ -257,7 +257,7 @@ inline bool cFCOSpecStopPointIter::IsEmpty() const
|
||||||
|
|
||||||
inline void cFCOSpecStopPointIter::Next() const
|
inline void cFCOSpecStopPointIter::Next() const
|
||||||
{
|
{
|
||||||
mIter++;
|
++mIter;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void cFCOSpecStopPointIter::Remove()
|
inline void cFCOSpecStopPointIter::Remove()
|
||||||
|
|
|
@ -100,11 +100,13 @@ IMPLEMENT_SERREFCOUNT(cFCOSpecImpl, _T("cFCOSpecImpl"), 0, 1);
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// operator=
|
// operator=
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
void cFCOSpecImpl::operator=(const cFCOSpecImpl& rhs)
|
cFCOSpecImpl& cFCOSpecImpl::operator=(const cFCOSpecImpl& rhs)
|
||||||
{
|
{
|
||||||
mName = rhs.mName;
|
mName = rhs.mName;
|
||||||
mPropVector = rhs.mPropVector;
|
mPropVector = rhs.mPropVector;
|
||||||
mpHelper = rhs.mpHelper ? rhs.mpHelper->Clone() : 0;
|
mpHelper = rhs.mpHelper ? rhs.mpHelper->Clone() : 0;
|
||||||
|
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Clone -- make a copy of this spec
|
// Clone -- make a copy of this spec
|
||||||
|
|
|
@ -70,7 +70,7 @@ public:
|
||||||
// the spec will delete whatever helper it contains when it is destroyed
|
// the spec will delete whatever helper it contains when it is destroyed
|
||||||
cFCOSpecImpl(const cFCOSpecImpl& rhs);
|
cFCOSpecImpl(const cFCOSpecImpl& rhs);
|
||||||
cFCOSpecImpl();
|
cFCOSpecImpl();
|
||||||
void operator=(const cFCOSpecImpl& rhs);
|
cFCOSpecImpl& operator=(const cFCOSpecImpl& rhs);
|
||||||
|
|
||||||
// from iFCOSpec
|
// from iFCOSpec
|
||||||
virtual bool SpecContainsFCO (const cFCOName& name) const;
|
virtual bool SpecContainsFCO (const cFCOName& name) const;
|
||||||
|
|
|
@ -61,7 +61,7 @@ void cFCOSpecList::Clear()
|
||||||
{
|
{
|
||||||
std::list<PairType>::iterator itr;
|
std::list<PairType>::iterator itr;
|
||||||
|
|
||||||
for (itr = mAddedList.begin(); itr != mAddedList.end(); itr++)
|
for (itr = mAddedList.begin(); itr != mAddedList.end(); ++itr)
|
||||||
{
|
{
|
||||||
itr->first->Release();
|
itr->first->Release();
|
||||||
itr->second->Release();
|
itr->second->Release();
|
||||||
|
@ -227,7 +227,7 @@ void cFCOSpecListAddedIter::Remove()
|
||||||
|
|
||||||
// the tricky part is finding the spec in the other list...
|
// the tricky part is finding the spec in the other list...
|
||||||
std::list<cFCOSpecList::PairType>::iterator i;
|
std::list<cFCOSpecList::PairType>::iterator i;
|
||||||
for(i = mpSpecList->mCanonicalList.begin(); i != mpSpecList->mCanonicalList.end(); i++)
|
for(i = mpSpecList->mCanonicalList.begin(); i != mpSpecList->mCanonicalList.end(); ++i)
|
||||||
{
|
{
|
||||||
if(i->first == mIter->first)
|
if(i->first == mIter->first)
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -103,7 +103,7 @@ protected:
|
||||||
class cFCOSpecListAddedIter
|
class cFCOSpecListAddedIter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
cFCOSpecListAddedIter(const cFCOSpecList& list);
|
explicit cFCOSpecListAddedIter(const cFCOSpecList& list);
|
||||||
~cFCOSpecListAddedIter();
|
~cFCOSpecListAddedIter();
|
||||||
|
|
||||||
void SeekBegin() const;
|
void SeekBegin() const;
|
||||||
|
@ -129,7 +129,7 @@ protected:
|
||||||
class cFCOSpecListCanonicalIter
|
class cFCOSpecListCanonicalIter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
cFCOSpecListCanonicalIter(const cFCOSpecList& list);
|
explicit cFCOSpecListCanonicalIter(const cFCOSpecList& list);
|
||||||
~cFCOSpecListCanonicalIter();
|
~cFCOSpecListCanonicalIter();
|
||||||
|
|
||||||
void SeekBegin() const;
|
void SeekBegin() const;
|
||||||
|
|
|
@ -99,14 +99,12 @@ cGenre::Genre cGenreSwitcher::GetDefaultGenre()
|
||||||
void cGenreSwitcher::RegisterGenre( const cGenreInfo* pGI, RegisterFlags flags /* = REGISTER_FLAGS_NONE */ )
|
void cGenreSwitcher::RegisterGenre( const cGenreInfo* pGI, RegisterFlags flags /* = REGISTER_FLAGS_NONE */ )
|
||||||
{
|
{
|
||||||
cDebug d("cGenreSwitcher::RegisterGenre");
|
cDebug d("cGenreSwitcher::RegisterGenre");
|
||||||
d.TraceDebug( _T("ID: %x, long name: %s, short name: %s\n"), pGI->m_ID, pGI->m_sLongName.c_str(), pGI->m_sShortName.c_str() );
|
|
||||||
|
|
||||||
//
|
|
||||||
// validate params
|
|
||||||
//
|
|
||||||
ASSERT( NULL != pGI );
|
ASSERT( NULL != pGI );
|
||||||
ASSERT( pGI->IsValid() );
|
ASSERT( pGI->IsValid() );
|
||||||
|
|
||||||
|
d.TraceDebug( _T("ID: %x, long name: %s, short name: %s\n"), pGI->m_ID, pGI->m_sLongName.c_str(), pGI->m_sShortName.c_str() );
|
||||||
|
|
||||||
//
|
//
|
||||||
// can only be one of each genre ID
|
// can only be one of each genre ID
|
||||||
//
|
//
|
||||||
|
@ -145,12 +143,7 @@ bool cGenreSwitcher::IsGenreRegistered( cGenre::Genre g )
|
||||||
|
|
||||||
bool cGenreSwitcher::IsGenreAppropriate( cGenre::Genre g )
|
bool cGenreSwitcher::IsGenreAppropriate( cGenre::Genre g )
|
||||||
{
|
{
|
||||||
#if IS_UNIX
|
const uint32 platformMask = cGenre::PLATFORM_MASK_UNIX;
|
||||||
const uint32 platformMask = cGenre::PLATFORM_MASK_UNIX;
|
|
||||||
#else
|
|
||||||
#error who am I?
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return( ( platformMask & g ) != 0 );
|
return( ( platformMask & g ) != 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,7 +223,7 @@ cGenre::Genre cGenreSwitcher::StringToGenre( const wchar_t* wsz )
|
||||||
cGenreInfoVec::const_iterator cGenreInfoVec::find( cGenre::Genre g ) const
|
cGenreInfoVec::const_iterator cGenreInfoVec::find( cGenre::Genre g ) const
|
||||||
{
|
{
|
||||||
const_iterator i;
|
const_iterator i;
|
||||||
for( i = begin(); i != end(); i++ )
|
for( i = begin(); i != end(); ++i )
|
||||||
{
|
{
|
||||||
ASSERT( (*i)->m_ID != cGenre::GENRE_INVALID );
|
ASSERT( (*i)->m_ID != cGenre::GENRE_INVALID );
|
||||||
|
|
||||||
|
@ -251,7 +244,7 @@ cGenreInfoVec::const_iterator cGenreInfoVec::find( const cGenreInfo* pGI ) const
|
||||||
cGenreInfoVec::const_iterator cGenreInfoVec::find( const TSTRING& sGenre ) const
|
cGenreInfoVec::const_iterator cGenreInfoVec::find( const TSTRING& sGenre ) const
|
||||||
{
|
{
|
||||||
const_iterator i;
|
const_iterator i;
|
||||||
for( i = begin(); i != end(); i++ )
|
for( i = begin(); i != end(); ++i )
|
||||||
{
|
{
|
||||||
ASSERT( (*i)->m_ID != cGenre::GENRE_INVALID );
|
ASSERT( (*i)->m_ID != cGenre::GENRE_INVALID );
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,7 @@ template<class TYPE>
|
||||||
class cIterProxy
|
class cIterProxy
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
//TODO: Can these 2 constructors be made explicit?
|
||||||
cIterProxy(TYPE* pIter = NULL) : mpIter(pIter) {};
|
cIterProxy(TYPE* pIter = NULL) : mpIter(pIter) {};
|
||||||
cIterProxy(const TYPE* pIter) : mpIter((TYPE*)pIter) {};
|
cIterProxy(const TYPE* pIter) : mpIter((TYPE*)pIter) {};
|
||||||
~cIterProxy() { if (mpIter) mpIter->DestroyIter(); }
|
~cIterProxy() { if (mpIter) mpIter->DestroyIter(); }
|
||||||
|
|
|
@ -550,14 +550,14 @@ TSTRING cMD5Signature::AsStringHex() const
|
||||||
TSTRING ret;
|
TSTRING ret;
|
||||||
|
|
||||||
TCHAR stringBuffer[128];
|
TCHAR stringBuffer[128];
|
||||||
TCHAR sigStringOut[128];
|
TCHAR sigStringOut[129];
|
||||||
sigStringOut[0] = '\0';
|
sigStringOut[0] = '\0';
|
||||||
uint8 *dbuf = (uint8 *)md5_digest;
|
uint8 *dbuf = (uint8 *)md5_digest;
|
||||||
|
|
||||||
for(int i = 0; i < SIG_BYTE_SIZE; ++i)
|
for(int i = 0; i < SIG_BYTE_SIZE; ++i)
|
||||||
{
|
{
|
||||||
_stprintf(stringBuffer, _T("%02lx"), (unsigned long)dbuf[i]);
|
snprintf(stringBuffer, 128, _T("%02lx"), (unsigned long)dbuf[i]);
|
||||||
_tcscat(sigStringOut, stringBuffer);
|
strncat(sigStringOut, stringBuffer, 128);
|
||||||
}
|
}
|
||||||
ret.append(sigStringOut);
|
ret.append(sigStringOut);
|
||||||
|
|
||||||
|
@ -673,14 +673,14 @@ TSTRING cSHASignature::AsStringHex() const
|
||||||
TSTRING ret;
|
TSTRING ret;
|
||||||
|
|
||||||
TCHAR stringBuffer[128];
|
TCHAR stringBuffer[128];
|
||||||
TCHAR sigStringOut[128];
|
TCHAR sigStringOut[129];
|
||||||
sigStringOut[0] = '\0';
|
sigStringOut[0] = '\0';
|
||||||
uint8 *dbuf = (uint8 *)sha_digest;
|
uint8 *dbuf = (uint8 *)sha_digest;
|
||||||
|
|
||||||
for (int i=0; i < SIG_UINT32_SIZE*(int)sizeof(uint32); ++i)
|
for (int i=0; i < SIG_UINT32_SIZE*(int)sizeof(uint32); ++i)
|
||||||
{
|
{
|
||||||
_stprintf(stringBuffer, _T("%02x"), dbuf[i]);
|
snprintf(stringBuffer, 128, _T("%02x"), dbuf[i]);
|
||||||
_tcscat(sigStringOut, stringBuffer);
|
strncat(sigStringOut, stringBuffer, 128);
|
||||||
}
|
}
|
||||||
ret.append(sigStringOut);
|
ret.append(sigStringOut);
|
||||||
|
|
||||||
|
@ -749,13 +749,13 @@ TSTRING cSHASignature::AsStringHex() const
|
||||||
TSTRING ret;
|
TSTRING ret;
|
||||||
|
|
||||||
TCHAR stringBuffer[128];
|
TCHAR stringBuffer[128];
|
||||||
TCHAR sigStringOut[128];
|
TCHAR sigStringOut[129];
|
||||||
sigStringOut[0] = '\0';
|
sigStringOut[0] = '\0';
|
||||||
|
|
||||||
for (int i=0; i < SIG_UINT32_SIZE; ++i)
|
for (int i=0; i < SIG_UINT32_SIZE; ++i)
|
||||||
{
|
{
|
||||||
_stprintf(stringBuffer, _T("%08x"), mSHAInfo.digest[i]);
|
snprintf(stringBuffer, 128, _T("%08x"), mSHAInfo.digest[i]);
|
||||||
_tcscat(sigStringOut, stringBuffer);
|
strncat(sigStringOut, stringBuffer, 128);
|
||||||
}
|
}
|
||||||
ret.append(sigStringOut);
|
ret.append(sigStringOut);
|
||||||
|
|
||||||
|
@ -851,13 +851,13 @@ TSTRING cHAVALSignature::AsStringHex() const
|
||||||
TSTRING ret;
|
TSTRING ret;
|
||||||
|
|
||||||
TCHAR stringBuffer[128];
|
TCHAR stringBuffer[128];
|
||||||
TCHAR sigStringOut[128];
|
TCHAR sigStringOut[129];
|
||||||
sigStringOut[0] = _T('\0');
|
sigStringOut[0] = _T('\0');
|
||||||
|
|
||||||
for (int i=0; i < SIG_BYTE_SIZE; ++i)
|
for (int i=0; i < SIG_BYTE_SIZE; ++i)
|
||||||
{
|
{
|
||||||
_stprintf(stringBuffer, _T("%02x"), mSignature[i]);
|
snprintf(stringBuffer, 128, _T("%02x"), mSignature[i]);
|
||||||
_tcscat(sigStringOut, stringBuffer);
|
strncat(sigStringOut, stringBuffer, 128);
|
||||||
}
|
}
|
||||||
ret.append(sigStringOut);
|
ret.append(sigStringOut);
|
||||||
|
|
||||||
|
|
|
@ -41,9 +41,6 @@
|
||||||
#include "core/error.h"
|
#include "core/error.h"
|
||||||
#include "core/errorutil.h"
|
#include "core/errorutil.h"
|
||||||
|
|
||||||
//uncomment to allocate fsobjects from a pool
|
|
||||||
//cObjectPoolBase cFSObject::msAllocator(sizeof(cFSObject), 1000);
|
|
||||||
|
|
||||||
// FCO Type information...
|
// FCO Type information...
|
||||||
IMPLEMENT_SERREFCOUNT(cFSObject, _T("FSObject"), 0, 1)
|
IMPLEMENT_SERREFCOUNT(cFSObject, _T("FSObject"), 0, 1)
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ class cFSObject : public iFCO
|
||||||
DECLARE_SERREFCOUNT()
|
DECLARE_SERREFCOUNT()
|
||||||
|
|
||||||
public:
|
public:
|
||||||
cFSObject(const cFCOName& name);
|
explicit cFSObject(const cFCOName& name);
|
||||||
|
|
||||||
virtual void SetName(const cFCOName& name) ;
|
virtual void SetName(const cFCOName& name) ;
|
||||||
virtual const cFCOName& GetName() const ;
|
virtual const cFCOName& GetName() const ;
|
||||||
|
|
|
@ -131,16 +131,27 @@ void cFSParserUtil::AddSubTypeProps( cFCOPropVector& v ) const
|
||||||
v.AddItemAndGrow( cFSPropSet::PROP_FILETYPE );
|
v.AddItemAndGrow( cFSPropSet::PROP_FILETYPE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void trim_leading_whitespace(std::string &str)
|
||||||
|
{
|
||||||
|
str.erase(str.begin(), std::find_if(str.begin(), str.end(), std::not1(std::ptr_fun<int, int>(std::isspace))));
|
||||||
|
}
|
||||||
|
|
||||||
void cFSParserUtil::InterpretFCOName( const std::list<TSTRING>& l, cFCOName& nameOut ) const
|
void cFSParserUtil::InterpretFCOName( const std::list<TSTRING>& l, cFCOName& nameOut ) const
|
||||||
{
|
{
|
||||||
TSTRING strT;
|
TSTRING strT;
|
||||||
for( std::list<TSTRING>::const_iterator i = l.begin(); i != l.end(); i++ )
|
for( std::list<TSTRING>::const_iterator i = l.begin(); i != l.end(); ++i )
|
||||||
strT += *i;
|
strT += *i;
|
||||||
|
|
||||||
#if USES_DEVICE_PATH
|
#if USES_DEVICE_PATH
|
||||||
strT = cDevicePath::AsPosix(strT);
|
strT = cDevicePath::AsPosix(strT);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//Trim any remaining whitespace before actual path, for cases like " /foo",
|
||||||
|
// otherwise it'll be flagged as a relative path.
|
||||||
|
//Don't trim trailing whitespace, since that could potentially be a valid path.
|
||||||
|
if(strT[0] != '/')
|
||||||
|
trim_leading_whitespace(strT);
|
||||||
|
|
||||||
// let cFCOName handle interpretation
|
// let cFCOName handle interpretation
|
||||||
nameOut = strT;
|
nameOut = strT;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,10 +45,7 @@
|
||||||
#include "fspropcalc.h"
|
#include "fspropcalc.h"
|
||||||
#include "fsobject.h"
|
#include "fsobject.h"
|
||||||
|
|
||||||
|
|
||||||
#if IS_UNIX
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
cFSPropCalc::cFSPropCalc() :
|
cFSPropCalc::cFSPropCalc() :
|
||||||
|
@ -93,11 +90,6 @@ static bool NeedsStat(const cFCOPropVector& v)
|
||||||
|
|
||||||
static bool GetSymLinkStr(const cFCOName& fileName, cArchive& arch)
|
static bool GetSymLinkStr(const cFCOName& fileName, cArchive& arch)
|
||||||
{
|
{
|
||||||
#if !IS_WIN32
|
|
||||||
#ifdef _UNICODE
|
|
||||||
#error GetSymLinkStr in fspropcalc.cpp is not unicode compliant
|
|
||||||
#else // ifdef _UNICODE
|
|
||||||
|
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
#if defined(O_PATH)
|
#if defined(O_PATH)
|
||||||
int fd = open(iTWFactory::GetInstance()->GetNameTranslator()->ToStringAPI( fileName ).c_str(),
|
int fd = open(iTWFactory::GetInstance()->GetNameTranslator()->ToStringAPI( fileName ).c_str(),
|
||||||
|
@ -116,11 +108,6 @@ static bool GetSymLinkStr(const cFCOName& fileName, cArchive& arch)
|
||||||
arch.WriteBlob(buf, rtn);
|
arch.WriteBlob(buf, rtn);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
#endif // ifdef _UNICODE
|
|
||||||
#else // if !IS_WIN32
|
|
||||||
return false; // TODO: find better way to do this -- just a place holder
|
|
||||||
#endif // if !IS_WIN32
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -151,7 +151,7 @@ void cFSPropDisplayer::Merge( const iFCOPropDisplayer* const ppd )
|
||||||
// merge mapping info
|
// merge mapping info
|
||||||
for( INT64_TO_STRING_MAP::const_iterator iterUID = pfspd->uidToUsername.begin();
|
for( INT64_TO_STRING_MAP::const_iterator iterUID = pfspd->uidToUsername.begin();
|
||||||
iterUID != pfspd->uidToUsername.end();
|
iterUID != pfspd->uidToUsername.end();
|
||||||
iterUID++
|
++iterUID
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
AddUsernameMapping( iterUID->first, iterUID->second );
|
AddUsernameMapping( iterUID->first, iterUID->second );
|
||||||
|
@ -159,7 +159,7 @@ void cFSPropDisplayer::Merge( const iFCOPropDisplayer* const ppd )
|
||||||
|
|
||||||
for( INT64_TO_STRING_MAP::const_iterator iterGID = pfspd->gidToGroupname.begin();
|
for( INT64_TO_STRING_MAP::const_iterator iterGID = pfspd->gidToGroupname.begin();
|
||||||
iterGID != pfspd->gidToGroupname.end();
|
iterGID != pfspd->gidToGroupname.end();
|
||||||
iterGID++
|
++iterGID
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
AddGroupnameMapping( iterGID->first, iterGID->second );
|
AddGroupnameMapping( iterGID->first, iterGID->second );
|
||||||
|
@ -401,7 +401,7 @@ void cFSPropDisplayer::Write( iSerializer* pSerializer ) const
|
||||||
{
|
{
|
||||||
// write UID mapping
|
// write UID mapping
|
||||||
pSerializer->WriteInt32( uidToUsername.size() );
|
pSerializer->WriteInt32( uidToUsername.size() );
|
||||||
for( INT64_TO_STRING_MAP::const_iterator iterUid = uidToUsername.begin(); iterUid != uidToUsername.end(); iterUid++ )
|
for( INT64_TO_STRING_MAP::const_iterator iterUid = uidToUsername.begin(); iterUid != uidToUsername.end(); ++iterUid )
|
||||||
{
|
{
|
||||||
pSerializer->WriteInt64( iterUid->first );
|
pSerializer->WriteInt64( iterUid->first );
|
||||||
pSerializer->WriteString( iterUid->second );
|
pSerializer->WriteString( iterUid->second );
|
||||||
|
@ -409,7 +409,7 @@ void cFSPropDisplayer::Write( iSerializer* pSerializer ) const
|
||||||
|
|
||||||
// write GID mapping
|
// write GID mapping
|
||||||
pSerializer->WriteInt32( gidToGroupname.size() );
|
pSerializer->WriteInt32( gidToGroupname.size() );
|
||||||
for( INT64_TO_STRING_MAP::const_iterator iterGid = gidToGroupname.begin(); iterGid != gidToGroupname.end(); iterGid++ )
|
for( INT64_TO_STRING_MAP::const_iterator iterGid = gidToGroupname.begin(); iterGid != gidToGroupname.end(); ++iterGid )
|
||||||
{
|
{
|
||||||
pSerializer->WriteInt64( iterGid->first );
|
pSerializer->WriteInt64( iterGid->first );
|
||||||
pSerializer->WriteString( iterGid->second );
|
pSerializer->WriteString( iterGid->second );
|
||||||
|
|
|
@ -2,16 +2,16 @@
|
||||||
# parser will echo YES1 through YES9
|
# parser will echo YES1 through YES9
|
||||||
# there's a problem with the parser if it echoes NO
|
# there's a problem with the parser if it echoes NO
|
||||||
|
|
||||||
@@ifhost turd
|
@@ifhost foo
|
||||||
@@error NO1
|
@@error NO1
|
||||||
@@else
|
@@else
|
||||||
@@echo +YES1;
|
@@print +YES1
|
||||||
@@endif
|
@@endif
|
||||||
|
|
||||||
@@ifhost crap || your_host||poo
|
@@ifhost bar || your_host||baz
|
||||||
|
|
||||||
|
|
||||||
@@ifhost turd
|
@@ifhost foo
|
||||||
|
|
||||||
@@ifhost your_host
|
@@ifhost your_host
|
||||||
@@error +NO2;
|
@@error +NO2;
|
||||||
|
@ -23,13 +23,13 @@
|
||||||
|
|
||||||
@@else
|
@@else
|
||||||
|
|
||||||
@@ifhost turd
|
@@ifhost foo
|
||||||
@@error +NO5;
|
@@error +NO5;
|
||||||
@@else
|
@@else
|
||||||
@@echo +YES2;
|
@@print +YES2;
|
||||||
@@endif
|
@@endif
|
||||||
|
|
||||||
@@echo +YES3;
|
@@print +YES3;
|
||||||
|
|
||||||
@@endif
|
@@endif
|
||||||
|
|
||||||
|
@ -38,12 +38,12 @@
|
||||||
@@ifhost your_host
|
@@ifhost your_host
|
||||||
|
|
||||||
@@ifhost your_host
|
@@ifhost your_host
|
||||||
@@echo +YES4;
|
@@print +YES4;
|
||||||
@@else
|
@@else
|
||||||
@@error +NO6;
|
@@error +NO6;
|
||||||
@@endif
|
@@endif
|
||||||
|
|
||||||
@@echo +YES5;
|
@@print +YES5;
|
||||||
|
|
||||||
@@else
|
@@else
|
||||||
|
|
||||||
|
@ -58,34 +58,34 @@
|
||||||
@@endif
|
@@endif
|
||||||
|
|
||||||
@@ifhost your_host
|
@@ifhost your_host
|
||||||
@@echo +YES6;
|
@@print +YES6;
|
||||||
@@else
|
@@else
|
||||||
@@error +NO10;
|
@@error +NO10;
|
||||||
@@endif
|
@@endif
|
||||||
|
|
||||||
@@ifhost turd
|
@@ifhost foo
|
||||||
@@error +NO11;
|
@@error +NO11;
|
||||||
@@else
|
@@else
|
||||||
@@echo +YES7;
|
@@print +YES7;
|
||||||
@@endif
|
@@endif
|
||||||
|
|
||||||
|
|
||||||
@@ifhost your_host || poo
|
@@ifhost your_host || baz
|
||||||
@@echo +YES8;
|
@@print +YES8;
|
||||||
@@endif
|
@@endif
|
||||||
|
|
||||||
@@ifhost poo || your_host
|
@@ifhost baz || your_host
|
||||||
@@echo +YES9;
|
@@print +YES9;
|
||||||
@@endif
|
@@endif
|
||||||
|
|
||||||
@@ifhost poo
|
@@ifhost baz
|
||||||
@@error +NO12;
|
@@error +NO12;
|
||||||
@@endif
|
@@endif
|
||||||
|
|
||||||
@@else
|
@@else
|
||||||
|
|
||||||
|
|
||||||
@@ifhost turd
|
@@ifhost foo
|
||||||
|
|
||||||
@@ifhost your_host
|
@@ifhost your_host
|
||||||
@@error +NO13;
|
@@error +NO13;
|
||||||
|
@ -97,7 +97,7 @@
|
||||||
|
|
||||||
@@else
|
@@else
|
||||||
|
|
||||||
@@ifhost turd
|
@@ifhost foo
|
||||||
@@error +NO16;
|
@@error +NO16;
|
||||||
@@else
|
@@else
|
||||||
@@error +NO17;
|
@@error +NO17;
|
||||||
|
@ -107,7 +107,7 @@
|
||||||
|
|
||||||
@@endif
|
@@endif
|
||||||
|
|
||||||
@@ifhost turd
|
@@ifhost foo
|
||||||
@@error +NO19;
|
@@error +NO19;
|
||||||
@@else
|
@@else
|
||||||
@@error +NO20;
|
@@error +NO20;
|
||||||
|
@ -120,16 +120,18 @@
|
||||||
@@endif
|
@@endif
|
||||||
|
|
||||||
|
|
||||||
@@ifhost turd
|
@@ifhost foo
|
||||||
@@error +NO23;
|
@@error +NO23;
|
||||||
@@else
|
@@else
|
||||||
@@error +NO24;
|
@@error +NO24;
|
||||||
@@endif
|
@@endif
|
||||||
|
|
||||||
@@ifhost poo
|
@@ifhost baz
|
||||||
@@error +NO25;
|
@@error +NO25;
|
||||||
@@endif
|
@@endif
|
||||||
|
|
||||||
@@endif
|
@@endif
|
||||||
|
|
||||||
|
#A token rule at the end to avoid 'no rules in policy file' errors
|
||||||
|
/asdf -> +a;
|
||||||
|
|
||||||
|
|
|
@ -14,34 +14,32 @@
|
||||||
/simple -> +ppp;
|
/simple -> +ppp;
|
||||||
|
|
||||||
# variable
|
# variable
|
||||||
$(poo) = pinug;
|
FOO = pinug;
|
||||||
/simplevar -> $(poo) ;
|
/simplevar -> $(FOO) ;
|
||||||
|
|
||||||
$(turd) = /test6;
|
BAR = /test6;
|
||||||
$(turd) -> $(poo);
|
$(BAR) -> $(FOO);
|
||||||
|
|
||||||
# named attributes
|
# named attributes
|
||||||
/namedattr -> +pinug (name /namedattr ) ;
|
#/namedattr -> +pinug (name /namedattr ) ;
|
||||||
|
|
||||||
# multiple attributes
|
# multiple attributes
|
||||||
/namedattr2 -> +pinug (emailreport on, emailsendto genek, name /namedattr2, name4 val4, name5 val5 );
|
#/namedattr2 -> +pinug (emailreport on, emailsendto genek, name /namedattr2, name4 val4, name5 val5 );
|
||||||
|
|
||||||
# test line continuations
|
# test line continuations
|
||||||
/turd \
|
/bar \
|
||||||
->\
|
->\
|
||||||
+p
|
+p
|
||||||
;
|
;
|
||||||
@@EnD
|
#@@EnD
|
||||||
|
|
||||||
/test -> +p;
|
/test7 -> +p;
|
||||||
"/te\x73t2" -> +p-p ;
|
"/te\x73t8" -> +p-p ;
|
||||||
"/te\163t3" -> +pinugs-am ;
|
"/te\163t9" -> +pinugs-am ;
|
||||||
"c:\\te\163t3\\" -> +pinugs-am ;
|
"/te\163t12" -> +pinugs-am ;
|
||||||
"c:\\te\"as\163t3\\" -> +pinugs-am ;
|
"/te\163t13" -> +pinugs-am ;
|
||||||
"/te\163t3" -> +pinugs-am ;
|
/test14 -> +pinugs---am ;
|
||||||
"/te\163t3" -> +pinugs-am ;
|
/test15 -> $(ReadOnly)s-+-am ;
|
||||||
/test4 -> +pinugs---am ;
|
|
||||||
/test5 -> $(ReadOnly)s-+-am ;
|
|
||||||
|
|
||||||
# test weird file names
|
# test weird file names
|
||||||
/lost+found -> +p ;
|
/lost+found -> +p ;
|
||||||
|
@ -51,50 +49,51 @@ $(turd) -> $(poo);
|
||||||
;
|
;
|
||||||
|
|
||||||
# simple default policy
|
# simple default policy
|
||||||
/simple -> +ppp;
|
/simple2 -> +ppp;
|
||||||
|
|
||||||
# variable
|
# variable
|
||||||
$(poo) = pinug;
|
FOO = pinug;
|
||||||
/simplevar -> $(poo) ;
|
/simplevar2 -> $(FOO) ;
|
||||||
$(turd) = /test6;
|
BAR = /test16;
|
||||||
$(turd) -> $(poo);
|
$(BAR) -> $(FOO);
|
||||||
|
|
||||||
# omit with space seperation
|
# omit with space seperation
|
||||||
! /omit ;
|
! /omit ;
|
||||||
|
|
||||||
# omit with no space separation
|
# omit with no space separation
|
||||||
!/omit ;
|
!/omit2 ;
|
||||||
|
|
||||||
# named attributes
|
# named attributes
|
||||||
/namedattr -> +pinug (name1 value1) ;
|
#/namedattr -> +pinug (name1 value1) ;
|
||||||
|
|
||||||
# multiple attributes
|
# multiple attributes
|
||||||
/namedattr2 -> +pinug (emailreport on; emailsendto genek; name3 val3; name4 val4; name5 val5 ) ;
|
#/namedattr2 -> +pinug (emailreport on; emailsendto genek; name3 val3; name4 val4; name5 val5 ) ;
|
||||||
|
|
||||||
# test line continuations
|
# test line continuations
|
||||||
/turd \
|
/bar2 \
|
||||||
->\
|
->\
|
||||||
+p
|
+p
|
||||||
;
|
;
|
||||||
|
|
||||||
@@END
|
#@@END
|
||||||
# the following isn't implemented yet
|
# the following isn't implemented yet
|
||||||
#########################################3
|
#########################################3
|
||||||
|
|
||||||
# attributes on specifers
|
# attributes on specifers
|
||||||
/conditions {
|
#/conditions2 {
|
||||||
xxx: +pinug (inside1 name1 ;) ;
|
# xxx: +pinug (inside1 name1 ;) ;
|
||||||
yyy: +pinug ;
|
# yyy: +pinug ;
|
||||||
zzz: +pinug ;
|
# zzz: +pinug ;
|
||||||
default: +pinug ;
|
# default: +pinug ;
|
||||||
};
|
# };
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# multiple specmasks
|
# multiple specmasks
|
||||||
/conditions {
|
#/conditions3 {
|
||||||
xxx: +pinug ;
|
# xxx: +pinug ;
|
||||||
yyy: +pinug ;
|
# yyy: +pinug ;
|
||||||
zzz: +pinug ;
|
# zzz: +pinug ;
|
||||||
default: +pinug ;
|
# default: +pinug ;
|
||||||
};
|
# };
|
||||||
|
#
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
/etc jj ;
|
/etc -> $(IgnoreNone);
|
||||||
|
|
|
@ -1,17 +1,16 @@
|
||||||
|
|
||||||
# test weird file names
|
# test weird file names
|
||||||
/lost+found -> +p ;
|
/lost+found -> +p ;
|
||||||
/l-o_st+fo/und -> +ping (l-o_st+fo/und2 l-o_st+fo/und3) ;
|
/l-o_st+fo/und -> +ping;
|
||||||
|
|
||||||
# test variables
|
# test variables
|
||||||
$(ReadOnly) = ping;
|
FOO = ping;
|
||||||
/simplevar -> $(ReadOnly) ;
|
/simplevar -> $(FOO) ;
|
||||||
/var -> $(ReadOnly)-p ;
|
/var -> $(FOO)-p ;
|
||||||
|
|
||||||
# test line continuations
|
# test line continuations
|
||||||
c:/test -> +p ;
|
|
||||||
|
|
||||||
/turd \
|
/bar \
|
||||||
->\
|
->\
|
||||||
+p
|
+p
|
||||||
;
|
;
|
||||||
|
@ -20,25 +19,24 @@ c:/test -> +p ;
|
||||||
"/qfoo" -> +p ;
|
"/qfoo" -> +p ;
|
||||||
"/Program Files" -> +p ;
|
"/Program Files" -> +p ;
|
||||||
" /lots o' spaces " -> +p ;
|
" /lots o' spaces " -> +p ;
|
||||||
" colon: semicolon; quote' " -> +p ;
|
#" colon: semicolon; quote' " -> +p ;
|
||||||
|
|
||||||
# test attributes
|
# test attributes
|
||||||
/namedattr2 -> +p ( name1 value1; name2 value2; ) ;
|
#/namedattr2 -> +p ( name1 value1; name2 value2; ) ;
|
||||||
/namedattr -> +p (name1 value1; ) ;
|
#/namedattr -> +p (name1 value1; ) ;
|
||||||
|
|
||||||
# test propvector
|
# test propvector
|
||||||
c:/test -> +p ;
|
|
||||||
|
|
||||||
/test -> +p ;
|
/test1 -> +p ;
|
||||||
/test -> +p-p ;
|
/test2 -> +p-p ;
|
||||||
/test -> +pinugs-am ;
|
/test3 -> +pinugs-am ;
|
||||||
/test -> +pinugs---am ;
|
/test4 -> +pinugs---am ;
|
||||||
/test -> +pinugs-+-am ;
|
/test5 -> +pinugs-+-am ;
|
||||||
|
|
||||||
|
|
||||||
# attributes and props
|
# attributes and props
|
||||||
/namedattr3 -> +pinug ( name1 value1; name2 value2; ) ;
|
#/namedattr3 -> +pinug ( name1 value1; name2 value2; ) ;
|
||||||
/namedattr4 -> +pinug (name1 value1; ) ;
|
#/namedattr4 -> +pinug (name1 value1; ) ;
|
||||||
|
|
||||||
# simple default policy
|
# simple default policy
|
||||||
/simple -> +ppp;
|
/simple -> +ppp;
|
||||||
|
@ -48,38 +46,39 @@ c:/test -> +p ;
|
||||||
! /omit ;
|
! /omit ;
|
||||||
|
|
||||||
# omit with no space separation
|
# omit with no space separation
|
||||||
!/omit ;
|
!/omit2 ;
|
||||||
|
|
||||||
# multiple attributes
|
# multiple attributes
|
||||||
/namedattr -> +pinug (emailreport on; emailsendto genek; name3 val3; name4 val4; name5 val5; ) ;
|
#/namedattr -> +pinug (emailreport on; emailsendto genek; name3 val3; name4 val4; name5 val5; ) ;
|
||||||
|
|
||||||
|
|
||||||
@@END
|
#@@END
|
||||||
# the following isn't implemented yet
|
# the following isn't implemented yet
|
||||||
#########################################3
|
#########################################3
|
||||||
|
|
||||||
# multiple specmasks
|
# multiple specmasks
|
||||||
/conditions -> {
|
#/conditions -> {
|
||||||
xxx -> +pinug ;
|
# xxx -> +pinug ;
|
||||||
yyy -> +pinug ;
|
# yyy -> +pinug ;
|
||||||
zzz -> +pinug ;
|
# zzz -> +pinug ;
|
||||||
default -> +pinug ;
|
# default -> +pinug ;
|
||||||
};
|
# };
|
||||||
|
|
||||||
# attributes on specifers
|
# attributes on specifers
|
||||||
/conditions -> {
|
#/conditions -> {
|
||||||
xxx -> +pinug (inside1 name1 ;) ;
|
# xxx -> +pinug (inside1 name1 ;) ;
|
||||||
yyy -> +pinug ;
|
# yyy -> +pinug ;
|
||||||
zzz -> +pinug ;
|
# zzz -> +pinug ;
|
||||||
default -> +pinug ;
|
# default -> +pinug ;
|
||||||
};
|
# };
|
||||||
|
|
||||||
|
|
||||||
# hard ones
|
# hard ones
|
||||||
|
|
||||||
/conditions -> {
|
#/conditions -> {
|
||||||
xxx -> +pinug (inside1 name1 ;) ;
|
# xxx -> +pinug (inside1 name1 ;) ;
|
||||||
yyy -> $(poo)+pinug ;
|
# yyy -> $(baz)+pinug ;
|
||||||
zzz -> +pinug ( inside1 name1 ; outside name2);
|
# zzz -> +pinug ( inside1 name1 ; outside name2);
|
||||||
default -> $(turd)-p ;
|
# default -> $(bar)-p ;
|
||||||
};
|
# };
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
( emailreport on ; )
|
(emailto=root@localhost)
|
||||||
{
|
{
|
||||||
/foo -> +pinugs ;
|
/foo -> +pinugs ;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,8 +46,6 @@
|
||||||
|
|
||||||
#include <fstream> // for the FileExists() stuff
|
#include <fstream> // for the FileExists() stuff
|
||||||
|
|
||||||
|
|
||||||
#if IS_UNIX
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#if SUPPORTS_TERMIOS
|
#if SUPPORTS_TERMIOS
|
||||||
|
@ -56,7 +54,6 @@
|
||||||
#endif
|
#endif
|
||||||
//#include <signal.h>
|
//#include <signal.h>
|
||||||
int _getch(void);
|
int _getch(void);
|
||||||
#endif
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
@ -282,7 +279,6 @@ int cSiggenCmdLine::Init(cCmdLineParser& parser)
|
||||||
case HELP:
|
case HELP:
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case CRC32:
|
case CRC32:
|
||||||
{
|
{
|
||||||
|
@ -373,11 +369,6 @@ void PrintHeader( TSTRING filename)
|
||||||
|
|
||||||
bool util_FileExists(const TSTRING& fileName)
|
bool util_FileExists(const TSTRING& fileName)
|
||||||
{
|
{
|
||||||
#if IS_UNIX
|
|
||||||
// for unix we may be able to use the same logic as above, but
|
|
||||||
// it is too close to 2.2.1 release to make that change w/o testing.
|
|
||||||
// I know the above works for windows.
|
|
||||||
return _taccess(fileName.c_str(), F_OK) == 0;
|
return _taccess(fileName.c_str(), F_OK) == 0;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,10 +55,8 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
|
|
||||||
#if IS_UNIX
|
|
||||||
#include "core/unixfsservices.h"
|
#include "core/unixfsservices.h"
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// terminate and unexpected handlers
|
// terminate and unexpected handlers
|
||||||
|
@ -93,9 +91,7 @@ static void SiggenInit()
|
||||||
//
|
//
|
||||||
// set up the file system services
|
// set up the file system services
|
||||||
//
|
//
|
||||||
#if IS_UNIX
|
|
||||||
static cUnixFSServices fss;
|
static cUnixFSServices fss;
|
||||||
#endif
|
|
||||||
iFSServices::SetInstance( &fss );
|
iFSServices::SetInstance( &fss );
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -100,7 +100,7 @@ static void util_ProcessDir( cDbDataSourceIter dbIter, iFCODataSourceIter* pIter
|
||||||
{
|
{
|
||||||
dbIter.AddChildArray();
|
dbIter.AddChildArray();
|
||||||
}
|
}
|
||||||
std::auto_ptr<iFCODataSourceIter> pCopy( pIter->CreateCopy() );
|
TW_UNIQUE_PTR<iFCODataSourceIter> pCopy( pIter->CreateCopy() );
|
||||||
util_ProcessDir( dbIter, pCopy.get(), pSpec, pPC, pPD );
|
util_ProcessDir( dbIter, pCopy.get(), pSpec, pPC, pPD );
|
||||||
//
|
//
|
||||||
// if no files were added, remove the child array...
|
// if no files were added, remove the child array...
|
||||||
|
@ -122,7 +122,7 @@ void cGenerateDb::Execute( const cFCOSpecList& specList, cHierDatabase& db, iFCO
|
||||||
{
|
{
|
||||||
// TODO -- assert the db is empty or clear it out myself!
|
// TODO -- assert the db is empty or clear it out myself!
|
||||||
|
|
||||||
std::auto_ptr<iFCODataSourceIter> pDSIter(iTWFactory::GetInstance()->CreateDataSourceIter());
|
TW_UNIQUE_PTR<iFCODataSourceIter> pDSIter(iTWFactory::GetInstance()->CreateDataSourceIter());
|
||||||
|
|
||||||
//
|
//
|
||||||
// set up the database's iterator...
|
// set up the database's iterator...
|
||||||
|
@ -139,7 +139,7 @@ void cGenerateDb::Execute( const cFCOSpecList& specList, cHierDatabase& db, iFCO
|
||||||
//
|
//
|
||||||
// this is the object that will calculate all of the properties of the fcos.
|
// this is the object that will calculate all of the properties of the fcos.
|
||||||
//
|
//
|
||||||
std::auto_ptr<iFCOPropCalc> pPC(iTWFactory::GetInstance()->CreatePropCalc());
|
TW_UNIQUE_PTR<iFCOPropCalc> pPC(iTWFactory::GetInstance()->CreatePropCalc());
|
||||||
pPC->SetErrorBucket( pBucket );
|
pPC->SetErrorBucket( pBucket );
|
||||||
if( flags & FLAG_ERASE_FOOTPRINTS_GD )
|
if( flags & FLAG_ERASE_FOOTPRINTS_GD )
|
||||||
{
|
{
|
||||||
|
@ -193,7 +193,7 @@ void cGenerateDb::Execute( const cFCOSpecList& specList, cHierDatabase& db, iFCO
|
||||||
{
|
{
|
||||||
dbIter.AddChildArray();
|
dbIter.AddChildArray();
|
||||||
}
|
}
|
||||||
std::auto_ptr<iFCODataSourceIter> pCopy( pDSIter->CreateCopy() );
|
TW_UNIQUE_PTR<iFCODataSourceIter> pCopy( pDSIter->CreateCopy() );
|
||||||
util_ProcessDir( dbIter, pCopy.get(), specIter.Spec(), pPC.get(), pPD );
|
util_ProcessDir( dbIter, pCopy.get(), specIter.Spec(), pPC.get(), pPD );
|
||||||
//
|
//
|
||||||
// if no files were added, remove the child array...
|
// if no files were added, remove the child array...
|
||||||
|
|
|
@ -78,7 +78,7 @@ void TestGenerateDb()
|
||||||
// ok, time to integrity check!
|
// ok, time to integrity check!
|
||||||
//
|
//
|
||||||
cGenreSpecListVector::iterator at;
|
cGenreSpecListVector::iterator at;
|
||||||
for( at = slv.begin(); at != slv.end(); at++ )
|
for( at = slv.begin(); at != slv.end(); ++at )
|
||||||
{
|
{
|
||||||
cGenerateDb::Execute(
|
cGenerateDb::Execute(
|
||||||
at->GetSpecList(),
|
at->GetSpecList(),
|
||||||
|
|
|
@ -90,7 +90,7 @@ void cIntegrityCheck::ProcessAddedFCO( cDbDataSourceIter dbIter, iFCODataSourceI
|
||||||
// to done...
|
// to done...
|
||||||
//
|
//
|
||||||
while( ! dbIter.Done() ) dbIter.Next();
|
while( ! dbIter.Done() ) dbIter.Next();
|
||||||
std::auto_ptr<iFCODataSourceIter> pCopy( pIter->CreateCopy() );
|
TW_UNIQUE_PTR<iFCODataSourceIter> pCopy( pIter->CreateCopy() );
|
||||||
ProcessDir( dbIter, pCopy.get() );
|
ProcessDir( dbIter, pCopy.get() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -231,7 +231,7 @@ void cIntegrityCheck::ProcessChangedFCO( cDbDataSourceIter dbIter, iFCODataSourc
|
||||||
{
|
{
|
||||||
if( pIter->CanDescend() || dbIter.CanDescend() )
|
if( pIter->CanDescend() || dbIter.CanDescend() )
|
||||||
{
|
{
|
||||||
std::auto_ptr<iFCODataSourceIter> pCopy( pIter->CreateCopy() );
|
TW_UNIQUE_PTR<iFCODataSourceIter> pCopy( pIter->CreateCopy() );
|
||||||
ProcessDir( dbIter, pCopy.get() );
|
ProcessDir( dbIter, pCopy.get() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -453,7 +453,7 @@ void cIntegrityCheck::Execute( uint32 flags )
|
||||||
mFlags = flags;
|
mFlags = flags;
|
||||||
// create the data source iterator
|
// create the data source iterator
|
||||||
//
|
//
|
||||||
std::auto_ptr<iFCODataSourceIter> pDSIter(iTWFactory::GetInstance()->CreateDataSourceIter());
|
TW_UNIQUE_PTR<iFCODataSourceIter> pDSIter(iTWFactory::GetInstance()->CreateDataSourceIter());
|
||||||
//
|
//
|
||||||
// set up the database's iterator...
|
// set up the database's iterator...
|
||||||
// I assume the current genre is correct...
|
// I assume the current genre is correct...
|
||||||
|
@ -560,7 +560,7 @@ void cIntegrityCheck::ExecuteOnObjectList( const std::list<cFCOName>& fcoNames,
|
||||||
//
|
//
|
||||||
// create the data source iterator
|
// create the data source iterator
|
||||||
//
|
//
|
||||||
std::auto_ptr<iFCODataSourceIter> pDSIter(iTWFactory::GetInstance()->CreateDataSourceIter());
|
TW_UNIQUE_PTR<iFCODataSourceIter> pDSIter(iTWFactory::GetInstance()->CreateDataSourceIter());
|
||||||
//
|
//
|
||||||
// set up the database's iterator...
|
// set up the database's iterator...
|
||||||
// I assume the current genre is correct...
|
// I assume the current genre is correct...
|
||||||
|
@ -593,7 +593,7 @@ void cIntegrityCheck::ExecuteOnObjectList( const std::list<cFCOName>& fcoNames,
|
||||||
// iterate over all the objects to integrity check..
|
// iterate over all the objects to integrity check..
|
||||||
//
|
//
|
||||||
std::list<cFCOName>::const_iterator it;
|
std::list<cFCOName>::const_iterator it;
|
||||||
for( it = fcoNames.begin(); it != fcoNames.end(); it++ )
|
for( it = fcoNames.begin(); it != fcoNames.end(); ++it )
|
||||||
{
|
{
|
||||||
TW_NOTIFY_VERBOSE( _T("%s%s\n"),
|
TW_NOTIFY_VERBOSE( _T("%s%s\n"),
|
||||||
TSS_GetString( cTripwire, tripwire::STR_NOTIFY_CHECKING ).c_str(),
|
TSS_GetString( cTripwire, tripwire::STR_NOTIFY_CHECKING ).c_str(),
|
||||||
|
|
|
@ -80,7 +80,7 @@ void TestIntegrityCheck()
|
||||||
// ok, time to integrity check!
|
// ok, time to integrity check!
|
||||||
//
|
//
|
||||||
cGenreSpecListVector::iterator at;
|
cGenreSpecListVector::iterator at;
|
||||||
for( at = slv.begin(); at != slv.end(); at++ )
|
for( at = slv.begin(); at != slv.end(); ++at )
|
||||||
{
|
{
|
||||||
cIntegrityCheck ic( at->GetGenre(), at->GetSpecList(), db, report, &et );
|
cIntegrityCheck ic( at->GetGenre(), at->GetSpecList(), db, report, &et );
|
||||||
ic.Execute();
|
ic.Execute();
|
||||||
|
|
|
@ -130,7 +130,7 @@ bool cMailMessage::GetAttachmentsAsString( std::string& s )
|
||||||
bool allOK = true;
|
bool allOK = true;
|
||||||
for( std::vector<TSTRING>::const_iterator at = mvstrAttachments.begin();
|
for( std::vector<TSTRING>::const_iterator at = mvstrAttachments.begin();
|
||||||
at != mvstrAttachments.end();
|
at != mvstrAttachments.end();
|
||||||
at++ )
|
++at )
|
||||||
{
|
{
|
||||||
s += "\r\n";
|
s += "\r\n";
|
||||||
|
|
||||||
|
@ -231,10 +231,8 @@ bool cMailMessageUtil::ReadDate( TSTRING& strDateBuf )
|
||||||
#if HAVE_STRFTIME
|
#if HAVE_STRFTIME
|
||||||
|
|
||||||
TCHAR szDate[1024];
|
TCHAR szDate[1024];
|
||||||
struct tm *tm = NULL;
|
|
||||||
|
|
||||||
time_t current_time = time(NULL);
|
time_t current_time = time(NULL);
|
||||||
tm = localtime ( ¤t_time );
|
struct tm* tm = localtime ( ¤t_time );
|
||||||
|
|
||||||
const TCHAR* szFormat = _T("%a, %d %b %Y %H:%M:%S %z");
|
const TCHAR* szFormat = _T("%a, %d %b %Y %H:%M:%S %z");
|
||||||
|
|
||||||
|
@ -349,7 +347,7 @@ cQuotedPrintableEncoding::Encode( const std::string& sIn,
|
||||||
std::string::size_type lineLen = 0;
|
std::string::size_type lineLen = 0;
|
||||||
for( at = sIn.begin();
|
for( at = sIn.begin();
|
||||||
at != sIn.end();
|
at != sIn.end();
|
||||||
at++, lineLen += _ENCODED_CHAR_LEN )
|
++at, lineLen += _ENCODED_CHAR_LEN )
|
||||||
{
|
{
|
||||||
if( NeedsEncoding( *at ) )
|
if( NeedsEncoding( *at ) )
|
||||||
{
|
{
|
||||||
|
@ -481,7 +479,7 @@ cMailMessageUtil::HasNonAsciiChars( const std::string& s )
|
||||||
{
|
{
|
||||||
for( std::string::const_iterator at = s.begin();
|
for( std::string::const_iterator at = s.begin();
|
||||||
at != s.end();
|
at != s.end();
|
||||||
at ++ )
|
++at )
|
||||||
{
|
{
|
||||||
if( (unsigned char)*at > (unsigned char)0x7F )
|
if( (unsigned char)*at > (unsigned char)0x7F )
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -36,13 +36,10 @@
|
||||||
#include "core/error.h"
|
#include "core/error.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if HAVE_SYS_SOCKET_H
|
||||||
#if IS_UNIX
|
# include <sys/socket.h>
|
||||||
# if HAVE_SYS_SOCKET_H
|
|
||||||
# include <sys/socket.h>
|
|
||||||
# endif
|
|
||||||
# define SOCKET int
|
|
||||||
#endif
|
#endif
|
||||||
|
#define SOCKET int
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -250,8 +247,6 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//#ifdef IS_UNIX
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// This class implements sending a message through a unix pipe to a program
|
// This class implements sending a message through a unix pipe to a program
|
||||||
|
@ -260,7 +255,7 @@ private:
|
||||||
class cPipedMailMessage : public cMailMessage
|
class cPipedMailMessage : public cMailMessage
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
cPipedMailMessage(TSTRING strSendMailExePath);
|
explicit cPipedMailMessage(const TSTRING& strSendMailExePath);
|
||||||
virtual ~cPipedMailMessage();
|
virtual ~cPipedMailMessage();
|
||||||
|
|
||||||
virtual bool Send(); //throw(eMailMessageError)
|
virtual bool Send(); //throw(eMailMessageError)
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
//
|
//
|
||||||
// Constructor. Not much to do beside initialize the handle to the DLL
|
// Constructor. Not much to do beside initialize the handle to the DLL
|
||||||
//
|
//
|
||||||
cPipedMailMessage::cPipedMailMessage(TSTRING strSendMailExePath)
|
cPipedMailMessage::cPipedMailMessage(const TSTRING& strSendMailExePath)
|
||||||
{
|
{
|
||||||
mstrSendMailExePath = strSendMailExePath;
|
mstrSendMailExePath = strSendMailExePath;
|
||||||
mpFile = NULL;
|
mpFile = NULL;
|
||||||
|
|
|
@ -40,8 +40,6 @@
|
||||||
#include "core/msystem.h"
|
#include "core/msystem.h"
|
||||||
#include "core/file.h"
|
#include "core/file.h"
|
||||||
|
|
||||||
#if IS_UNIX
|
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
//All the spleck that it takes to run sockets in Unix...
|
//All the spleck that it takes to run sockets in Unix...
|
||||||
|
@ -92,7 +90,7 @@ static int gethostname( char* name, int namelen )
|
||||||
|
|
||||||
if ( strlen( myname.nodename ) < (unsigned int)namelen )
|
if ( strlen( myname.nodename ) < (unsigned int)namelen )
|
||||||
{
|
{
|
||||||
strcpy( name, myname.nodename );
|
strncpy( name, myname.nodename, namelen );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -106,24 +104,24 @@ static int gethostname( char* name, int namelen )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif //HAVE_GETHOSTNAME
|
||||||
// Unix does not require us to go though any silly DLL hoops, so we'll
|
|
||||||
// just #define the pointers to functions needed by Windows to be the
|
// Unix does not require us to go though any silly DLL hoops, so we'll
|
||||||
// berkely functions.
|
// just #define the pointers to functions needed by Windows to be the
|
||||||
#define mPfnSocket socket
|
// berkely functions.
|
||||||
#define mPfnInetAddr inet_addr
|
#define mPfnSocket socket
|
||||||
#define mPfnGethostname gethostname
|
#define mPfnInetAddr inet_addr
|
||||||
#define mPfnGethostbyname gethostbyname
|
#define mPfnGethostname gethostname
|
||||||
#define mPfnConnect connect
|
#define mPfnGethostbyname gethostbyname
|
||||||
#define mPfnCloseSocket close
|
#define mPfnConnect connect
|
||||||
#define mPfnSend send
|
#define mPfnCloseSocket close
|
||||||
#define mPfnRecv recv
|
#define mPfnSend send
|
||||||
#define mPfnSelect select
|
#define mPfnRecv recv
|
||||||
#define mPfnNtohl ntohl
|
#define mPfnSelect select
|
||||||
#define mPfnHtonl htonl
|
#define mPfnNtohl ntohl
|
||||||
#define mPfnNtohs ntohs
|
#define mPfnHtonl htonl
|
||||||
#define mPfnHtons htons
|
#define mPfnNtohs ntohs
|
||||||
#endif
|
#define mPfnHtons htons
|
||||||
|
|
||||||
//
|
//
|
||||||
// TODO - maybe convert this SMTP code to non-blocking socket calls, or use
|
// TODO - maybe convert this SMTP code to non-blocking socket calls, or use
|
||||||
|
@ -215,9 +213,8 @@ bool cSMTPMailMessage::OpenConnection()
|
||||||
sockAddrIn.sin_port = mPfnHtons(mPortNumber);
|
sockAddrIn.sin_port = mPfnHtons(mPortNumber);
|
||||||
uint32 iServerAddress = GetServerAddress();
|
uint32 iServerAddress = GetServerAddress();
|
||||||
|
|
||||||
#if IS_UNIX
|
|
||||||
sockAddrIn.sin_addr.s_addr = iServerAddress;
|
sockAddrIn.sin_addr.s_addr = iServerAddress;
|
||||||
#endif
|
|
||||||
if ( iServerAddress == INADDR_NONE )
|
if ( iServerAddress == INADDR_NONE )
|
||||||
{
|
{
|
||||||
DecodeError();
|
DecodeError();
|
||||||
|
@ -494,14 +491,8 @@ bool cSMTPMailMessage::GetAcknowledgement()
|
||||||
// need comment
|
// need comment
|
||||||
timeval tv;
|
timeval tv;
|
||||||
|
|
||||||
|
|
||||||
#if IS_UNIX
|
|
||||||
FD_ZERO( &socketSet );
|
FD_ZERO( &socketSet );
|
||||||
FD_SET( mSocket, &socketSet );
|
FD_SET( mSocket, &socketSet );
|
||||||
#else
|
|
||||||
socketSet.fd_count = 1;
|
|
||||||
socketSet.fd_array[0] = mSocket;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// set the timeout time to sixty seconds
|
// set the timeout time to sixty seconds
|
||||||
tv.tv_sec = 60;
|
tv.tv_sec = 60;
|
||||||
|
@ -567,15 +558,9 @@ void cSMTPMailMessage::SendString( const std::string& str )
|
||||||
void cSMTPMailMessage::DecodeError()
|
void cSMTPMailMessage::DecodeError()
|
||||||
{
|
{
|
||||||
#if defined(_DEBUG)
|
#if defined(_DEBUG)
|
||||||
|
|
||||||
#if IS_UNIX
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// TODO - Write what ever error reporting will be needed under unix.
|
// TODO - Write what ever error reporting will be needed under unix.
|
||||||
//
|
//
|
||||||
|
|
||||||
#endif // IS_UNIX
|
|
||||||
|
|
||||||
#endif // defined(_DEBUG)
|
#endif // defined(_DEBUG)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
#include "core/errorbucketimpl.h"
|
#include "core/errorbucketimpl.h"
|
||||||
#include "core/usernotifystdout.h"
|
#include "core/usernotifystdout.h"
|
||||||
#include "core/timebomb.h"
|
#include "core/timebomb.h"
|
||||||
#include <memory> // for auto_ptr
|
#include <memory> // for auto_ptr / unique_ptr
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
|
|
||||||
|
@ -55,12 +55,8 @@
|
||||||
#include "fco/fcogenre.h"
|
#include "fco/fcogenre.h"
|
||||||
#include "fco/genreswitcher.h"
|
#include "fco/genreswitcher.h"
|
||||||
|
|
||||||
#if IS_UNIX
|
|
||||||
#include "core/unixfsservices.h"
|
#include "core/unixfsservices.h"
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#else
|
|
||||||
#error Who the hell am I?
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static TSTRING util_GetWholeCmdLine( int argc, const TCHAR *argv[] );
|
static TSTRING util_GetWholeCmdLine( int argc, const TCHAR *argv[] );
|
||||||
|
|
||||||
|
@ -137,7 +133,7 @@ int __cdecl _tmain( int argc, const TCHAR* argv[ ], const TCHAR* envp[ ] )
|
||||||
|
|
||||||
|
|
||||||
// first, get the right mode...
|
// first, get the right mode...
|
||||||
std::auto_ptr<iTWMode> pMode(cTWCmdLine::GetMode(argc, argv));
|
TW_UNIQUE_PTR<iTWMode> pMode(cTWCmdLine::GetMode(argc, argv));
|
||||||
if(! pMode.get())
|
if(! pMode.get())
|
||||||
{
|
{
|
||||||
// no valid mode passed; GetMode will display an appropriate string (include usage statement)
|
// no valid mode passed; GetMode will display an appropriate string (include usage statement)
|
||||||
|
@ -171,13 +167,11 @@ int __cdecl _tmain( int argc, const TCHAR* argv[ ], const TCHAR* envp[ ] )
|
||||||
|
|
||||||
TSTRING commandLine = util_GetWholeCmdLine( argc, argv );
|
TSTRING commandLine = util_GetWholeCmdLine( argc, argv );
|
||||||
|
|
||||||
#if IS_UNIX
|
|
||||||
// erase the command line
|
// erase the command line
|
||||||
// TODO: it might be a good idea to move this to cTWUtil
|
// TODO: it might be a good idea to move this to cTWUtil
|
||||||
int i;
|
int i;
|
||||||
for (i = 1; i < argc; ++i)
|
for (i = 1; i < argc; ++i)
|
||||||
memset((char*)argv[i], 0, strlen(argv[i])*sizeof(TCHAR));
|
memset((char*)argv[i], 0, strlen(argv[i])*sizeof(TCHAR));
|
||||||
#endif
|
|
||||||
|
|
||||||
cCmdLineIter iter(cmdLine);
|
cCmdLineIter iter(cmdLine);
|
||||||
if (iter.SeekToArg(cTWCmdLine::HELP))
|
if (iter.SeekToArg(cTWCmdLine::HELP))
|
||||||
|
@ -243,7 +237,7 @@ int __cdecl _tmain( int argc, const TCHAR* argv[ ], const TCHAR* envp[ ] )
|
||||||
ret = 8;
|
ret = 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (std::bad_alloc e)
|
catch (std::bad_alloc& e)
|
||||||
{
|
{
|
||||||
// Note: We use fputs rather than TCERR as it will probably require the
|
// Note: We use fputs rather than TCERR as it will probably require the
|
||||||
// least amount of memory to do its thing. If we ran out of memory we
|
// least amount of memory to do its thing. If we ran out of memory we
|
||||||
|
@ -253,7 +247,7 @@ int __cdecl _tmain( int argc, const TCHAR* argv[ ], const TCHAR* envp[ ] )
|
||||||
ret = 8;
|
ret = 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (std::exception e)
|
catch (std::exception& e)
|
||||||
{
|
{
|
||||||
TCERR << _T("*** Fatal exception: ");
|
TCERR << _T("*** Fatal exception: ");
|
||||||
std::cerr << e.what() << std::endl;
|
std::cerr << e.what() << std::endl;
|
||||||
|
|
|
@ -78,11 +78,8 @@
|
||||||
#include "tasktimer.h"
|
#include "tasktimer.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if IS_UNIX
|
|
||||||
#include "fs/fsdatasourceiter.h" // for cross file systems flag
|
#include "fs/fsdatasourceiter.h" // for cross file systems flag
|
||||||
#include <unistd.h> // for _exit()
|
#include <unistd.h> // for _exit()
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// #defines
|
// #defines
|
||||||
|
@ -277,15 +274,10 @@ static void FillOutConfigInfo(cTWModeCommon* pModeInfo, const cConfigFile& cf)
|
||||||
}
|
}
|
||||||
if(cf.Lookup(TSTRING(_T("RESETACCESSTIME")), str))
|
if(cf.Lookup(TSTRING(_T("RESETACCESSTIME")), str))
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
#if IS_UNIX
|
|
||||||
// We do not support reset access time on Unix, so we issue a warning.
|
// We do not support reset access time on Unix, so we issue a warning.
|
||||||
// This used to be a fatal error, however this prevents
|
// This used to be a fatal error, however this prevents
|
||||||
// cross platform config files.
|
// cross platform config files.
|
||||||
cTWUtil::PrintErrorMsg(eTWInvalidConfigFileKey(_T("RESETACCESSTIME"), eError::NON_FATAL));
|
cTWUtil::PrintErrorMsg(eTWInvalidConfigFileKey(_T("RESETACCESSTIME"), eError::NON_FATAL));
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
if(cf.Lookup(TSTRING(_T("LOOSEDIRECTORYCHECKING")), str))
|
if(cf.Lookup(TSTRING(_T("LOOSEDIRECTORYCHECKING")), str))
|
||||||
{
|
{
|
||||||
|
@ -649,12 +641,9 @@ bool cTWModeDbInit::Init(const cConfigFile& cf, const cCmdLineParser& cmdLine)
|
||||||
if (cTWUtil::VerifyCfgSiteKey( mstrConfigFile, mpData->mSiteKeyFile ) == false)
|
if (cTWUtil::VerifyCfgSiteKey( mstrConfigFile, mpData->mSiteKeyFile ) == false)
|
||||||
cTWUtil::PrintErrorMsg(eTWCfgUnencrypted(_T(""), eError::NON_FATAL|eError::SUPRESS_THIRD_MSG));
|
cTWUtil::PrintErrorMsg(eTWCfgUnencrypted(_T(""), eError::NON_FATAL|eError::SUPRESS_THIRD_MSG));
|
||||||
|
|
||||||
#if IS_UNIX
|
|
||||||
// Set the cross file systems flag appropriately.
|
// Set the cross file systems flag appropriately.
|
||||||
cFSDataSourceIter::SetFileSystemCrossing(mpData->mbCrossFileSystems);
|
cFSDataSourceIter::SetFileSystemCrossing(mpData->mbCrossFileSystems);
|
||||||
#endif
|
return true;
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -1021,13 +1010,10 @@ bool cTWModeIC::Init(const cConfigFile& cf, const cCmdLineParser& cmdLine)
|
||||||
//
|
//
|
||||||
if (cTWUtil::VerifyCfgSiteKey( mstrConfigFile, mpData->mSiteKeyFile ) == false)
|
if (cTWUtil::VerifyCfgSiteKey( mstrConfigFile, mpData->mSiteKeyFile ) == false)
|
||||||
cTWUtil::PrintErrorMsg(eTWCfgUnencrypted(_T(""), eError::NON_FATAL|eError::SUPRESS_THIRD_MSG));
|
cTWUtil::PrintErrorMsg(eTWCfgUnencrypted(_T(""), eError::NON_FATAL|eError::SUPRESS_THIRD_MSG));
|
||||||
|
|
||||||
#if IS_UNIX
|
|
||||||
// Set the cross file systems flag appropriately.
|
// Set the cross file systems flag appropriately.
|
||||||
cFSDataSourceIter::SetFileSystemCrossing(mpData->mbCrossFileSystems);
|
cFSDataSourceIter::SetFileSystemCrossing(mpData->mbCrossFileSystems);
|
||||||
#endif
|
return true;
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1137,18 +1123,18 @@ int cTWModeIC::Execute(cErrorQueue* pQueue)
|
||||||
//
|
//
|
||||||
// now, we will iterate over the list, performing an integrity check for each genre
|
// now, we will iterate over the list, performing an integrity check for each genre
|
||||||
//
|
//
|
||||||
for( cTWUtil::GenreObjList::iterator genreIter = listOut.begin(); genreIter != listOut.end(); genreIter++ )
|
for( cTWUtil::GenreObjList::iterator genreIter = listOut.begin(); genreIter != listOut.end(); ++genreIter )
|
||||||
{
|
{
|
||||||
dbIter.SeekToGenre( genreIter->first );
|
dbIter.SeekToGenre( genreIter->first );
|
||||||
if( ! dbIter.Done() )
|
if( ! dbIter.Done() )
|
||||||
{
|
{
|
||||||
cGenreSwitcher::GetInstance()->SelectGenre( (cGenre::Genre)dbIter.GetGenre() );
|
cGenreSwitcher::GetInstance()->SelectGenre( (cGenre::Genre)dbIter.GetGenre() );
|
||||||
std::auto_ptr<iParserGenreUtil> pParseUtil (iTWFactory::GetInstance()->CreateParserGenreUtil());
|
TW_UNIQUE_PTR<iParserGenreUtil> pParseUtil (iTWFactory::GetInstance()->CreateParserGenreUtil());
|
||||||
//
|
//
|
||||||
// I have to turn this into a list of cFCONames
|
// I have to turn this into a list of cFCONames
|
||||||
//
|
//
|
||||||
std::list<cFCOName> fcoNames;
|
std::list<cFCOName> fcoNames;
|
||||||
for(cTWUtil::ObjList::iterator it = genreIter->second.begin(); it != genreIter->second.end(); it++)
|
for(cTWUtil::ObjList::iterator it = genreIter->second.begin(); it != genreIter->second.end(); ++it)
|
||||||
{
|
{
|
||||||
// if this is not an absolute path, warn and continue...
|
// if this is not an absolute path, warn and continue...
|
||||||
//
|
//
|
||||||
|
@ -1476,7 +1462,7 @@ public:
|
||||||
cFCOReportHeader* mpReportHeader;
|
cFCOReportHeader* mpReportHeader;
|
||||||
|
|
||||||
// ctor can set up some default values
|
// ctor can set up some default values
|
||||||
cTWModeDbUpdate_i() : cTWModeCommon(), mbInteractive(true), mbSecureMode(true), /*mSiteProvided(false),*/ mpReport(0), mpDbFile(0), mpReportHeader(0) {}
|
cTWModeDbUpdate_i() : cTWModeCommon(), mbInteractive(true), mbSecureMode(true), mbEncryptDb(true), /*mSiteProvided(false),*/ mpReport(0), mpDbFile(0), mpReportHeader(0) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -1586,12 +1572,9 @@ bool cTWModeDbUpdate::Init(const cConfigFile& cf, const cCmdLineParser& cmdLine)
|
||||||
if (cTWUtil::VerifyCfgSiteKey( mstrConfigFile, mpData->mSiteKeyFile ) == false)
|
if (cTWUtil::VerifyCfgSiteKey( mstrConfigFile, mpData->mSiteKeyFile ) == false)
|
||||||
cTWUtil::PrintErrorMsg(eTWCfgUnencrypted(_T(""), eError::NON_FATAL|eError::SUPRESS_THIRD_MSG));
|
cTWUtil::PrintErrorMsg(eTWCfgUnencrypted(_T(""), eError::NON_FATAL|eError::SUPRESS_THIRD_MSG));
|
||||||
|
|
||||||
#if IS_UNIX
|
|
||||||
// Set the cross file systems flag appropriately.
|
// Set the cross file systems flag appropriately.
|
||||||
cFSDataSourceIter::SetFileSystemCrossing(mpData->mbCrossFileSystems);
|
cFSDataSourceIter::SetFileSystemCrossing(mpData->mbCrossFileSystems);
|
||||||
#endif
|
return true;
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void cTWModeDbUpdate::Init(const cTWModeIC_i* pICData, cFCODatabaseFile* dbFile, cFCOReportHeader* prh, cFCOReport* pReport, bool bEncryptDb)
|
void cTWModeDbUpdate::Init(const cTWModeIC_i* pICData, cFCODatabaseFile* dbFile, cFCOReportHeader* prh, cFCOReport* pReport, bool bEncryptDb)
|
||||||
|
@ -1958,12 +1941,9 @@ bool cTWModePolUpdate::Init(const cConfigFile& cf, const cCmdLineParser& cmdLine
|
||||||
if (cTWUtil::VerifyCfgSiteKey( mstrConfigFile, mpData->mSiteKeyFile ) == false)
|
if (cTWUtil::VerifyCfgSiteKey( mstrConfigFile, mpData->mSiteKeyFile ) == false)
|
||||||
cTWUtil::PrintErrorMsg(eTWCfgUnencrypted(_T(""), eError::NON_FATAL|eError::SUPRESS_THIRD_MSG));
|
cTWUtil::PrintErrorMsg(eTWCfgUnencrypted(_T(""), eError::NON_FATAL|eError::SUPRESS_THIRD_MSG));
|
||||||
|
|
||||||
#if IS_UNIX
|
|
||||||
// Set the cross file systems flag appropriately.
|
// Set the cross file systems flag appropriately.
|
||||||
cFSDataSourceIter::SetFileSystemCrossing(mpData->mbCrossFileSystems);
|
cFSDataSourceIter::SetFileSystemCrossing(mpData->mbCrossFileSystems);
|
||||||
#endif
|
return true;
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -182,14 +182,17 @@ class cTWModeCommon
|
||||||
bool mMailNoViolations; // Email out reports with no violations?
|
bool mMailNoViolations; // Email out reports with no violations?
|
||||||
TSTRING mMailFrom;
|
TSTRING mMailFrom;
|
||||||
|
|
||||||
cTWModeCommon() : mVerbosity(1),
|
cTWModeCommon() : mVerbosity(1),
|
||||||
mLocalProvided(false),
|
mLocalProvided(false),
|
||||||
mbLatePassphrase(false),
|
mbLatePassphrase(false),
|
||||||
mfLooseDirs(false),
|
mfLooseDirs(false),
|
||||||
mbResetAccessTime(false),
|
mbResetAccessTime(false),
|
||||||
mbLogToSyslog(false),
|
mbLogToSyslog(false),
|
||||||
mbCrossFileSystems(false),
|
mbCrossFileSystems(false),
|
||||||
mbDirectIO(false)
|
mbDirectIO(false),
|
||||||
|
mMailMethod(cMailMessage::NO_METHOD),
|
||||||
|
mSmtpPort(25),
|
||||||
|
mMailNoViolations(true)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -531,7 +531,7 @@ static bool EmailReportTo(const TSTRING &toAddress, const cFCOReportHeader& head
|
||||||
const cTWModeCommon *modeCommon,
|
const cTWModeCommon *modeCommon,
|
||||||
const bool bForceFullReport)
|
const bool bForceFullReport)
|
||||||
{
|
{
|
||||||
std::auto_ptr<cMailMessage> reportMail;
|
TW_UNIQUE_PTR<cMailMessage> reportMail;
|
||||||
|
|
||||||
// allocate the right kind of emailer object based on what came out of the config file.
|
// allocate the right kind of emailer object based on what came out of the config file.
|
||||||
switch (modeCommon->mMailMethod)
|
switch (modeCommon->mMailMethod)
|
||||||
|
@ -540,10 +540,10 @@ static bool EmailReportTo(const TSTRING &toAddress, const cFCOReportHeader& head
|
||||||
ASSERT(false);
|
ASSERT(false);
|
||||||
return false;
|
return false;
|
||||||
case cMailMessage::MAIL_BY_SMTP:
|
case cMailMessage::MAIL_BY_SMTP:
|
||||||
reportMail = std::auto_ptr<cMailMessage>(new cSMTPMailMessage(modeCommon->mSmtpHost, modeCommon->mSmtpPort));
|
reportMail = TW_UNIQUE_PTR<cMailMessage>(new cSMTPMailMessage(modeCommon->mSmtpHost, modeCommon->mSmtpPort));
|
||||||
break;
|
break;
|
||||||
case cMailMessage::MAIL_BY_PIPE:
|
case cMailMessage::MAIL_BY_PIPE:
|
||||||
reportMail = std::auto_ptr<cMailMessage>(new cPipedMailMessage(modeCommon->mMailProgram));
|
reportMail = TW_UNIQUE_PTR<cMailMessage>(new cPipedMailMessage(modeCommon->mMailProgram));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -685,7 +685,7 @@ bool cTWCmdLineUtil::EmailReport(const cFCOReportHeader& header, const cFCORepor
|
||||||
|
|
||||||
bool cTWCmdLineUtil::SendEmailTestMessage(const TSTRING &mAddress, const cTWModeCommon *modeCommon)
|
bool cTWCmdLineUtil::SendEmailTestMessage(const TSTRING &mAddress, const cTWModeCommon *modeCommon)
|
||||||
{
|
{
|
||||||
std::auto_ptr<cMailMessage> reportMail;
|
TW_UNIQUE_PTR<cMailMessage> reportMail;
|
||||||
|
|
||||||
// allocate the right kind of emailer object based on what came out of the config file.
|
// allocate the right kind of emailer object based on what came out of the config file.
|
||||||
switch (modeCommon->mMailMethod)
|
switch (modeCommon->mMailMethod)
|
||||||
|
@ -694,10 +694,10 @@ bool cTWCmdLineUtil::SendEmailTestMessage(const TSTRING &mAddress, const cTWMode
|
||||||
ASSERT(false);
|
ASSERT(false);
|
||||||
return false;
|
return false;
|
||||||
case cMailMessage::MAIL_BY_SMTP:
|
case cMailMessage::MAIL_BY_SMTP:
|
||||||
reportMail = std::auto_ptr<cMailMessage>(new cSMTPMailMessage(modeCommon->mSmtpHost, modeCommon->mSmtpPort));
|
reportMail = TW_UNIQUE_PTR<cMailMessage>(new cSMTPMailMessage(modeCommon->mSmtpHost, modeCommon->mSmtpPort));
|
||||||
break;
|
break;
|
||||||
case cMailMessage::MAIL_BY_PIPE:
|
case cMailMessage::MAIL_BY_PIPE:
|
||||||
reportMail = std::auto_ptr<cMailMessage>(new cPipedMailMessage(modeCommon->mMailProgram));
|
reportMail = TW_UNIQUE_PTR<cMailMessage>(new cPipedMailMessage(modeCommon->mMailProgram));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -293,6 +293,11 @@ bool cConfigFile::Lookup( const TSTRING& sKey, TSTRING& sVal ) const
|
||||||
return( fFound );
|
return( fFound );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cConfigFile::Insert( const TSTRING& sKey, const TSTRING& sVal )
|
||||||
|
{
|
||||||
|
mStringHashTable.Insert(sKey, sVal);
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// GetFileHeaderID()
|
// GetFileHeaderID()
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -107,6 +107,10 @@ public:
|
||||||
|
|
||||||
bool Lookup( const TSTRING& tstrKey, TSTRING& tstrVal ) const;
|
bool Lookup( const TSTRING& tstrKey, TSTRING& tstrVal ) const;
|
||||||
// returns true if key is found in internal container and returns its value in tstrVal.
|
// returns true if key is found in internal container and returns its value in tstrVal.
|
||||||
|
|
||||||
|
void Insert( const TSTRING& tstrKey, const TSTRING& tstrVal );
|
||||||
|
// add key+value to config data. visible for unit testing.
|
||||||
|
|
||||||
void WriteString( TSTRING& configText );
|
void WriteString( TSTRING& configText );
|
||||||
// writes all key/value pairs from internal container to filename as "name=value\n"
|
// writes all key/value pairs from internal container to filename as "name=value\n"
|
||||||
void ReadString( const TSTRING configText ); // throw( eConfigFile );
|
void ReadString( const TSTRING configText ); // throw( eConfigFile );
|
||||||
|
@ -140,7 +144,7 @@ private:
|
||||||
class cConfigFileIter
|
class cConfigFileIter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
cConfigFileIter( cConfigFile& cf);
|
explicit cConfigFileIter( cConfigFile& cf);
|
||||||
virtual ~cConfigFileIter();
|
virtual ~cConfigFileIter();
|
||||||
|
|
||||||
void SeekBegin() const;
|
void SeekBegin() const;
|
||||||
|
|
|
@ -98,7 +98,7 @@ public:
|
||||||
|
|
||||||
// Ctor, Dtor:
|
// Ctor, Dtor:
|
||||||
~cDebugHierDbIter () {}
|
~cDebugHierDbIter () {}
|
||||||
cDebugHierDbIter ( cHierDatabase* pDb ) : cHierDatabaseIter( pDb ) {}
|
explicit cDebugHierDbIter ( cHierDatabase* pDb ) : cHierDatabaseIter( pDb ) {}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Methods for obtaining protected members of cHierDatabaseIter:
|
// Methods for obtaining protected members of cHierDatabaseIter:
|
||||||
|
|
|
@ -179,7 +179,7 @@ static void SplitString( const TSTRING& str, TCHAR c, std::vector<TSTRING>& vStr
|
||||||
vStrings.clear();
|
vStrings.clear();
|
||||||
|
|
||||||
TSTRING::const_iterator i, prev;
|
TSTRING::const_iterator i, prev;
|
||||||
for( prev = i = str.begin(); i != str.end(); i++ )
|
for( prev = i = str.begin(); i != str.end(); ++i )
|
||||||
{
|
{
|
||||||
if( *i == c )
|
if( *i == c )
|
||||||
{
|
{
|
||||||
|
@ -284,7 +284,7 @@ void cDbExplore::Execute( cFCODatabaseFileIter& dbIter )
|
||||||
GetNoun(noun);
|
GetNoun(noun);
|
||||||
std::vector<TSTRING> vDirs;
|
std::vector<TSTRING> vDirs;
|
||||||
SplitString( noun, pIter->GetParentName().GetDelimiter(), vDirs );
|
SplitString( noun, pIter->GetParentName().GetDelimiter(), vDirs );
|
||||||
for( std::vector<TSTRING>::iterator i = vDirs.begin(); i != vDirs.end(); i++ )
|
for( std::vector<TSTRING>::iterator i = vDirs.begin(); i != vDirs.end(); ++i )
|
||||||
{
|
{
|
||||||
|
|
||||||
if( i->compare( _T("..") ) == 0 )
|
if( i->compare( _T("..") ) == 0 )
|
||||||
|
|
|
@ -72,7 +72,7 @@ cFCODatabaseFile::cFCODatabaseFile()
|
||||||
|
|
||||||
cFCODatabaseFile::~cFCODatabaseFile()
|
cFCODatabaseFile::~cFCODatabaseFile()
|
||||||
{
|
{
|
||||||
for( DbList::iterator i = mDbList.begin(); i != mDbList.end(); i++ )
|
for( DbList::iterator i = mDbList.begin(); i != mDbList.end(); ++i )
|
||||||
{
|
{
|
||||||
delete *i;
|
delete *i;
|
||||||
}
|
}
|
||||||
|
@ -152,7 +152,7 @@ void cFCODatabaseFile::Write(iSerializer* pSerializer) const //throw( eFCODbFile
|
||||||
//
|
//
|
||||||
// TODO -- the database is not really const-correct; therefore I have the sick casts below...
|
// TODO -- the database is not really const-correct; therefore I have the sick casts below...
|
||||||
//
|
//
|
||||||
for( DbList::iterator i = const_cast<DbList*>(&mDbList)->begin(); i != const_cast<DbList*>(&mDbList)->end(); i++ )
|
for( DbList::iterator i = const_cast<DbList*>(&mDbList)->begin(); i != const_cast<DbList*>(&mDbList)->end(); ++i )
|
||||||
{
|
{
|
||||||
pSerializer->WriteInt32 ( (*i)->mGenre );
|
pSerializer->WriteInt32 ( (*i)->mGenre );
|
||||||
pSerializer->WriteObject ( &(*i)->mGenreHeader );
|
pSerializer->WriteObject ( &(*i)->mGenreHeader );
|
||||||
|
@ -193,7 +193,7 @@ void cFCODatabaseFile::AddGenre( cGenre::Genre genreId, cFCODatabaseFileIter* pI
|
||||||
//
|
//
|
||||||
// first, lets make sure this genre doesn't exist...
|
// first, lets make sure this genre doesn't exist...
|
||||||
//
|
//
|
||||||
for( DbList::iterator i = mDbList.begin(); i != mDbList.end(); i++ )
|
for( DbList::iterator i = mDbList.begin(); i != mDbList.end(); ++i )
|
||||||
{
|
{
|
||||||
if( (*i)->mGenre == genreId )
|
if( (*i)->mGenre == genreId )
|
||||||
{
|
{
|
||||||
|
@ -254,7 +254,7 @@ void cFCODatabaseFileIter::SeekBegin()
|
||||||
|
|
||||||
void cFCODatabaseFileIter::Next()
|
void cFCODatabaseFileIter::Next()
|
||||||
{
|
{
|
||||||
mIter++;
|
++mIter;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cFCODatabaseFileIter::Done() const
|
bool cFCODatabaseFileIter::Done() const
|
||||||
|
|
|
@ -112,7 +112,7 @@ public:
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
struct tEntry
|
struct tEntry
|
||||||
{
|
{
|
||||||
tEntry( cGenre::Genre genre );
|
explicit tEntry( cGenre::Genre genre );
|
||||||
// the ctor will get the appropriate database construction parameters
|
// the ctor will get the appropriate database construction parameters
|
||||||
// based on the genre number.
|
// based on the genre number.
|
||||||
~tEntry( )
|
~tEntry( )
|
||||||
|
@ -146,7 +146,7 @@ private:
|
||||||
class cFCODatabaseFileIter
|
class cFCODatabaseFileIter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
cFCODatabaseFileIter( cFCODatabaseFile& dbFile );
|
explicit cFCODatabaseFileIter( cFCODatabaseFile& dbFile );
|
||||||
|
|
||||||
void SeekBegin();
|
void SeekBegin();
|
||||||
void Next();
|
void Next();
|
||||||
|
|
|
@ -239,10 +239,12 @@ cFCOReportGenreIter::~cFCOReportGenreIter()
|
||||||
delete mpData;
|
delete mpData;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cFCOReportGenreIter::operator=(const cFCOReportGenreIter& rhs)
|
cFCOReportGenreIter& cFCOReportGenreIter::operator=(const cFCOReportGenreIter& rhs)
|
||||||
{
|
{
|
||||||
mpData->mpList = rhs.mpData->mpList;
|
mpData->mpList = rhs.mpData->mpList;
|
||||||
mpData->mIter = rhs.mpData->mIter;
|
mpData->mIter = rhs.mpData->mIter;
|
||||||
|
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
// iteration methods
|
// iteration methods
|
||||||
|
@ -380,13 +382,15 @@ cFCOReportSpecIter::cFCOReportSpecIter(const cFCOReportSpecIter& rhs)
|
||||||
*this = rhs;
|
*this = rhs;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cFCOReportSpecIter::operator=(const cFCOReportSpecIter& rhs)
|
cFCOReportSpecIter& cFCOReportSpecIter::operator=(const cFCOReportSpecIter& rhs)
|
||||||
{
|
{
|
||||||
if (mpData == 0)
|
if (mpData == 0)
|
||||||
mpData = new cFCOReportSpecIter_i();
|
mpData = new cFCOReportSpecIter_i();
|
||||||
|
|
||||||
mpData->mpList = rhs.mpData->mpList;
|
mpData->mpList = rhs.mpData->mpList;
|
||||||
mpData->mIter = rhs.mpData->mIter;
|
mpData->mIter = rhs.mpData->mIter;
|
||||||
|
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
int cFCOReportSpecIter::GetNumChanged() const
|
int cFCOReportSpecIter::GetNumChanged() const
|
||||||
|
@ -429,7 +433,7 @@ void cFCOReportSpecIter::SeekBegin() const
|
||||||
void cFCOReportSpecIter::Next() const
|
void cFCOReportSpecIter::Next() const
|
||||||
{
|
{
|
||||||
ASSERT(mpData != 0);
|
ASSERT(mpData != 0);
|
||||||
mpData->mIter++;
|
++(mpData->mIter);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cFCOReportSpecIter::Done() const
|
bool cFCOReportSpecIter::Done() const
|
||||||
|
@ -446,7 +450,7 @@ const iFCOSpec* cFCOReportSpecIter::GetSpec() const
|
||||||
bool cFCOReportSpecIter::SeekToSpec(const iFCOSpec* pSpec)
|
bool cFCOReportSpecIter::SeekToSpec(const iFCOSpec* pSpec)
|
||||||
{
|
{
|
||||||
if (mpData)
|
if (mpData)
|
||||||
for(mpData->mIter = mpData->mpList->begin(); mpData->mIter != mpData->mpList->end(); mpData->mIter++)
|
for(mpData->mIter = mpData->mpList->begin(); mpData->mIter != mpData->mpList->end(); ++(mpData->mIter))
|
||||||
{
|
{
|
||||||
if(iFCOSpecUtil::FCOSpecEqual(*mpData->mIter->mpSpec, *pSpec))
|
if(iFCOSpecUtil::FCOSpecEqual(*mpData->mIter->mpSpec, *pSpec))
|
||||||
return true;
|
return true;
|
||||||
|
@ -525,10 +529,12 @@ cFCOReportChangeIter::~cFCOReportChangeIter()
|
||||||
delete mpData;
|
delete mpData;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cFCOReportChangeIter::operator=(const cFCOReportChangeIter& rhs)
|
cFCOReportChangeIter& cFCOReportChangeIter::operator=(const cFCOReportChangeIter& rhs)
|
||||||
{
|
{
|
||||||
mpData->mpList = rhs.mpData->mpList;
|
mpData->mpList = rhs.mpData->mpList;
|
||||||
mpData->mIter = rhs.mpData->mIter;
|
mpData->mIter = rhs.mpData->mIter;
|
||||||
|
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cFCOReportChangeIter::SetSpecIter(const cFCOReportSpecIter& specIter)
|
void cFCOReportChangeIter::SetSpecIter(const cFCOReportSpecIter& specIter)
|
||||||
|
@ -557,7 +563,7 @@ void cFCOReportChangeIter::SeekBegin() const
|
||||||
void cFCOReportChangeIter::Next() const
|
void cFCOReportChangeIter::Next() const
|
||||||
{
|
{
|
||||||
ASSERT(mpData->mpList != 0);
|
ASSERT(mpData->mpList != 0);
|
||||||
mpData->mIter++;
|
++(mpData->mIter);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cFCOReportChangeIter::Done() const
|
bool cFCOReportChangeIter::Done() const
|
||||||
|
@ -701,7 +707,7 @@ void cFCOReport::AddSpec(cGenre::Genre genre, const iFCOSpec* pSpec, const cFCOS
|
||||||
if (pIter && pIter->mpData && pIter->mpData->mpList == &genreIter->mSpecList)
|
if (pIter && pIter->mpData && pIter->mpData->mpList == &genreIter->mSpecList)
|
||||||
{
|
{
|
||||||
pIter->mpData->mIter = genreIter->mSpecList.end();
|
pIter->mpData->mIter = genreIter->mSpecList.end();
|
||||||
pIter->mpData->mIter--;
|
--(pIter->mpData->mIter);
|
||||||
ASSERT(pIter->GetSpec() == node.mpSpec);
|
ASSERT(pIter->GetSpec() == node.mpSpec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,7 +147,7 @@ public:
|
||||||
cFCOReportGenreIter(const cFCOReportGenreIter& rhs);
|
cFCOReportGenreIter(const cFCOReportGenreIter& rhs);
|
||||||
~cFCOReportGenreIter();
|
~cFCOReportGenreIter();
|
||||||
|
|
||||||
void operator=(const cFCOReportGenreIter& rhs);
|
cFCOReportGenreIter& operator=(const cFCOReportGenreIter& rhs);
|
||||||
|
|
||||||
// iteration methods
|
// iteration methods
|
||||||
void SeekBegin() const;
|
void SeekBegin() const;
|
||||||
|
@ -179,13 +179,13 @@ public:
|
||||||
cFCOReportSpecIter(cFCOReport& report, cGenre::Genre genre);
|
cFCOReportSpecIter(cFCOReport& report, cGenre::Genre genre);
|
||||||
// if genre does not exist in the report, it will be added to the report with
|
// if genre does not exist in the report, it will be added to the report with
|
||||||
// and empty spec list.
|
// and empty spec list.
|
||||||
cFCOReportSpecIter(const cFCOReportGenreIter& genreIter);
|
explicit cFCOReportSpecIter(const cFCOReportGenreIter& genreIter);
|
||||||
// thorws eInternal if genreIter is not at a valid genre or is Done()
|
// thorws eInternal if genreIter is not at a valid genre or is Done()
|
||||||
|
|
||||||
cFCOReportSpecIter(const cFCOReportSpecIter& rhs);
|
cFCOReportSpecIter(const cFCOReportSpecIter& rhs);
|
||||||
~cFCOReportSpecIter();
|
~cFCOReportSpecIter();
|
||||||
|
|
||||||
void operator=(const cFCOReportSpecIter& rhs);
|
cFCOReportSpecIter& operator=(const cFCOReportSpecIter& rhs);
|
||||||
|
|
||||||
// iteration methods
|
// iteration methods
|
||||||
void SeekBegin() const;
|
void SeekBegin() const;
|
||||||
|
@ -226,11 +226,11 @@ private:
|
||||||
class cFCOReportChangeIter
|
class cFCOReportChangeIter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
cFCOReportChangeIter(const cFCOReportSpecIter& specIter);
|
explicit cFCOReportChangeIter(const cFCOReportSpecIter& specIter);
|
||||||
cFCOReportChangeIter(const cFCOReportChangeIter& rhs);
|
cFCOReportChangeIter(const cFCOReportChangeIter& rhs);
|
||||||
~cFCOReportChangeIter();
|
~cFCOReportChangeIter();
|
||||||
|
|
||||||
void operator=(const cFCOReportChangeIter& rhs);
|
cFCOReportChangeIter& operator=(const cFCOReportChangeIter& rhs);
|
||||||
void SetSpecIter(const cFCOReportSpecIter& specIter);
|
void SetSpecIter(const cFCOReportSpecIter& specIter);
|
||||||
// assocaite this iterator with a different spec. We will assert
|
// assocaite this iterator with a different spec. We will assert
|
||||||
// that specIter.Done() is not true.
|
// that specIter.Done() is not true.
|
||||||
|
|
|
@ -61,7 +61,8 @@ cFileManipulator::cFileManipulator(const TCHAR* filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
cFileManipulator::cFileManipulator(const cFileManipulator& rhs)
|
cFileManipulator::cFileManipulator(const cFileManipulator& rhs)
|
||||||
: mFileName(rhs.mFileName),
|
: mbInit(false),
|
||||||
|
mFileName(rhs.mFileName),
|
||||||
mFileHeader(rhs.mFileHeader)
|
mFileHeader(rhs.mFileHeader)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,7 @@ TSS_FILE_EXCEPTION( eFileManipUnrecognizedFileType, eFileManip )
|
||||||
class cFileManipulator
|
class cFileManipulator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
cFileManipulator(const TCHAR* filename);
|
explicit cFileManipulator(const TCHAR* filename);
|
||||||
// throws eArchive if file does not exist
|
// throws eArchive if file does not exist
|
||||||
cFileManipulator(const cFileManipulator& rhs);
|
cFileManipulator(const cFileManipulator& rhs);
|
||||||
~cFileManipulator();
|
~cFileManipulator();
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue