diff --git a/Makefile.in b/Makefile.in index 3bb6176..c0b3364 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.15.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2017 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -307,7 +307,6 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -547,7 +546,7 @@ distdir: $(DISTFILES) ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz $(am__post_remove_distdir) dist-bzip2: distdir @@ -573,7 +572,7 @@ dist-shar: distdir @echo WARNING: "Support for shar distribution archives is" \ "deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 - shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz $(am__post_remove_distdir) dist-zip: distdir @@ -591,7 +590,7 @@ dist dist-all: distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ - GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ + eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lz*) \ @@ -601,7 +600,7 @@ distcheck: dist *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ - GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ + eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac diff --git a/configure b/configure index 352f5e4..ea08168 100755 --- a/configure +++ b/configure @@ -724,7 +724,6 @@ infodir docdir oldincludedir includedir -runstatedir localstatedir sharedstatedir sysconfdir @@ -810,7 +809,6 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' -runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -1063,15 +1061,6 @@ do | -silent | --silent | --silen | --sile | --sil) silent=yes ;; - -runstatedir | --runstatedir | --runstatedi | --runstated \ - | --runstate | --runstat | --runsta | --runst | --runs \ - | --run | --ru | --r) - ac_prev=runstatedir ;; - -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ - | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ - | --run=* | --ru=* | --r=*) - runstatedir=$ac_optarg ;; - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1209,7 +1198,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir runstatedir + libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1362,7 +1351,6 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -3462,6 +3450,10 @@ fi 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"} diff --git a/man/Makefile.in b/man/Makefile.in index 9cf2615..2218a28 100644 --- a/man/Makefile.in +++ b/man/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.15.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2017 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -284,7 +284,6 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ diff --git a/man/man4/Makefile.in b/man/man4/Makefile.in index 01437ef..dbd0c2d 100644 --- a/man/man4/Makefile.in +++ b/man/man4/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.15.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2017 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -256,7 +256,6 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ diff --git a/man/man5/Makefile.in b/man/man5/Makefile.in index 9bb9a4d..2d8dd98 100644 --- a/man/man5/Makefile.in +++ b/man/man5/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.15.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2017 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -256,7 +256,6 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ diff --git a/man/man8/Makefile.in b/man/man8/Makefile.in index 9341d22..d6e21b4 100644 --- a/man/man8/Makefile.in +++ b/man/man8/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.15.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2017 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -256,7 +256,6 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ diff --git a/src/Makefile.in b/src/Makefile.in index 7769907..f0fb88f 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.15.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2017 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -282,7 +282,6 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ diff --git a/src/core/Makefile.in b/src/core/Makefile.in index c013c55..858721f 100644 --- a/src/core/Makefile.in +++ b/src/core/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.15.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2017 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -313,7 +313,6 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ diff --git a/src/cryptlib/Makefile.in b/src/cryptlib/Makefile.in index 84de4fb..5306cab 100644 --- a/src/cryptlib/Makefile.in +++ b/src/cryptlib/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.15.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2017 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -303,7 +303,6 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ diff --git a/src/db/Makefile.in b/src/db/Makefile.in index f80ab34..53ef6f8 100644 --- a/src/db/Makefile.in +++ b/src/db/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.15.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2017 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -300,7 +300,6 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ diff --git a/src/fco/Makefile.in b/src/fco/Makefile.in index cb15522..84b5a63 100644 --- a/src/fco/Makefile.in +++ b/src/fco/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.15.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2017 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -308,7 +308,6 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ diff --git a/src/fco/fcopropvector.cpp.old b/src/fco/fcopropvector.cpp.old new file mode 100644 index 0000000..ed26099 --- /dev/null +++ b/src/fco/fcopropvector.cpp.old @@ -0,0 +1,484 @@ +/// +// The developer of the original code and/or files is Tripwire, Inc. +// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 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. +// +/////////////////////////////////////////////////////////////////////////////// +// fcopropvector.cpp +// + +#include "stdfco.h" +#include "fcopropvector.h" +#include "core/serializer.h" +#include "core/debug.h" +#include "core/errorutil.h" + +int cFCOPropVector::msBitlength(sizeof (uint32) * 8); + //msBitlength is common to all objects of class. + +/////////////////////////////////////////////////////////////////////////////// +// Constructor -- Sets mSize. Default = 32. +/////////////////////////////////////////////////////////////////////////////// +cFCOPropVector::cFCOPropVector(int size) : iSerializable() +{ + mSize = 32; + mMask = 0; + mpBuf = NULL; + SetSize(size); +} + +/////////////////////////////////////////////////////////////////////////////// +// Destructor -- +/////////////////////////////////////////////////////////////////////////////// +cFCOPropVector::~cFCOPropVector() +{ + if (mpBuf!=NULL) + delete mpBuf; +} + +/////////////////////////////////////////////////////////////////////////////// +// Copy Constructor +/////////////////////////////////////////////////////////////////////////////// +cFCOPropVector::cFCOPropVector(const cFCOPropVector &rhs) : iSerializable() +{ + mSize = rhs.mSize; + mMask = rhs.mMask; + if (rhs.mpBuf != NULL) { + mpBuf = new std::vector; + *mpBuf = *(rhs.mpBuf); + } + else mpBuf = NULL; +} + +/////////////////////////////////////////////////////////////////////////////// +// Overloaded Operators: ==, !=, = , &, |, &=, |= +/////////////////////////////////////////////////////////////////////////////// +bool cFCOPropVector::operator==(const cFCOPropVector& rhs) const +{ + if (this != &rhs) { + if ((mpBuf == NULL) && (rhs.mpBuf==NULL)) + { + printf(" case 1\n"); + return (mMask == rhs.mMask); + } + else if((mpBuf == NULL) && (rhs.mpBuf!=NULL)) + { + if (rhs.isExtended()) { + printf(" case 2\n"); + return false; + } else { + printf(" case 3\n"); + return (mMask == ((*rhs.mpBuf)[0])); + } + } + else if ((mpBuf != NULL) && (rhs.mpBuf == NULL)) + { + if ((*this).isExtended()) { + printf(" case 4\n"); + return false; + } else { + printf(" case 5\n"); + return (((*mpBuf)[0])==rhs.mMask); + } + } + else { + printf(" case 6\n"); + return (*mpBuf == *(rhs.mpBuf)); + } + } + else { + printf(" case 7\n"); + return true; + } +} + +bool cFCOPropVector::operator!=(const cFCOPropVector& rhs) const +{ + return (! (*this == rhs)); +} + + + +cFCOPropVector& cFCOPropVector::operator=(const cFCOPropVector& rhs) +{ + if (this != &rhs) + { + if ((rhs.mpBuf!=NULL) && (mpBuf!=NULL)) + *mpBuf= *(rhs.mpBuf); + else if ((rhs.mpBuf!=NULL) && (mpBuf==NULL)) + { + mpBuf = new std::vector; + *mpBuf = *(rhs.mpBuf); + } + else if((rhs.mpBuf==NULL) && (mpBuf!=NULL)) + { + delete mpBuf; + mpBuf = NULL; + } + mSize = rhs.mSize; + mMask = rhs.mMask; + }//end if + return *this; +} + +cFCOPropVector cFCOPropVector::operator&(const cFCOPropVector& rhs) const +{ + cFCOPropVector temp = *this; + temp &= rhs; + return temp; +} + +cFCOPropVector cFCOPropVector::operator|(const cFCOPropVector& rhs) const +{ + cFCOPropVector temp = *this; + temp |= rhs; + return temp; +} + +cFCOPropVector cFCOPropVector::operator^(const cFCOPropVector& rhs) const +{ + cFCOPropVector temp = *this; + temp ^= rhs; + return temp; +} + + +cFCOPropVector& cFCOPropVector::operator&=(const cFCOPropVector& rhs) +{ + // make sure I am big enough + if(GetSize() < rhs.GetSize()) + SetSize(rhs.GetSize()); + if(mpBuf == 0) + { + ASSERT(GetSize() <= 32); + mMask &= rhs.mMask; + } + else if (rhs.mpBuf == 0) + { + ASSERT(rhs.GetSize() <= 32); + (*mpBuf)[0] &= rhs.mMask; + } + else + { + for(unsigned int i=0; i < rhs.mpBuf->size(); ++i) + (*mpBuf)[i] &= (*rhs.mpBuf)[i]; + } + return *this; +} + +cFCOPropVector& cFCOPropVector::operator|=(const cFCOPropVector& rhs) +{ + // make sure I am big enough + if(GetSize() < rhs.GetSize()) + SetSize(rhs.GetSize()); + if(mpBuf == 0) + { + ASSERT(GetSize() <= 32); + mMask |= rhs.mMask; + } + else if (rhs.mpBuf == 0) + { + ASSERT(rhs.GetSize() <= 32); + (*mpBuf)[0] |= rhs.mMask; + } + else + { + for(unsigned int i=0; i < rhs.mpBuf->size(); ++i) + (*mpBuf)[i] |= (*rhs.mpBuf)[i]; + } + return *this; +} + +cFCOPropVector& cFCOPropVector::operator^=(const cFCOPropVector& rhs) +{ + // make sure I am big enough + if(GetSize() < rhs.GetSize()) + SetSize(rhs.GetSize()); + if(mpBuf == 0) + { + ASSERT(GetSize() <= 32); + mMask ^= rhs.mMask; + } + else if (rhs.mpBuf == 0) + { + ASSERT(rhs.GetSize() <= 32); + (*mpBuf)[0] ^= rhs.mMask; + } + else + { + for(unsigned int i=0; i < rhs.mpBuf->size(); ++i) + (*mpBuf)[i] ^= (*rhs.mpBuf)[i]; + } + return *this; +} + + + +//END OPERATORS + +/////////////////////////////////////////////////////////////////////////////// +// GetSize -- returns the number of items the vector can hold +/////////////////////////////////////////////////////////////////////////////// +int cFCOPropVector::GetSize(void) const +{ + return mSize; +} + +/////////////////////////////////////////////////////////////////////////////// +// SetSize -- Sets the maximum NUMBER of items that can be stored +// in vector. **IMPORTANT** : If max is less than current size of mask+buff, +// the set is truncated and extra information is lost. +/////////////////////////////////////////////////////////////////////////////// +int cFCOPropVector::SetSize(int max) +{ + if ((max <= msBitlength) && (mpBuf == NULL)) + return mSize = msBitlength; + else if ((max <= msBitlength) && (mpBuf != NULL)) + { + return mSize = (*mpBuf).capacity()*msBitlength; + //new operation already performed, stick with mpBuf. + } + else if ((mpBuf == NULL) && (max > msBitlength)) + { + mpBuf = new std::vector; + (*mpBuf).resize (((max/msBitlength)+1), 0); + (*mpBuf)[0] = mMask; + return mSize = ((*mpBuf).capacity() * msBitlength); + } + else //mpBuf!=NULL && max>msBitlength + { + if (mpBuf) + { + (*mpBuf).resize (((max/msBitlength)+1), 0); + mSize = ((*mpBuf).capacity() * msBitlength); + } + return mSize; + } +} + +/////////////////////////////////////////////////////////////////////////////// +// AddItem -- Adds an item to the bitset by 'anding' it on. Behavior is +// undefined if i >= GetSize. Returns true if set contains item after change. +/////////////////////////////////////////////////////////////////////////////// +bool cFCOPropVector::AddItem(int i) +{ + ASSERT(i < GetSize()); + + if (mpBuf == NULL) + { + ASSERT(mSize <= 32); + mMask |= 1<<(i); + } + else + { + ((*mpBuf)[(i)/msBitlength]) |= 1<<((i) % msBitlength); + } + return ContainsItem(i); +} + + +/////////////////////////////////////////////////////////////////////////////// +// AddItemAndGrow -- Like AddItem except that if i >= GetSize, resizes vector. +// Returns true if set contains item after change. +/////////////////////////////////////////////////////////////////////////////// +bool cFCOPropVector::AddItemAndGrow(int i) +{ + if(i >= GetSize()) + SetSize( i ); + + return AddItem( i ); +} + +/////////////////////////////////////////////////////////////////////////////// +// RemoveItem -- Removes an item from the vector. Vector is unchanged if +// i >= GetMaxItem. Returns true if set does not contain item after change. +/////////////////////////////////////////////////////////////////////////////// +bool cFCOPropVector::RemoveItem(int i) +{ + ASSERT(i < GetSize()); + + if (!ContainsItem(i)) + return true; + if (mpBuf == NULL) + mMask ^= 1<<(i); + else + { + ((*mpBuf)[(i)/msBitlength]) ^= 1<<((i) % msBitlength); + } + return !ContainsItem(i); +} + +/////////////////////////////////////////////////////////////////////////////// +// ContainsItem -- Returns boolean value if bit value is in the vector. +// Fails if mMask+mBuf is < i. +/////////////////////////////////////////////////////////////////////////////// +bool cFCOPropVector::ContainsItem(int i) const +{ + if (i > mSize-1) + return false; + else if (mpBuf == NULL) + { + return ((mMask & (1<<(i))) != 0); + } + else + { + return ((((*mpBuf)[(i)/msBitlength]) & (1<<((i) % msBitlength))) != 0); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// Clear -- removes all items from the vector +/////////////////////////////////////////////////////////////////////////////// +void cFCOPropVector::Clear(void) +{ + mMask = 0; + if(mpBuf) + { + std::fill(mpBuf->begin(), mpBuf->end(), 0); + } +} + + +/////////////////////////////////////////////////////////////////////////////// +// isExtended -- Returns true if Vector is USING mpBuf beyond [0]. It +// is assumed that {mpBuf [i] |i>0} is being used if i has non-zero value. +/////////////////////////////////////////////////////////////////////////////// +bool cFCOPropVector::isExtended(void) const +{ + if (mpBuf == NULL) { + printf(" isExtended: mpBuf is null\n"); + return false; + }else + { + if ((*mpBuf).size() <= 1) { + printf(" mpBuf size is <= 1 (it's %d)\n", (*mpBuf).size()); + return false; + } else + { + uint32 sum = 0; + for (uint32 i =(*mpBuf).size()-1; i >= 2; i--) + { + printf(" pre: sum = %u, i = %u, mpBuf[i] = %u\n", sum, i, (*mpBuf)[i]); + sum += ((*mpBuf)[i]); + printf(" post: sum = %u, i = %u, mpBuf[i] = %u\n", sum, i, (*mpBuf)[i]); + } + printf(" mpBuf size is %u and sum = %u\n", (*mpBuf).size(), sum); + return (sum != 0); + } + } +} + + +// TO DO: temp function, will delete after testing... DA +void cFCOPropVector::check (cDebug& d) const +{ + d.TraceDetail("mSize = %i \n", mSize); + d.TraceDetail("msBitlength = %i \n", msBitlength); + d.TraceDetail("mMask = %u \n", mMask); + if (mpBuf!=NULL) { + d.TraceDetail("*mpBuf has size %i \n", (*mpBuf).size() ); + for (unsigned int i = 0; i<(*mpBuf).size(); ++i) + d.TraceDetail("mpBuf element %i = %u \n", i, (*mpBuf)[i] ); + } +}//end check + + +void cFCOPropVector::Read(iSerializer* pSerializer, int32 version) +{ + if (version > 0) + ThrowAndAssert(eSerializerVersionMismatch(_T("Property Vector Read"))); + + int32 newSize; + pSerializer->ReadInt32(newSize); + ASSERT(newSize > 0); + + SetSize(newSize); + + if (mpBuf == NULL) + { + int32 mask; + pSerializer->ReadInt32(mask); + mMask = mask; + } + else + { + for (int i=0; i <= mSize / msBitlength; ++i) + { + int32 mask; + pSerializer->ReadInt32(mask); + (*mpBuf)[i] = mask; + } + } + +} + +void cFCOPropVector::Write(iSerializer* pSerializer) const +{ + pSerializer->WriteInt32(mSize); + + if (mpBuf == NULL) + { + pSerializer->WriteInt32(mMask); + } + else + { + for (int i=0; i <= mSize / msBitlength; ++i) + pSerializer->WriteInt32((*mpBuf)[i]); + } + +} + + +/////////////////////////////////////////////////////////////////////////////// +// TraceContents -- prints the contents of the vector to debug out +/////////////////////////////////////////////////////////////////////////////// +void cFCOPropVector::TraceContents(int dl) const +{ + if(dl < 0) + dl = cDebug::D_DEBUG; + + cDebug d("cFCOPropVector::TraceContents"); + TOSTRINGSTREAM ostr; + for(int i=0; i