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