Additional build fixes: Warning fixes from FreeBSD ports patch set, plus platform-specific build fixes for OpenBSD, Minix, Hurd, Syllable, (possibly) Android.
This commit is contained in:
parent
886cadcf33
commit
261cef1392
|
@ -85,6 +85,8 @@ TSS_EXCEPTION( eArchiveStringTooLong, eArchive );
|
|||
class cArchive
|
||||
{
|
||||
public:
|
||||
virtual ~cArchive() {}
|
||||
|
||||
// convenience methods
|
||||
//
|
||||
// Specific Read functions throw(eArchive) if EOF is reached because
|
||||
|
|
|
@ -112,7 +112,7 @@ typedef int64 cFSType;
|
|||
// it is the union of MAX(elem) for all the file systems that we support
|
||||
class cACLElem {
|
||||
// TODO this is just a place holder
|
||||
uint32 mUid;
|
||||
// uint32 mUid;
|
||||
};
|
||||
|
||||
// this class is used only to pass arguments to iFSServices
|
||||
|
@ -177,7 +177,7 @@ TSS_FILE_EXCEPTION( eFSServicesGeneric, eFSServices );
|
|||
class iFSServices
|
||||
{
|
||||
public:
|
||||
|
||||
virtual ~iFSServices() {}
|
||||
///////////////////////////////////////////////////////////////
|
||||
// ENUMS
|
||||
///////////////////////////////////////////////////////////////
|
||||
|
@ -203,7 +203,11 @@ class iFSServices
|
|||
enum
|
||||
{
|
||||
#if IS_UNIX
|
||||
TW_MAX_PATH = MAXPATHLEN
|
||||
#ifdef MAXPATHLEN
|
||||
TW_MAX_PATH = MAXPATHLEN
|
||||
#else
|
||||
TW_MAX_PATH = 1024
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -217,9 +221,9 @@ class iFSServices
|
|||
////////////////////////////////////////
|
||||
virtual bool IsCaseSensitive() const = 0;
|
||||
// returns true if the file system is case sensitive
|
||||
virtual TCHAR GetPathSeperator() const = 0;
|
||||
virtual TCHAR GetPathSeparator() const = 0;
|
||||
// returns "/" for unix and "\\" for win32
|
||||
virtual TCHAR* GetStandardBackupExtension() const = 0;
|
||||
virtual const TCHAR* GetStandardBackupExtension() const = 0;
|
||||
// returns normal string to append to backup files for this os.
|
||||
|
||||
////////////////////////////////////////
|
||||
|
@ -239,7 +243,7 @@ class iFSServices
|
|||
|
||||
virtual void SetTempDirName( TSTRING& tmpName ) = 0;
|
||||
|
||||
virtual TSTRING& MakeTempFilename( TSTRING& strName ) const throw( eFSServices ) = 0;
|
||||
virtual TSTRING& MakeTempFilename( TSTRING& strName ) const throw( eFSServices ) = 0;
|
||||
// create temporary file
|
||||
// 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.
|
||||
|
@ -258,15 +262,15 @@ class iFSServices
|
|||
////////////////////////////////////////
|
||||
// minor filesystem functions
|
||||
////////////////////////////////////////
|
||||
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 GetMachineNameFullyQualified( TSTRING& name ) const = 0;
|
||||
|
||||
virtual bool GetCurrentUserName( TSTRING& tstrName ) const = 0;
|
||||
virtual bool GetCurrentUserName( TSTRING& tstrName ) const = 0;
|
||||
|
||||
virtual bool GetIPAddress( uint32& uiIPAddress ) = 0;
|
||||
virtual bool GetIPAddress( uint32& uiIPAddress ) = 0;
|
||||
|
||||
|
||||
////////////////////////////////////////
|
||||
|
|
|
@ -144,6 +144,12 @@
|
|||
# define MAX_DESC 256
|
||||
#endif
|
||||
|
||||
#ifdef NOFILE
|
||||
# define TW_NO_DESC NOFILE
|
||||
#else
|
||||
# define TW_NO_DESC MAX_DESC+1
|
||||
#endif
|
||||
|
||||
/*
|
||||
* in case the subprocess fails to exec the command properly
|
||||
*/
|
||||
|
@ -919,7 +925,7 @@ int mask;
|
|||
(void) umask(mask);
|
||||
/* close the unused ends of the pipe */
|
||||
/* and all other files except 0, 1, 2 */
|
||||
for(i = 3; i < NOFILE; i++)
|
||||
for(i = 3; i < TW_NO_DESC; i++)
|
||||
if (fp == NULL || (!fdleave[i] && i != p[0][0]
|
||||
&& i != p[1][1] && i != p[2][1]))
|
||||
(void) close(i);
|
||||
|
|
|
@ -114,7 +114,11 @@ int echild();
|
|||
# define GID_RESET -2 /* reset EGID to RGID */
|
||||
#endif
|
||||
#ifndef DEF_PATH
|
||||
# define DEF_PATH "PATH=/bin:/usr/bin:/usr/ucb" /* default search path */
|
||||
# ifdef __FreeBSD_cc_version
|
||||
# define DEF_PATH "PATH=/sbin:/usr/sbin:/bin:/usr/bin" /* default search path */
|
||||
# else
|
||||
# define DEF_PATH "PATH=/bin:/usr/bin:/usr/ucb" /* default search path */
|
||||
# endif
|
||||
#endif
|
||||
#ifndef DEF_SHELL
|
||||
# define DEF_SHELL "SHELL=/bin/sh" /* default shell */
|
||||
|
|
|
@ -79,7 +79,7 @@ void util_SignalHandler( int sig )
|
|||
#if IS_UNIX
|
||||
void tw_psignal(int sig, const TCHAR *str)
|
||||
{
|
||||
TCHAR *siglist[NSIG] = {
|
||||
const TCHAR *siglist[NSIG] = {
|
||||
_T("Unknown Signal"),
|
||||
_T("Hangup"),
|
||||
_T("Interrupt"),
|
||||
|
|
|
@ -110,7 +110,7 @@ namespace tss
|
|||
#if USE_STD_CPP_LOCALE_WORKAROUND
|
||||
return std::use_facet( l, pf );
|
||||
#else
|
||||
return std::use_facet< FacetT >( l ); pf; // This is C++ standard
|
||||
return std::use_facet< FacetT >( l ); (void)pf; // This is C++ standard
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
@ -172,7 +172,7 @@ void cUnixFSServices::GetHostID( TSTRING& name ) const
|
|||
}
|
||||
|
||||
// returns "/" for unix and "\\" for win32
|
||||
TCHAR cUnixFSServices::GetPathSeperator() const
|
||||
TCHAR cUnixFSServices::GetPathSeparator() const
|
||||
{
|
||||
return '/';
|
||||
}
|
||||
|
@ -228,9 +228,9 @@ cFSStatArgs::FileType cUnixFSServices::GetFileType(const cFCOName &filename) thr
|
|||
|
||||
void cUnixFSServices::GetCurrentDir( TSTRING& strCurDir ) const throw(eFSServices)
|
||||
{
|
||||
TCHAR pathname[MAXPATHLEN];
|
||||
TCHAR pathname[iFSServices::TW_MAX_PATH];
|
||||
pathname[0] = '\0';
|
||||
TCHAR* ret = getcwd(pathname, sizeof(TCHAR)*MAXPATHLEN);
|
||||
TCHAR* ret = getcwd(pathname, sizeof(TCHAR)*iFSServices::TW_MAX_PATH);
|
||||
|
||||
if (ret == NULL)
|
||||
throw eFSServicesGeneric( strCurDir, iFSServices::GetInstance()->GetErrString() );
|
||||
|
@ -248,12 +248,12 @@ void cUnixFSServices::ChangeDir( const TSTRING& strDir ) const throw(eFSServices
|
|||
TSTRING& cUnixFSServices::MakeTempFilename( TSTRING& strName ) const throw(eFSServices)
|
||||
{
|
||||
char* pchTempFileName;
|
||||
char szTemplate[MAXPATHLEN];
|
||||
char szTemplate[iFSServices::TW_MAX_PATH];
|
||||
int fd;
|
||||
|
||||
#ifdef _UNICODE
|
||||
// convert template from wide character to multi-byte string
|
||||
char mbBuf[MAXPATHLEN];
|
||||
char mbBuf[iFSServices::TW_MAX_PATH];
|
||||
wcstombs( mbBuf, strName.c_str(), strName.length() + 1 );
|
||||
strcpy( szTemplate, mbBuf );
|
||||
#else
|
||||
|
@ -588,15 +588,15 @@ void cUnixFSServices::ConvertModeToString( uint64 perm, TSTRING& tstrPerm ) cons
|
|||
}
|
||||
|
||||
// check owner read and write
|
||||
if (perm & S_IREAD)
|
||||
if (perm & S_IRUSR)
|
||||
szPerm[1] = _T('r');
|
||||
if (perm & S_IWRITE)
|
||||
if (perm & S_IWUSR)
|
||||
szPerm[2] = _T('w');
|
||||
|
||||
// check owner execute
|
||||
if (perm & S_ISUID && perm & S_IEXEC)
|
||||
if (perm & S_ISUID && perm & S_IXUSR)
|
||||
szPerm[3] = _T('s');
|
||||
else if (perm & S_IEXEC)
|
||||
else if (perm & S_IXUSR)
|
||||
szPerm[3] = _T('x');
|
||||
else if (perm & S_ISUID)
|
||||
szPerm[3] = _T('S');
|
||||
|
@ -792,7 +792,7 @@ bool cUnixFSServices::FullPath( TSTRING& strFullPath, const TSTRING& strRelPathC
|
|||
// Returns normal string to append to backup files for this os.
|
||||
// (e.g. "~" for unix and ".bak" for winos)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
TCHAR* cUnixFSServices::GetStandardBackupExtension() const
|
||||
const TCHAR* cUnixFSServices::GetStandardBackupExtension() const
|
||||
{
|
||||
return _T(".bak");
|
||||
}
|
||||
|
|
|
@ -99,10 +99,10 @@ class cUnixFSServices : public iFSServices
|
|||
////////////////////////////////////////
|
||||
virtual bool IsCaseSensitive() const;
|
||||
// returns true if the file system is case sensitive
|
||||
virtual TCHAR* GetStandardBackupExtension() const;
|
||||
virtual const TCHAR* GetStandardBackupExtension() const;
|
||||
// returns normal string to append to backup files for this os.
|
||||
// (e.g. "~" for unix and ".bak" for winos)
|
||||
virtual TCHAR GetPathSeperator() const;
|
||||
virtual TCHAR GetPathSeparator() const;
|
||||
|
||||
////////////////////////////////////////
|
||||
// process functions
|
||||
|
|
|
@ -33,7 +33,9 @@
|
|||
#include "stdcore.h"
|
||||
#include "usernotify.h"
|
||||
|
||||
#if defined(__OpenBSD__) /* OpenBSD's varargs seems wacky */
|
||||
// There was a problem with varargs on some combo of old OpenBSD & old compiler.
|
||||
// Not needed with current, but it's here if you need it.
|
||||
#ifdef TW_OLD_OPENBSD_VARARGS
|
||||
# undef va_start
|
||||
# ifdef __GNUC__
|
||||
# define va_start(ap, last) \
|
||||
|
@ -42,7 +44,7 @@
|
|||
# define va_start(ap, last) \
|
||||
((ap) = (va_list)&(last) + __va_size(last))
|
||||
# endif
|
||||
#endif /* __OpenBSD__ */
|
||||
#endif // TW_OLD_OPENBSD_VARARGS
|
||||
|
||||
iUserNotify* iUserNotify::mpInstance = 0;
|
||||
|
||||
|
|
|
@ -43,8 +43,8 @@ void StreamCipher::ProcessString(byte *outString, const byte *inString, unsigned
|
|||
|
||||
void StreamCipher::ProcessString(byte *inoutString, unsigned int length)
|
||||
{
|
||||
while(length--)
|
||||
*inoutString++ = ProcessByte(*inoutString);
|
||||
for(;length--; inoutString++)
|
||||
*inoutString = ProcessByte(*inoutString);
|
||||
}
|
||||
|
||||
bool MessageAuthenticationCode::Verify(const byte *macIn)
|
||||
|
|
|
@ -53,6 +53,7 @@ class cFCOName;
|
|||
class iParserGenreUtil
|
||||
{
|
||||
public:
|
||||
virtual ~iParserGenreUtil() {}
|
||||
virtual bool MapStringToProperty( const TSTRING& str, int& propIndex ) const = 0;
|
||||
// maps the given string to an index into a property vector for the genre
|
||||
virtual void AddSubTypeProps( cFCOPropVector& v ) const = 0;
|
||||
|
|
|
@ -258,7 +258,7 @@ bool cMailMessageUtil::ReadDate( TSTRING& strDateBuf )
|
|||
}
|
||||
|
||||
|
||||
static char* util_Get_IANA_CharSet()
|
||||
static const char* util_Get_IANA_CharSet()
|
||||
{
|
||||
const char* pCP = setlocale( LC_CTYPE, NULL );
|
||||
|
||||
|
|
|
@ -74,6 +74,7 @@
|
|||
class cFCOName;
|
||||
class cFCOReport_i;
|
||||
class cFCOReportGenreIter_i;
|
||||
class cFCOReportSpecIter;
|
||||
class cFCOReportSpecIter_i;
|
||||
class cFCOReportChangeIter_i;
|
||||
class iFCOSpec;
|
||||
|
|
|
@ -62,6 +62,23 @@
|
|||
#include "twcrypto/crypto.h"
|
||||
#include "core/displayencoder.h"
|
||||
|
||||
//Syllable OS doesn't provide swab(), so we'll borrow one from glibc.
|
||||
#ifdef __SYLLABLE__
|
||||
void swab (const void *bfrom, void *bto, ssize_t n)
|
||||
{
|
||||
const char *from = (const char *) bfrom;
|
||||
char *to = (char *) bto;
|
||||
|
||||
n &= ~((ssize_t) 1);
|
||||
while (n > 1)
|
||||
{
|
||||
const char b0 = from[--n], b1 = from[--n];
|
||||
to[n] = b0;
|
||||
to[n + 1] = b1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// forwards
|
||||
static bool NotifyFileType(const cFileHeaderID& id, uint32 version, iUserNotify::VerboseLevel vl);
|
||||
// Calls UserNotify(V_VERBOSE, ...) to print out type of file specified in cFileHeaderID.
|
||||
|
|
|
@ -45,11 +45,11 @@
|
|||
|
||||
enum mAction
|
||||
{
|
||||
UNSTARTED,
|
||||
UNKNOWN,
|
||||
READING,
|
||||
WRITING,
|
||||
FINISHED
|
||||
MA_UNSTARTED,
|
||||
MA_UNKNOWN,
|
||||
MA_READING,
|
||||
MA_WRITING,
|
||||
MA_FINISHED
|
||||
};
|
||||
|
||||
const int CRYPTO_COMPRESSION_LEVEL = 6;
|
||||
|
@ -109,12 +109,12 @@ cCryptoArchive::cCryptoArchive()
|
|||
mpCryptoSink = 0;
|
||||
mpCryptoSource = 0;
|
||||
mpInflatedBytes = 0;
|
||||
mAction = UNSTARTED;
|
||||
mAction = MA_UNSTARTED;
|
||||
}
|
||||
|
||||
cCryptoArchive::~cCryptoArchive()
|
||||
{
|
||||
ASSERT(mAction == UNSTARTED || mAction == UNKNOWN || mAction == FINISHED || mAction == READING);
|
||||
ASSERT(mAction == MA_UNSTARTED || mAction == MA_UNKNOWN || mAction == MA_FINISHED || mAction == MA_READING);
|
||||
// check we did not leave a buffer unwritten
|
||||
|
||||
delete mpDeflator;
|
||||
|
@ -123,7 +123,7 @@ cCryptoArchive::~cCryptoArchive()
|
|||
|
||||
void cCryptoArchive::Start(cArchive* pArchive, iCipher* pCipher)
|
||||
{
|
||||
ASSERT(mAction == UNSTARTED || mAction == UNKNOWN || mAction == FINISHED || mAction == READING);
|
||||
ASSERT(mAction == MA_UNSTARTED || mAction == MA_UNKNOWN || mAction == MA_FINISHED || mAction == MA_READING);
|
||||
// check we did not leave a buffer unwritten
|
||||
|
||||
mpArchive = pArchive;
|
||||
|
@ -140,15 +140,15 @@ void cCryptoArchive::Start(cArchive* pArchive, iCipher* pCipher)
|
|||
delete mpInflatedBytes;
|
||||
mpInflatedBytes = 0;
|
||||
|
||||
mAction = UNKNOWN;
|
||||
mAction = MA_UNKNOWN;
|
||||
}
|
||||
|
||||
int cCryptoArchive::Write(const void* pSrc, int count)
|
||||
{
|
||||
if (mAction == UNKNOWN)
|
||||
if (mAction == MA_UNKNOWN)
|
||||
{
|
||||
// this is the first write
|
||||
mAction = WRITING;
|
||||
mAction = MA_WRITING;
|
||||
|
||||
ASSERT(mpDeflator == 0);
|
||||
ASSERT(mpCryptoSink == 0);
|
||||
|
@ -159,7 +159,7 @@ int cCryptoArchive::Write(const void* pSrc, int count)
|
|||
mpCryptoSink = new cCryptoSink(mpArchive, mpCipher);
|
||||
mpDeflator = new Deflator(CRYPTO_COMPRESSION_LEVEL, mpCryptoSink);
|
||||
}
|
||||
else if (mAction != WRITING)
|
||||
else if (mAction != MA_WRITING)
|
||||
{
|
||||
ASSERT(false);
|
||||
throw eArchiveInvalidOp();
|
||||
|
@ -174,10 +174,10 @@ int cCryptoArchive::Read(void* pDest, int count)
|
|||
{
|
||||
int len;
|
||||
|
||||
if (mAction == UNKNOWN)
|
||||
if (mAction == MA_UNKNOWN)
|
||||
{
|
||||
// this is the first read
|
||||
mAction = READING;
|
||||
mAction = MA_READING;
|
||||
|
||||
ASSERT(mpDeflator == 0);
|
||||
ASSERT(mpCryptoSink == 0);
|
||||
|
@ -189,7 +189,7 @@ int cCryptoArchive::Read(void* pDest, int count)
|
|||
mpInflator = new Inflator(mpInflatedBytes);
|
||||
mpCryptoSource = new cCryptoSource(mpArchive, mpCipher, mpInflator);
|
||||
}
|
||||
else if (mAction != READING)
|
||||
else if (mAction != MA_READING)
|
||||
{
|
||||
ASSERT(false);
|
||||
throw eArchiveInvalidOp();
|
||||
|
@ -218,8 +218,8 @@ int cCryptoArchive::Read(void* pDest, int count)
|
|||
|
||||
bool cCryptoArchive::EndOfFile()
|
||||
{
|
||||
ASSERT(mAction == READING); // why would you call this if not reading?
|
||||
if (mAction != READING)
|
||||
ASSERT(mAction == MA_READING); // why would you call this if not reading?
|
||||
if (mAction != MA_READING)
|
||||
return true;
|
||||
|
||||
// TODO: is this right?
|
||||
|
@ -233,7 +233,7 @@ bool cCryptoArchive::EndOfFile()
|
|||
// reads are attempted.
|
||||
void cCryptoArchive::Finish()
|
||||
{
|
||||
if (mAction == WRITING)
|
||||
if (mAction == MA_WRITING)
|
||||
{
|
||||
mpDeflator->InputFinished();
|
||||
mpCryptoSink->InputFinished();
|
||||
|
@ -241,15 +241,15 @@ void cCryptoArchive::Finish()
|
|||
mpDeflator = 0;
|
||||
mpCryptoSink = 0; // mpCryptoSink is deleted by ~Deflator()
|
||||
|
||||
mAction = FINISHED;
|
||||
mAction = MA_FINISHED;
|
||||
}
|
||||
else if (mAction == READING)
|
||||
else if (mAction == MA_READING)
|
||||
{
|
||||
delete mpCryptoSource;
|
||||
mpCryptoSource = 0;
|
||||
mpInflator = 0; // deleting mpCryptoSource is deleted by ~Inflator()
|
||||
|
||||
mAction = FINISHED;
|
||||
mAction = MA_FINISHED;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -476,7 +476,7 @@ int cNullCryptoArchive::Write(const void* pSrc, int count)
|
|||
|
||||
cRSAArchive::cRSAArchive()
|
||||
{
|
||||
mAction = UNSTARTED;
|
||||
mAction = MA_UNSTARTED;
|
||||
mpArchive = 0;
|
||||
mpPublicKey = 0;
|
||||
mpPrivateKey = 0;
|
||||
|
@ -486,17 +486,17 @@ cRSAArchive::cRSAArchive()
|
|||
|
||||
cRSAArchive::~cRSAArchive()
|
||||
{
|
||||
ASSERT(mAction == UNSTARTED || mAction == FINISHED || mAction == READING);
|
||||
ASSERT(mAction == MA_UNSTARTED || mAction == MA_FINISHED || mAction == MA_READING);
|
||||
// check we did not leave a buffer unwritten
|
||||
delete mpIDEA;
|
||||
}
|
||||
|
||||
void cRSAArchive::SetWrite(cArchive* pDestArchive, const cRSAPublicKey* pPublicKey)
|
||||
{
|
||||
ASSERT(mAction == UNSTARTED || mAction == FINISHED || mAction == READING);
|
||||
ASSERT(mAction == MA_UNSTARTED || mAction == MA_FINISHED || mAction == MA_READING);
|
||||
// check we did not leave a buffer unwritten
|
||||
|
||||
mAction = WRITING;
|
||||
mAction = MA_WRITING;
|
||||
mpArchive = pDestArchive;
|
||||
mpPublicKey = pPublicKey;
|
||||
mpPrivateKey = 0;
|
||||
|
@ -525,10 +525,10 @@ void cRSAArchive::SetWrite(cArchive* pDestArchive, const cRSAPublicKey* pPublicK
|
|||
|
||||
void cRSAArchive::SetWrite(cArchive* pDestArchive, const cRSAPrivateKey* pPrivateKey)
|
||||
{
|
||||
ASSERT(mAction == UNSTARTED || mAction == FINISHED || mAction == READING);
|
||||
ASSERT(mAction == MA_UNSTARTED || mAction == MA_FINISHED || mAction == MA_READING);
|
||||
// check we did not leave a buffer unwritten
|
||||
|
||||
mAction = WRITING;
|
||||
mAction = MA_WRITING;
|
||||
mpArchive = pDestArchive;
|
||||
mpPrivateKey = pPrivateKey;
|
||||
mpPublicKey = 0;
|
||||
|
@ -558,21 +558,21 @@ void cRSAArchive::SetWrite(cArchive* pDestArchive, const cRSAPrivateKey* pPrivat
|
|||
|
||||
void cRSAArchive::FlushWrite()
|
||||
{
|
||||
ASSERT(mAction == WRITING);
|
||||
if (mAction != WRITING)
|
||||
ASSERT(mAction == MA_WRITING);
|
||||
if (mAction != MA_WRITING)
|
||||
throw eArchiveInvalidOp();
|
||||
|
||||
mCryptoArchive.Finish();
|
||||
|
||||
mAction = FINISHED;
|
||||
mAction = MA_FINISHED;
|
||||
}
|
||||
|
||||
void cRSAArchive::SetRead(cArchive* pSrcArchive, const cRSAPublicKey* pPublicKey)
|
||||
{
|
||||
ASSERT(mAction == UNSTARTED || mAction == FINISHED || mAction == READING);
|
||||
ASSERT(mAction == MA_UNSTARTED || mAction == MA_FINISHED || mAction == MA_READING);
|
||||
// check we did not leave a buffer unwritten
|
||||
|
||||
mAction = READING;
|
||||
mAction = MA_READING;
|
||||
mpArchive = pSrcArchive;
|
||||
mpPublicKey = pPublicKey;
|
||||
mpPrivateKey = 0;
|
||||
|
@ -599,10 +599,10 @@ void cRSAArchive::SetRead(cArchive* pSrcArchive, const cRSAPublicKey* pPublicKey
|
|||
|
||||
void cRSAArchive::SetRead(cArchive* pSrcArchive, const cRSAPrivateKey* pPrivateKey)
|
||||
{
|
||||
ASSERT(mAction == UNSTARTED || mAction == FINISHED || mAction == READING);
|
||||
ASSERT(mAction == MA_UNSTARTED || mAction == MA_FINISHED || mAction == MA_READING);
|
||||
// check we did not leave a buffer unwritten
|
||||
|
||||
mAction = READING;
|
||||
mAction = MA_READING;
|
||||
mpArchive = pSrcArchive;
|
||||
mpPrivateKey = pPrivateKey;
|
||||
mpPublicKey = 0;
|
||||
|
@ -629,8 +629,8 @@ void cRSAArchive::SetRead(cArchive* pSrcArchive, const cRSAPrivateKey* pPrivateK
|
|||
|
||||
int cRSAArchive::Read(void* pDest, int count)
|
||||
{
|
||||
ASSERT(mAction == READING);
|
||||
if (mAction != READING)
|
||||
ASSERT(mAction == MA_READING);
|
||||
if (mAction != MA_READING)
|
||||
throw eArchiveInvalidOp();
|
||||
|
||||
return mCryptoArchive.ReadBlob(pDest, count);
|
||||
|
@ -638,8 +638,8 @@ int cRSAArchive::Read(void* pDest, int count)
|
|||
|
||||
int cRSAArchive::Write(const void* pSrc, int count)
|
||||
{
|
||||
ASSERT(mAction == WRITING);
|
||||
if (mAction != WRITING)
|
||||
ASSERT(mAction == MA_WRITING);
|
||||
if (mAction != MA_WRITING)
|
||||
throw eArchiveInvalidOp();
|
||||
|
||||
mCryptoArchive.WriteBlob(pSrc, count);
|
||||
|
@ -648,8 +648,8 @@ int cRSAArchive::Write(const void* pSrc, int count)
|
|||
|
||||
bool cRSAArchive::EndOfFile()
|
||||
{
|
||||
ASSERT(mAction == READING); // why would you call this if not reading?
|
||||
if (mAction != READING)
|
||||
ASSERT(mAction == MA_READING); // why would you call this if not reading?
|
||||
if (mAction != MA_READING)
|
||||
return true;
|
||||
|
||||
return mCryptoArchive.EndOfFile();
|
||||
|
@ -663,7 +663,7 @@ bool cRSAArchive::EndOfFile()
|
|||
|
||||
cElGamalSigArchive::cElGamalSigArchive()
|
||||
{
|
||||
mAction = UNSTARTED;
|
||||
mAction = MA_UNSTARTED;
|
||||
mpArchive = 0;
|
||||
mpPublicKey = 0;
|
||||
mpPrivateKey = 0;
|
||||
|
@ -672,17 +672,17 @@ cElGamalSigArchive::cElGamalSigArchive()
|
|||
|
||||
cElGamalSigArchive::~cElGamalSigArchive()
|
||||
{
|
||||
ASSERT(mAction == UNSTARTED || mAction == FINISHED || mAction == READING);
|
||||
ASSERT(mAction == MA_UNSTARTED || mAction == MA_FINISHED || mAction == MA_READING);
|
||||
// check we did not leave a buffer unwritten
|
||||
delete mpElGamal;
|
||||
}
|
||||
|
||||
void cElGamalSigArchive::SetWrite(cArchive* pDestArchive, const cElGamalSigPrivateKey* pPrivateKey)
|
||||
{
|
||||
ASSERT(mAction == UNSTARTED || mAction == FINISHED || mAction == READING);
|
||||
ASSERT(mAction == MA_UNSTARTED || mAction == MA_FINISHED || mAction == MA_READING);
|
||||
// check we did not leave a buffer unwritten
|
||||
|
||||
mAction = WRITING;
|
||||
mAction = MA_WRITING;
|
||||
mpArchive = pDestArchive;
|
||||
mpPrivateKey = pPrivateKey;
|
||||
mpPublicKey = 0;
|
||||
|
@ -695,21 +695,21 @@ void cElGamalSigArchive::SetWrite(cArchive* pDestArchive, const cElGamalSigPriva
|
|||
|
||||
void cElGamalSigArchive::FlushWrite()
|
||||
{
|
||||
ASSERT(mAction == WRITING);
|
||||
if (mAction != WRITING)
|
||||
ASSERT(mAction == MA_WRITING);
|
||||
if (mAction != MA_WRITING)
|
||||
throw eArchiveInvalidOp();
|
||||
|
||||
mCryptoArchive.Finish();
|
||||
|
||||
mAction = FINISHED;
|
||||
mAction = MA_FINISHED;
|
||||
}
|
||||
|
||||
void cElGamalSigArchive::SetRead(cArchive* pSrcArchive, const cElGamalSigPublicKey* pPublicKey)
|
||||
{
|
||||
ASSERT(mAction == UNSTARTED || mAction == FINISHED || mAction == READING);
|
||||
ASSERT(mAction == MA_UNSTARTED || mAction == MA_FINISHED || mAction == MA_READING);
|
||||
// check we did not leave a buffer unwritten
|
||||
|
||||
mAction = READING;
|
||||
mAction = MA_READING;
|
||||
mpArchive = pSrcArchive;
|
||||
mpPublicKey = pPublicKey;
|
||||
mpPrivateKey = 0;
|
||||
|
@ -723,8 +723,8 @@ void cElGamalSigArchive::SetRead(cArchive* pSrcArchive, const cElGamalSigPublicK
|
|||
|
||||
int cElGamalSigArchive::Read(void* pDest, int count)
|
||||
{
|
||||
ASSERT(mAction == READING);
|
||||
if (mAction != READING)
|
||||
ASSERT(mAction == MA_READING);
|
||||
if (mAction != MA_READING)
|
||||
throw eArchiveInvalidOp();
|
||||
|
||||
return mCryptoArchive.ReadBlob(pDest, count);
|
||||
|
@ -732,8 +732,8 @@ int cElGamalSigArchive::Read(void* pDest, int count)
|
|||
|
||||
int cElGamalSigArchive::Write(const void* pSrc, int count)
|
||||
{
|
||||
ASSERT(mAction == WRITING);
|
||||
if (mAction != WRITING)
|
||||
ASSERT(mAction == MA_WRITING);
|
||||
if (mAction != MA_WRITING)
|
||||
throw eArchiveInvalidOp();
|
||||
|
||||
mCryptoArchive.WriteBlob(pSrc, count);
|
||||
|
@ -742,8 +742,8 @@ int cElGamalSigArchive::Write(const void* pSrc, int count)
|
|||
|
||||
bool cElGamalSigArchive::EndOfFile()
|
||||
{
|
||||
ASSERT(mAction == READING); // why would you call this if not reading?
|
||||
if (mAction != READING)
|
||||
ASSERT(mAction == MA_READING); // why would you call this if not reading?
|
||||
if (mAction != MA_READING)
|
||||
return true;
|
||||
|
||||
return mCryptoArchive.EndOfFile();
|
||||
|
|
|
@ -31,7 +31,9 @@
|
|||
//
|
||||
#include "stdtwparser.h"
|
||||
|
||||
#if defined(__OpenBSD__) /* OpenBSD's varargs seems wacky */
|
||||
// There was a problem with varargs on some combo of old OpenBSD & old compiler.
|
||||
// Not needed with current, but it's here if you need it.
|
||||
#ifdef TW_OLD_OPENBSD_VARARGS
|
||||
# undef va_start
|
||||
# ifdef __GNUC__
|
||||
# define va_start(ap, last) \
|
||||
|
@ -40,7 +42,7 @@
|
|||
# define va_start(ap, last) \
|
||||
((ap) = (va_list)&(last) + __va_size(last))
|
||||
# endif
|
||||
#endif /* __OpenBSD__ */
|
||||
#endif // TW_OLD_OPENBSD_VARARGS
|
||||
|
||||
/* ..\. -a -o yylex.cpp -D yylex.h -P ..\..\mkslexyacc\etc\yylex.cpp -LC tokens.l */
|
||||
#define INITIAL 0
|
||||
|
|
Loading…
Reference in New Issue