summaryrefslogtreecommitdiff
path: root/lib/common
diff options
context:
space:
mode:
Diffstat (limited to 'lib/common')
-rw-r--r--lib/common/Archive.h19
-rw-r--r--lib/common/BannerText.h6
-rw-r--r--lib/common/Box.h31
-rw-r--r--lib/common/BoxConfig-MSVC.h7
-rw-r--r--lib/common/BoxException.h3
-rw-r--r--lib/common/BoxPlatform.h8
-rw-r--r--lib/common/BoxPortsAndFiles.h.in9
-rw-r--r--lib/common/BoxTime.cpp3
-rw-r--r--lib/common/BoxTime.h19
-rw-r--r--lib/common/CommonException.txt3
-rw-r--r--lib/common/DebugMemLeakFinder.cpp32
-rw-r--r--lib/common/ExcludeList.cpp22
-rw-r--r--lib/common/FdGetLine.cpp150
-rw-r--r--lib/common/FdGetLine.h43
-rw-r--r--lib/common/FileModificationTime.cpp12
-rw-r--r--lib/common/FileModificationTime.h6
-rw-r--r--lib/common/FileStream.cpp70
-rw-r--r--lib/common/IOStreamGetLine.cpp134
-rw-r--r--lib/common/IOStreamGetLine.h44
-rw-r--r--lib/common/Logging.cpp31
-rw-r--r--lib/common/Logging.h74
-rw-r--r--lib/common/MainHelper.h17
-rw-r--r--lib/common/MemBlockStream.cpp7
-rw-r--r--lib/common/MemBlockStream.h6
-rw-r--r--lib/common/MemLeakFinder.h9
-rw-r--r--lib/common/StreamableMemBlock.cpp3
-rw-r--r--lib/common/StreamableMemBlock.h4
-rw-r--r--lib/common/TemporaryDirectory.h46
-rw-r--r--lib/common/Test.cpp44
-rw-r--r--lib/common/Test.h44
-rw-r--r--lib/common/Timer.cpp202
-rw-r--r--lib/common/Timer.h12
-rw-r--r--lib/common/UnixUser.cpp8
-rw-r--r--lib/common/UnixUser.h4
-rw-r--r--lib/common/Utils.cpp93
-rw-r--r--lib/common/Utils.h3
-rw-r--r--lib/common/ZeroStream.cpp4
-rwxr-xr-xlib/common/makeexception.pl.in4
38 files changed, 0 insertions, 1236 deletions
diff --git a/lib/common/Archive.h b/lib/common/Archive.h
index 139cc5fd..6d5ce88b 100644
--- a/lib/common/Archive.h
+++ b/lib/common/Archive.h
@@ -45,10 +45,7 @@ public:
{
Write((int) Item);
}
-<<<<<<< HEAD
-=======
void WriteExact(uint32_t Item) { Write((int)Item); }
->>>>>>> 0.12
void Write(int Item)
{
int32_t privItem = htonl(Item);
@@ -59,10 +56,7 @@ public:
int64_t privItem = box_hton64(Item);
mrStream.Write(&privItem, sizeof(privItem));
}
-<<<<<<< HEAD
-=======
void WriteExact(uint64_t Item) { Write(Item); }
->>>>>>> 0.12
void Write(uint64_t Item)
{
uint64_t privItem = box_hton64(Item);
@@ -87,11 +81,7 @@ public:
int privItem;
Read(privItem);
-<<<<<<< HEAD
- if (privItem)
-=======
if(privItem)
->>>>>>> 0.12
{
rItemOut = true;
}
@@ -100,8 +90,6 @@ public:
rItemOut = false;
}
}
-<<<<<<< HEAD
-=======
void ReadIfPresent(bool &rItemOut, bool ValueIfNotPresent)
{
int privItem;
@@ -109,7 +97,6 @@ public:
rItemOut = privItem ? true : false;
}
void ReadExact(uint32_t &rItemOut) { Read((int&)rItemOut); }
->>>>>>> 0.12
void Read(int &rItemOut)
{
int32_t privItem;
@@ -119,8 +106,6 @@ public:
}
rItemOut = ntohl(privItem);
}
-<<<<<<< HEAD
-=======
void ReadIfPresent(int &rItemOut, int ValueIfNotPresent)
{
int32_t privItem;
@@ -140,7 +125,6 @@ public:
THROW_EXCEPTION(CommonException, ArchiveBlockIncompleteRead)
}
}
->>>>>>> 0.12
void Read(int64_t &rItemOut)
{
int64_t privItem;
@@ -150,10 +134,7 @@ public:
}
rItemOut = box_ntoh64(privItem);
}
-<<<<<<< HEAD
-=======
void ReadExact(uint64_t &rItemOut) { Read(rItemOut); }
->>>>>>> 0.12
void Read(uint64_t &rItemOut)
{
uint64_t privItem;
diff --git a/lib/common/BannerText.h b/lib/common/BannerText.h
index ae3ff841..f0772c9c 100644
--- a/lib/common/BannerText.h
+++ b/lib/common/BannerText.h
@@ -10,11 +10,6 @@
#ifndef BANNERTEXT__H
#define BANNERTEXT__H
-<<<<<<< HEAD
-#define BANNER_TEXT(UtilityName) \
- "Box " UtilityName " v" BOX_VERSION ", (c) Ben Summers and " \
- "contributors 2003-2010"
-=======
#ifdef NEED_BOX_VERSION_H
# include "BoxVersion.h"
#endif
@@ -22,7 +17,6 @@
#define BANNER_TEXT(UtilityName) \
"Box " UtilityName " v" BOX_VERSION ", (c) Ben Summers and " \
"contributors 2003-2011"
->>>>>>> 0.12
#endif // BANNERTEXT__H
diff --git a/lib/common/Box.h b/lib/common/Box.h
index 91b4967b..316f4364 100644
--- a/lib/common/Box.h
+++ b/lib/common/Box.h
@@ -17,11 +17,8 @@
#include "BoxPlatform.h"
-<<<<<<< HEAD
-=======
#include <memory>
->>>>>>> 0.12
// uncomment this line to enable full memory leak finding on all
// malloc-ed blocks (at least, ones used by the STL)
//#define MEMLEAKFINDER_FULL_MALLOC_MONITORING
@@ -43,10 +40,6 @@
#include "Logging.h"
#ifndef BOX_RELEASE_BUILD
-<<<<<<< HEAD
-
-=======
->>>>>>> 0.12
extern bool AssertFailuresToSyslog;
#define ASSERT_FAILS_TO_SYSLOG_ON {AssertFailuresToSyslog = true;}
void BoxDebugAssertFailed(const char *cond, const char *file, int line);
@@ -77,10 +70,6 @@
// Exception names
#define EXCEPTION_CODENAMES_EXTENDED
-<<<<<<< HEAD
-
-=======
->>>>>>> 0.12
#else
#define ASSERT_FAILS_TO_SYSLOG_ON
#define ASSERT(cond)
@@ -91,11 +80,6 @@
// Box Backup builds release get extra information for exception logging
#define EXCEPTION_CODENAMES_EXTENDED
#define EXCEPTION_CODENAMES_EXTENDED_WITH_DESCRIPTION
-<<<<<<< HEAD
-
-#endif
-
-=======
#endif
#if defined DEBUG_LEAKS
@@ -110,7 +94,6 @@
#endif
#endif // DEBUG_LEAKS || BOX_RELEASE_BUILD
->>>>>>> 0.12
#ifdef BOX_MEMORY_LEAK_TESTING
// Memory leak testing
#include "MemLeakFinder.h"
@@ -131,10 +114,6 @@
#define THROW_EXCEPTION(type, subtype) \
{ \
-<<<<<<< HEAD
- if(!HideExceptionMessageGuard::ExceptionsHidden()) \
- { \
-=======
if((!HideExceptionMessageGuard::ExceptionsHidden() \
&& !HideSpecificExceptionGuard::IsHidden( \
type::ExceptionType, type::subtype)) \
@@ -147,7 +126,6 @@
guard.reset(new Logging::Guard(Log::EVERYTHING)); \
} \
\
->>>>>>> 0.12
OPTIONAL_DO_BACKTRACE \
BOX_WARNING("Exception thrown: " \
#type "(" #subtype ") " \
@@ -160,14 +138,6 @@
{ \
std::ostringstream _box_throw_line; \
_box_throw_line << message; \
-<<<<<<< HEAD
- if(!HideExceptionMessageGuard::ExceptionsHidden()) \
- { \
- OPTIONAL_DO_BACKTRACE \
- BOX_WARNING("Exception thrown: " \
- #type "(" #subtype ") (" << message << \
- ") at " __FILE__ "(" << __LINE__ << ")") \
-=======
if((!HideExceptionMessageGuard::ExceptionsHidden() \
&& !HideSpecificExceptionGuard::IsHidden( \
type::ExceptionType, type::subtype)) \
@@ -185,7 +155,6 @@
#type "(" #subtype ") (" << \
_box_throw_line.str() << \
") at " __FILE__ ":" << __LINE__) \
->>>>>>> 0.12
} \
throw type(type::subtype, _box_throw_line.str()); \
}
diff --git a/lib/common/BoxConfig-MSVC.h b/lib/common/BoxConfig-MSVC.h
index bfa0dcaf..eeb25d2e 100644
--- a/lib/common/BoxConfig-MSVC.h
+++ b/lib/common/BoxConfig-MSVC.h
@@ -76,12 +76,9 @@
/* Define to 1 if you have the <execinfo.h> header file. */
/* #undef HAVE_EXECINFO_H */
-<<<<<<< HEAD
-=======
/* Define to 1 if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
->>>>>>> 0.12
/* Define to 1 if you have the `flock' function. */
/* #undef HAVE_FLOCK */
@@ -188,11 +185,7 @@
/* Define to 1 if you have the `setproctitle' function. */
/* #undef HAVE_SETPROCTITLE */
-<<<<<<< HEAD
-
-=======
#define HAVE_SETPROCTITLE 1
->>>>>>> 0.12
/* Define to 1 if you have the `setxattr' function. */
/* #undef HAVE_SETXATTR */
diff --git a/lib/common/BoxException.h b/lib/common/BoxException.h
index ad5aba4f..361f04e8 100644
--- a/lib/common/BoxException.h
+++ b/lib/common/BoxException.h
@@ -29,10 +29,7 @@ public:
virtual unsigned int GetType() const throw() = 0;
virtual unsigned int GetSubType() const throw() = 0;
-<<<<<<< HEAD
-=======
virtual const std::string& GetMessage() const = 0;
->>>>>>> 0.12
private:
};
diff --git a/lib/common/BoxPlatform.h b/lib/common/BoxPlatform.h
index 2c7ffcf6..53a967e8 100644
--- a/lib/common/BoxPlatform.h
+++ b/lib/common/BoxPlatform.h
@@ -23,11 +23,7 @@
#ifdef _MSC_VER
#include "BoxConfig-MSVC.h"
-<<<<<<< HEAD
-#include "BoxVersion.h"
-=======
#define NEED_BOX_VERSION_H
->>>>>>> 0.12
#else
#include "BoxConfig.h"
#endif
@@ -163,9 +159,6 @@
#define INFTIM -1
#endif
-<<<<<<< HEAD
-// for Unix compatibility with Windows :-)
-=======
// Define O_BINARY for Unix compatibility with Windows :-)
// MSVC 2010 and newer MinGW define this in fcntl.h, which is probably
// not included by this point, so include it now so that we can detect
@@ -175,7 +168,6 @@
# include <fcntl.h>
#endif
->>>>>>> 0.12
#ifndef O_BINARY
#define O_BINARY 0
#endif
diff --git a/lib/common/BoxPortsAndFiles.h.in b/lib/common/BoxPortsAndFiles.h.in
index 55616da7..047a828f 100644
--- a/lib/common/BoxPortsAndFiles.h.in
+++ b/lib/common/BoxPortsAndFiles.h.in
@@ -32,14 +32,6 @@
#define BOX_GET_DEFAULT_BBSTORED_CONFIG_FILE \
GetDefaultConfigFilePath("bbstored.conf").c_str()
#else
-<<<<<<< HEAD
-#define BOX_FILE_BBACKUPD_DEFAULT_CONFIG "@sysconfdir_expanded@/boxbackup/bbackupd.conf"
-#define BOX_FILE_RAIDFILE_DEFAULT_CONFIG "@sysconfdir_expanded@/boxbackup/raidfile.conf"
-#define BOX_FILE_BBSTORED_DEFAULT_CONFIG "@sysconfdir_expanded@/boxbackup/bbstored.conf"
-#define BOX_FILE_BBACKUPD_OLD_CONFIG "@sysconfdir_expanded@/box/bbackupd.conf"
-#define BOX_FILE_RAIDFILE_OLD_CONFIG "@sysconfdir_expanded@/box/raidfile.conf"
-#define BOX_FILE_BBSTORED_OLD_CONFIG "@sysconfdir_expanded@/box/bbstored.conf"
-=======
#define BOX_FILE_BBACKUPD_OLD_CONFIG "@sysconfdir_expanded@/box/bbackupd.conf"
#define BOX_FILE_RAIDFILE_OLD_CONFIG "@sysconfdir_expanded@/box/raidfile.conf"
#define BOX_FILE_BBSTORED_OLD_CONFIG "@sysconfdir_expanded@/box/bbstored.conf"
@@ -49,7 +41,6 @@
std::string("@sysconfdir_expanded@/boxbackup/raidfile.conf")
#define BOX_GET_DEFAULT_BBSTORED_CONFIG_FILE \
std::string("@sysconfdir_expanded@/boxbackup/bbstored.conf")
->>>>>>> 0.12
#endif
#endif // BOXPORTSANDFILES__H
diff --git a/lib/common/BoxTime.cpp b/lib/common/BoxTime.cpp
index ead3410b..f62b1c35 100644
--- a/lib/common/BoxTime.cpp
+++ b/lib/common/BoxTime.cpp
@@ -94,8 +94,6 @@ std::string FormatTime(box_time_t time, bool includeDate, bool showMicros)
return buf.str();
}
-<<<<<<< HEAD
-=======
// --------------------------------------------------------------------------
//
// Function
@@ -145,4 +143,3 @@ void ShortSleep(box_time_t duration, bool logDuration)
#endif
}
->>>>>>> 0.12
diff --git a/lib/common/BoxTime.h b/lib/common/BoxTime.h
index d688ff10..3108d809 100644
--- a/lib/common/BoxTime.h
+++ b/lib/common/BoxTime.h
@@ -11,25 +11,16 @@
#define BOXTIME__H
// Time is presented as an unsigned 64 bit integer, in microseconds
-<<<<<<< HEAD
-typedef uint64_t box_time_t;
-=======
typedef int64_t box_time_t;
->>>>>>> 0.12
#define NANO_SEC_IN_SEC (1000000000LL)
#define NANO_SEC_IN_USEC (1000)
#define NANO_SEC_IN_USEC_LL (1000LL)
#define MICRO_SEC_IN_SEC (1000000)
#define MICRO_SEC_IN_SEC_LL (1000000LL)
-<<<<<<< HEAD
-#define MILLI_SEC_IN_NANO_SEC (1000)
-#define MILLI_SEC_IN_NANO_SEC_LL (1000LL)
-=======
#define MICRO_SEC_IN_MILLI_SEC (1000)
#define MILLI_SEC_IN_SEC (1000)
#define MILLI_SEC_IN_SEC_LL (1000LL)
->>>>>>> 0.12
box_time_t GetCurrentBoxTime();
@@ -37,24 +28,17 @@ inline box_time_t SecondsToBoxTime(time_t Seconds)
{
return ((box_time_t)Seconds * MICRO_SEC_IN_SEC_LL);
}
-<<<<<<< HEAD
-=======
inline uint64_t MilliSecondsToBoxTime(int64_t milliseconds)
{
return ((box_time_t)milliseconds * 1000);
}
->>>>>>> 0.12
inline time_t BoxTimeToSeconds(box_time_t Time)
{
return Time / MICRO_SEC_IN_SEC_LL;
}
inline uint64_t BoxTimeToMilliSeconds(box_time_t Time)
{
-<<<<<<< HEAD
- return Time / MILLI_SEC_IN_NANO_SEC_LL;
-=======
return Time / MILLI_SEC_IN_SEC_LL;
->>>>>>> 0.12
}
inline uint64_t BoxTimeToMicroSeconds(box_time_t Time)
{
@@ -64,9 +48,6 @@ inline uint64_t BoxTimeToMicroSeconds(box_time_t Time)
std::string FormatTime(box_time_t time, bool includeDate,
bool showMicros = false);
-<<<<<<< HEAD
-=======
void ShortSleep(box_time_t duration, bool logDuration);
->>>>>>> 0.12
#endif // BOXTIME__H
diff --git a/lib/common/CommonException.txt b/lib/common/CommonException.txt
index 885a9197..05da2709 100644
--- a/lib/common/CommonException.txt
+++ b/lib/common/CommonException.txt
@@ -45,8 +45,6 @@ IOStreamGetLineNotEnoughDataToIgnore 37 Bad value passed to IOStreamGetLine::Ign
TempDirPathTooLong 38 Your temporary directory path is too long. Check the TMP and TEMP environment variables.
ArchiveBlockIncompleteRead 39 The Store Object Info File is too short or corrupted, and will be rewritten automatically when the next backup completes.
AccessDenied 40 Access to the file or directory was denied. Please check the permissions.
-<<<<<<< HEAD
-=======
DatabaseOpenFailed 41 Failed to open the database file
DatabaseReadFailed 42 Failed to read a record from the database file
DatabaseWriteFailed 43 Failed to write a record from the database file
@@ -57,4 +55,3 @@ DatabaseRecordAlreadyExists 47 The database already contains a record with this
DatabaseRecordBadSize 48 The database contains a record with an invalid size
DatabaseIterateFailed 49 Failed to iterate over the database keys
ReferenceNotFound 50 The database does not contain an expected reference
->>>>>>> 0.12
diff --git a/lib/common/DebugMemLeakFinder.cpp b/lib/common/DebugMemLeakFinder.cpp
index ecc4eb12..0b123675 100644
--- a/lib/common/DebugMemLeakFinder.cpp
+++ b/lib/common/DebugMemLeakFinder.cpp
@@ -7,18 +7,10 @@
//
// --------------------------------------------------------------------------
-<<<<<<< HEAD
-
-#ifndef BOX_RELEASE_BUILD
-
-#include "Box.h"
-
-=======
#include "Box.h"
#ifdef BOX_MEMORY_LEAK_TESTING
->>>>>>> 0.12
#undef malloc
#undef realloc
#undef free
@@ -27,13 +19,6 @@
#include <unistd.h>
#endif
-<<<<<<< HEAD
-#include <map>
-#include <stdio.h>
-#include <string.h>
-#include <set>
-#include <cstdlib> // for std::atexit
-=======
#include <signal.h>
#include <stdio.h>
#include <string.h>
@@ -41,7 +26,6 @@
#include <cstdlib> // for std::atexit
#include <map>
#include <set>
->>>>>>> 0.12
#include "MemLeakFinder.h"
@@ -90,8 +74,6 @@ namespace
size_t sNotLeaksPreNum = 0;
}
-<<<<<<< HEAD
-=======
void memleakfinder_report_on_signal(int unused)
{
// this is not safe! do not send SIGUSR1 to a process
@@ -99,7 +81,6 @@ void memleakfinder_report_on_signal(int unused)
memleakfinder_report_usage_summary();
}
->>>>>>> 0.12
void memleakfinder_init()
{
ASSERT(!memleakfinder_initialised);
@@ -111,8 +92,6 @@ void memleakfinder_init()
}
memleakfinder_initialised = true;
-<<<<<<< HEAD
-=======
#if defined WIN32
// no signals, no way to trigger event yet
@@ -128,7 +107,6 @@ void memleakfinder_init()
}
ASSERT(oldact.sa_handler == 0);
#endif // WIN32
->>>>>>> 0.12
}
MemLeakSuppressionGuard::MemLeakSuppressionGuard()
@@ -186,8 +164,6 @@ void *memleakfinder_malloc(size_t size, const char *file, int line)
return b;
}
-<<<<<<< HEAD
-=======
void *memleakfinder_calloc(size_t blocks, size_t size, const char *file, int line)
{
void *block = memleakfinder_malloc(blocks * size, file, line);
@@ -198,7 +174,6 @@ void *memleakfinder_calloc(size_t blocks, size_t size, const char *file, int lin
return block;
}
->>>>>>> 0.12
void *memleakfinder_realloc(void *ptr, size_t size)
{
InternalAllocGuard guard;
@@ -404,8 +379,6 @@ int memleakfinder_numleaks()
return n;
}
-<<<<<<< HEAD
-=======
// Summarise all blocks allocated and still allocated, for memory usage
// diagnostics.
void memleakfinder_report_usage_summary()
@@ -485,7 +458,6 @@ void memleakfinder_report_usage_summary()
#endif // DEBUG_LEAKS
}
->>>>>>> 0.12
void memleakfinder_reportleaks_file(FILE *file)
{
InternalAllocGuard guard;
@@ -689,8 +661,4 @@ void operator delete(void *ptr) throw ()
internal_delete(ptr);
}
-<<<<<<< HEAD
-#endif // BOX_RELEASE_BUILD
-=======
#endif // BOX_MEMORY_LEAK_TESTING
->>>>>>> 0.12
diff --git a/lib/common/ExcludeList.cpp b/lib/common/ExcludeList.cpp
index c7c80ed2..213c4f8e 100644
--- a/lib/common/ExcludeList.cpp
+++ b/lib/common/ExcludeList.cpp
@@ -101,14 +101,6 @@ std::string ExcludeList::ReplaceSlashesRegex(const std::string& input) const
output.replace(pos, 1, "\\" DIRECTORY_SEPARATOR);
}
-<<<<<<< HEAD
- for (std::string::iterator i = output.begin(); i != output.end(); i++)
- {
- *i = tolower(*i);
- }
-
-=======
->>>>>>> 0.12
return output;
}
#endif
@@ -188,30 +180,19 @@ void ExcludeList::AddRegexEntries(const std::string &rEntries)
try
{
std::string entry = *i;
-<<<<<<< HEAD
-=======
int flags = REG_EXTENDED | REG_NOSUB;
->>>>>>> 0.12
// Convert any forward slashes in the string
// to appropriately escaped backslashes
#ifdef WIN32
entry = ReplaceSlashesRegex(entry);
-<<<<<<< HEAD
- #endif
-
- // Compile
- int errcode = ::regcomp(pregex, entry.c_str(),
- REG_EXTENDED | REG_NOSUB);
-=======
flags |= REG_ICASE; // Windows convention
#endif
// Compile
int errcode = ::regcomp(pregex, entry.c_str(),
flags);
->>>>>>> 0.12
if (errcode != 0)
{
@@ -254,10 +235,7 @@ bool ExcludeList::IsExcluded(const std::string &rTest) const
std::string test = rTest;
#ifdef WIN32
-<<<<<<< HEAD
-=======
// converts to lower case as well
->>>>>>> 0.12
test = ReplaceSlashesDefinite(test);
#endif
diff --git a/lib/common/FdGetLine.cpp b/lib/common/FdGetLine.cpp
index 2d2f7c6a..30409d92 100644
--- a/lib/common/FdGetLine.cpp
+++ b/lib/common/FdGetLine.cpp
@@ -20,16 +20,6 @@
#include "MemLeakFindOn.h"
-<<<<<<< HEAD
-// utility whitespace function
-inline bool iw(int c)
-{
- return (c == ' ' || c == '\t' || c == '\v' || c == '\f'); // \r, \n are already excluded
-}
-
-
-=======
->>>>>>> 0.12
// --------------------------------------------------------------------------
//
// Function
@@ -39,16 +29,7 @@ inline bool iw(int c)
//
// --------------------------------------------------------------------------
FdGetLine::FdGetLine(int fd)
-<<<<<<< HEAD
- : mFileHandle(fd),
- mLineNumber(0),
- mBufferBegin(0),
- mBytesInBuffer(0),
- mPendingEOF(false),
- mEOF(false)
-=======
: mFileHandle(fd)
->>>>>>> 0.12
{
if(mFileHandle < 0) {THROW_EXCEPTION(CommonException, BadArguments)}
//printf("FdGetLine buffer size = %d\n", sizeof(mBuffer));
@@ -81,128 +62,6 @@ FdGetLine::~FdGetLine()
std::string FdGetLine::GetLine(bool Preprocess)
{
if(mFileHandle == -1) {THROW_EXCEPTION(CommonException, GetLineNoHandle)}
-<<<<<<< HEAD
-
- // EOF?
- if(mEOF) {THROW_EXCEPTION(CommonException, GetLineEOF)}
-
- std::string r;
-
- bool foundLineEnd = false;
-
- while(!foundLineEnd && !mEOF)
- {
- // Use any bytes left in the buffer
- while(mBufferBegin < mBytesInBuffer)
- {
- int c = mBuffer[mBufferBegin++];
- if(c == '\r')
- {
- // Ignore nasty Windows line ending extra chars
- }
- else if(c == '\n')
- {
- // Line end!
- foundLineEnd = true;
- break;
- }
- else
- {
- // Add to string
- r += c;
- }
-
- // Implicit line ending at EOF
- if(mBufferBegin >= mBytesInBuffer && mPendingEOF)
- {
- foundLineEnd = true;
- }
- }
-
- // Check size
- if(r.size() > FDGETLINE_MAX_LINE_SIZE)
- {
- THROW_EXCEPTION(CommonException, GetLineTooLarge)
- }
-
- // Read more in?
- if(!foundLineEnd && mBufferBegin >= mBytesInBuffer && !mPendingEOF)
- {
-#ifdef WIN32
- int bytes;
-
- if (mFileHandle == _fileno(stdin))
- {
- bytes = console_read(mBuffer, sizeof(mBuffer));
- }
- else
- {
- bytes = ::read(mFileHandle, mBuffer,
- sizeof(mBuffer));
- }
-#else // !WIN32
- int bytes = ::read(mFileHandle, mBuffer, sizeof(mBuffer));
-#endif // WIN32
-
- // Error?
- if(bytes == -1)
- {
- THROW_EXCEPTION(CommonException, OSFileError)
- }
-
- // Adjust buffer info
- mBytesInBuffer = bytes;
- mBufferBegin = 0;
-
- // EOF / closed?
- if(bytes == 0)
- {
- mPendingEOF = true;
- }
- }
-
- // EOF?
- if(mPendingEOF && mBufferBegin >= mBytesInBuffer)
- {
- // File is EOF, and now we've depleted the buffer completely, so tell caller as well.
- mEOF = true;
- }
- }
-
- if(!Preprocess)
- {
- return r;
- }
- else
- {
- // Check for comment char, but char before must be whitespace
- int end = 0;
- int size = r.size();
- while(end < size)
- {
- if(r[end] == '#' && (end == 0 || (iw(r[end-1]))))
- {
- break;
- }
- end++;
- }
-
- // Remove whitespace
- int begin = 0;
- while(begin < size && iw(r[begin]))
- {
- begin++;
- }
- if(!iw(r[end])) end--;
- while(end > begin && iw(r[end]))
- {
- end--;
- }
-
- // Return a sub string
- return r.substr(begin, end - begin + 1);
- }
-=======
std::string r;
bool result = GetLineInternal(r, Preprocess);
@@ -250,7 +109,6 @@ int FdGetLine::ReadMore(int Timeout)
}
return bytes;
->>>>>>> 0.12
}
@@ -259,11 +117,7 @@ int FdGetLine::ReadMore(int Timeout)
// Function
// Name: FdGetLine::DetachFile()
// Purpose: Detaches the file handle, setting the file pointer correctly.
-<<<<<<< HEAD
-// Probably not good for sockets...
-=======
// Probably not good for sockets...
->>>>>>> 0.12
// Created: 2003/07/24
//
// --------------------------------------------------------------------------
@@ -286,7 +140,3 @@ void FdGetLine::DetachFile()
mFileHandle = -1;
}
-<<<<<<< HEAD
-
-=======
->>>>>>> 0.12
diff --git a/lib/common/FdGetLine.h b/lib/common/FdGetLine.h
index 6b609fe8..2b9c268f 100644
--- a/lib/common/FdGetLine.h
+++ b/lib/common/FdGetLine.h
@@ -12,23 +12,7 @@
#include <string>
-<<<<<<< HEAD
-#ifdef BOX_RELEASE_BUILD
- #define FDGETLINE_BUFFER_SIZE 1024
-#elif defined WIN32
- // need enough space for at least one unicode character
- // in UTF-8 when calling console_read() from bbackupquery
- #define FDGETLINE_BUFFER_SIZE 5
-#else
- #define FDGETLINE_BUFFER_SIZE 4
-#endif
-
-// Just a very large upper bound for line size to avoid
-// people sending lots of data over sockets and causing memory problems.
-#define FDGETLINE_MAX_LINE_SIZE (1024*256)
-=======
#include "GetLine.h"
->>>>>>> 0.12
// --------------------------------------------------------------------------
//
@@ -38,41 +22,15 @@
// Created: 2003/07/24
//
// --------------------------------------------------------------------------
-<<<<<<< HEAD
-class FdGetLine
-{
-public:
- FdGetLine(int fd);
- ~FdGetLine();
-=======
class FdGetLine : public GetLine
{
public:
FdGetLine(int fd);
virtual ~FdGetLine();
->>>>>>> 0.12
private:
FdGetLine(const FdGetLine &rToCopy);
public:
-<<<<<<< HEAD
- std::string GetLine(bool Preprocess = false);
- bool IsEOF() {return mEOF;}
- int GetLineNumber() {return mLineNumber;}
-
- // Call to detach, setting file pointer correctly to last bit read.
- // Only works for lseek-able file descriptors.
- void DetachFile();
-
-private:
- char mBuffer[FDGETLINE_BUFFER_SIZE];
- int mFileHandle;
- int mLineNumber;
- int mBufferBegin;
- int mBytesInBuffer;
- bool mPendingEOF;
- bool mEOF;
-=======
virtual std::string GetLine(bool Preprocess = false);
// Call to detach, setting file pointer correctly to last bit read.
// Only works for lseek-able file descriptors.
@@ -86,7 +44,6 @@ protected:
private:
int mFileHandle;
->>>>>>> 0.12
};
#endif // FDGETLINE__H
diff --git a/lib/common/FileModificationTime.cpp b/lib/common/FileModificationTime.cpp
index bc35b7e6..06fc7887 100644
--- a/lib/common/FileModificationTime.cpp
+++ b/lib/common/FileModificationTime.cpp
@@ -16,11 +16,7 @@
#include "MemLeakFindOn.h"
-<<<<<<< HEAD
-box_time_t FileModificationTime(EMU_STRUCT_STAT &st)
-=======
box_time_t FileModificationTime(const EMU_STRUCT_STAT &st)
->>>>>>> 0.12
{
#ifndef HAVE_STRUCT_STAT_ST_MTIMESPEC
box_time_t datamodified = ((int64_t)st.st_mtime) * (MICRO_SEC_IN_SEC_LL);
@@ -32,11 +28,7 @@ box_time_t FileModificationTime(const EMU_STRUCT_STAT &st)
return datamodified;
}
-<<<<<<< HEAD
-box_time_t FileAttrModificationTime(EMU_STRUCT_STAT &st)
-=======
box_time_t FileAttrModificationTime(const EMU_STRUCT_STAT &st)
->>>>>>> 0.12
{
box_time_t statusmodified =
#ifdef HAVE_STRUCT_STAT_ST_MTIMESPEC
@@ -55,11 +47,7 @@ box_time_t FileAttrModificationTime(const EMU_STRUCT_STAT &st)
return statusmodified;
}
-<<<<<<< HEAD
-box_time_t FileModificationTimeMaxModAndAttr(EMU_STRUCT_STAT &st)
-=======
box_time_t FileModificationTimeMaxModAndAttr(const EMU_STRUCT_STAT &st)
->>>>>>> 0.12
{
#ifndef HAVE_STRUCT_STAT_ST_MTIMESPEC
box_time_t datamodified = ((int64_t)st.st_mtime) * (MICRO_SEC_IN_SEC_LL);
diff --git a/lib/common/FileModificationTime.h b/lib/common/FileModificationTime.h
index ffff29c7..85424842 100644
--- a/lib/common/FileModificationTime.h
+++ b/lib/common/FileModificationTime.h
@@ -14,15 +14,9 @@
#include "BoxTime.h"
-<<<<<<< HEAD
-box_time_t FileModificationTime(EMU_STRUCT_STAT &st);
-box_time_t FileAttrModificationTime(EMU_STRUCT_STAT &st);
-box_time_t FileModificationTimeMaxModAndAttr(EMU_STRUCT_STAT &st);
-=======
box_time_t FileModificationTime(const EMU_STRUCT_STAT &st);
box_time_t FileAttrModificationTime(const EMU_STRUCT_STAT &st);
box_time_t FileModificationTimeMaxModAndAttr(const EMU_STRUCT_STAT &st);
->>>>>>> 0.12
#endif // FILEMODIFICATIONTIME__H
diff --git a/lib/common/FileStream.cpp b/lib/common/FileStream.cpp
index 68209b15..fc0319da 100644
--- a/lib/common/FileStream.cpp
+++ b/lib/common/FileStream.cpp
@@ -190,23 +190,6 @@ int FileStream::Read(void *pBuffer, int NBytes, int Timeout)
}
else
{
-<<<<<<< HEAD
- BOX_LOG_WIN_ERROR("Failed to read from file: " << mFileName);
- r = -1;
- }
-#else
- int r = ::read(mOSFileHandle, pBuffer, NBytes);
- if(r == -1)
- {
- BOX_LOG_SYS_ERROR("Failed to read from file: " << mFileName);
- }
-#endif
-
- if(r == -1)
- {
- THROW_EXCEPTION(CommonException, OSFileReadError)
- }
-=======
THROW_WIN_FILE_ERROR("Failed to read from file", mFileName,
CommonException, OSFileReadError);
}
@@ -223,7 +206,6 @@ int FileStream::Read(void *pBuffer, int NBytes, int Timeout)
CommonException, OSFileReadError);
}
#endif
->>>>>>> 0.12
if(r == 0)
{
@@ -247,11 +229,7 @@ IOStream::pos_type FileStream::BytesLeftToRead()
EMU_STRUCT_STAT st;
if(EMU_FSTAT(mOSFileHandle, &st) != 0)
{
-<<<<<<< HEAD
- THROW_EXCEPTION(CommonException, OSFileError)
-=======
BOX_LOG_SYS_ERROR(BOX_FILE_MESSAGE("Failed to stat file", mFileName));
->>>>>>> 0.12
}
return st.st_size - GetPosition();
@@ -285,24 +263,14 @@ void FileStream::Write(const void *pBuffer, int NBytes)
if ((res == 0) || (numBytesWritten != (DWORD)NBytes))
{
-<<<<<<< HEAD
- // DWORD err = GetLastError();
- THROW_EXCEPTION(CommonException, OSFileWriteError)
-=======
THROW_WIN_FILE_ERROR("Failed to write to file", mFileName,
CommonException, OSFileWriteError);
->>>>>>> 0.12
}
#else
if(::write(mOSFileHandle, pBuffer, NBytes) != NBytes)
{
-<<<<<<< HEAD
- BOX_LOG_SYS_ERROR("Failed to write to file: " << mFileName);
- THROW_EXCEPTION(CommonException, OSFileWriteError)
-=======
THROW_SYS_FILE_ERROR("Failed to write to file", mFileName,
CommonException, OSFileWriteError);
->>>>>>> 0.12
}
#endif
}
@@ -325,14 +293,6 @@ IOStream::pos_type FileStream::GetPosition() const
#ifdef WIN32
LARGE_INTEGER conv;
-<<<<<<< HEAD
-
- conv.HighPart = 0;
- conv.LowPart = 0;
-
- conv.LowPart = SetFilePointer(this->mOSFileHandle, 0, &conv.HighPart, FILE_CURRENT);
-
-=======
conv.HighPart = 0;
conv.LowPart = SetFilePointer(this->mOSFileHandle, 0, &conv.HighPart, FILE_CURRENT);
@@ -342,18 +302,13 @@ IOStream::pos_type FileStream::GetPosition() const
CommonException, OSFileError);
}
->>>>>>> 0.12
return (IOStream::pos_type)conv.QuadPart;
#else // ! WIN32
off_t p = ::lseek(mOSFileHandle, 0, SEEK_CUR);
if(p == -1)
{
-<<<<<<< HEAD
- THROW_EXCEPTION(CommonException, OSFileError)
-=======
THROW_SYS_FILE_ERROR("Failed to seek in file", mFileName,
CommonException, OSFileError);
->>>>>>> 0.12
}
return (IOStream::pos_type)p;
@@ -378,31 +333,19 @@ void FileStream::Seek(IOStream::pos_type Offset, int SeekType)
#ifdef WIN32
LARGE_INTEGER conv;
-<<<<<<< HEAD
-
-=======
->>>>>>> 0.12
conv.QuadPart = Offset;
DWORD retVal = SetFilePointer(this->mOSFileHandle, conv.LowPart, &conv.HighPart, ConvertSeekTypeToOSWhence(SeekType));
if(retVal == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR)
{
-<<<<<<< HEAD
- THROW_EXCEPTION(CommonException, OSFileError)
-=======
THROW_WIN_FILE_ERROR("Failed to seek in file", mFileName,
CommonException, OSFileError);
->>>>>>> 0.12
}
#else // ! WIN32
if(::lseek(mOSFileHandle, Offset, ConvertSeekTypeToOSWhence(SeekType)) == -1)
{
-<<<<<<< HEAD
- THROW_EXCEPTION(CommonException, OSFileError)
-=======
THROW_SYS_FILE_ERROR("Failed to seek in file", mFileName,
CommonException, OSFileError);
->>>>>>> 0.12
}
#endif // WIN32
@@ -428,14 +371,6 @@ void FileStream::Close()
#ifdef WIN32
if(::CloseHandle(mOSFileHandle) == 0)
-<<<<<<< HEAD
-#else
- if(::close(mOSFileHandle) != 0)
-#endif
- {
- THROW_EXCEPTION(CommonException, OSFileCloseError)
- }
-=======
{
THROW_WIN_FILE_ERROR("Failed to close file", mFileName,
CommonException, OSFileCloseError);
@@ -447,7 +382,6 @@ void FileStream::Close()
CommonException, OSFileCloseError);
}
#endif // WIN32
->>>>>>> 0.12
mOSFileHandle = INVALID_FILE;
mIsEOF = true;
@@ -478,11 +412,7 @@ bool FileStream::StreamDataLeft()
// --------------------------------------------------------------------------
bool FileStream::StreamClosed()
{
-<<<<<<< HEAD
- return mIsEOF;
-=======
return (mOSFileHandle == INVALID_FILE);
->>>>>>> 0.12
}
// --------------------------------------------------------------------------
diff --git a/lib/common/IOStreamGetLine.cpp b/lib/common/IOStreamGetLine.cpp
index 9a40f3eb..ef8930b8 100644
--- a/lib/common/IOStreamGetLine.cpp
+++ b/lib/common/IOStreamGetLine.cpp
@@ -13,16 +13,6 @@
#include "MemLeakFindOn.h"
-<<<<<<< HEAD
-// utility whitespace function
-inline bool iw(int c)
-{
- return (c == ' ' || c == '\t' || c == '\v' || c == '\f'); // \r, \n are already excluded
-}
-
-
-=======
->>>>>>> 0.12
// --------------------------------------------------------------------------
//
// Function
@@ -32,16 +22,7 @@ inline bool iw(int c)
//
// --------------------------------------------------------------------------
IOStreamGetLine::IOStreamGetLine(IOStream &Stream)
-<<<<<<< HEAD
- : mrStream(Stream),
- mLineNumber(0),
- mBufferBegin(0),
- mBytesInBuffer(0),
- mPendingEOF(false),
- mEOF(false)
-=======
: mrStream(Stream)
->>>>>>> 0.12
{
}
@@ -73,120 +54,6 @@ IOStreamGetLine::~IOStreamGetLine()
// --------------------------------------------------------------------------
bool IOStreamGetLine::GetLine(std::string &rOutput, bool Preprocess, int Timeout)
{
-<<<<<<< HEAD
- // EOF?
- if(mEOF) {THROW_EXCEPTION(CommonException, GetLineEOF)}
-
- // Initialise string to stored into
- std::string r(mPendingString);
- mPendingString.erase();
-
- bool foundLineEnd = false;
-
- while(!foundLineEnd && !mEOF)
- {
- // Use any bytes left in the buffer
- while(mBufferBegin < mBytesInBuffer)
- {
- int c = mBuffer[mBufferBegin++];
- if(c == '\r')
- {
- // Ignore nasty Windows line ending extra chars
- }
- else if(c == '\n')
- {
- // Line end!
- foundLineEnd = true;
- break;
- }
- else
- {
- // Add to string
- r += c;
- }
-
- // Implicit line ending at EOF
- if(mBufferBegin >= mBytesInBuffer && mPendingEOF)
- {
- foundLineEnd = true;
- }
- }
-
- // Check size
- if(r.size() > IOSTREAMGETLINE_MAX_LINE_SIZE)
- {
- THROW_EXCEPTION(CommonException, GetLineTooLarge)
- }
-
- // Read more in?
- if(!foundLineEnd && mBufferBegin >= mBytesInBuffer && !mPendingEOF)
- {
- int bytes = mrStream.Read(mBuffer, sizeof(mBuffer), Timeout);
-
- // Adjust buffer info
- mBytesInBuffer = bytes;
- mBufferBegin = 0;
-
- // EOF / closed?
- if(!mrStream.StreamDataLeft())
- {
- mPendingEOF = true;
- }
-
- // No data returned?
- if(bytes == 0 && mrStream.StreamDataLeft())
- {
- // store string away
- mPendingString = r;
- // Return false;
- return false;
- }
- }
-
- // EOF?
- if(mPendingEOF && mBufferBegin >= mBytesInBuffer)
- {
- // File is EOF, and now we've depleted the buffer completely, so tell caller as well.
- mEOF = true;
- }
- }
-
- if(!Preprocess)
- {
- rOutput = r;
- return true;
- }
- else
- {
- // Check for comment char, but char before must be whitespace
- int end = 0;
- int size = r.size();
- while(end < size)
- {
- if(r[end] == '#' && (end == 0 || (iw(r[end-1]))))
- {
- break;
- }
- end++;
- }
-
- // Remove whitespace
- int begin = 0;
- while(begin < size && iw(r[begin]))
- {
- begin++;
- }
- if(!iw(r[end])) end--;
- while(end > begin && iw(r[end]))
- {
- end--;
- }
-
- // Return a sub string
- rOutput = r.substr(begin, end - begin + 1);
- return true;
- }
-=======
return GetLineInternal(rOutput, Preprocess, Timeout);
}
@@ -211,7 +78,6 @@ int IOStreamGetLine::ReadMore(int Timeout)
}
return bytes;
->>>>>>> 0.12
}
diff --git a/lib/common/IOStreamGetLine.h b/lib/common/IOStreamGetLine.h
index 1693e8ac..c4289073 100644
--- a/lib/common/IOStreamGetLine.h
+++ b/lib/common/IOStreamGetLine.h
@@ -12,24 +12,9 @@
#include <string>
-<<<<<<< HEAD
-#include "IOStream.h"
-
-#ifdef BOX_RELEASE_BUILD
- #define IOSTREAMGETLINE_BUFFER_SIZE 1024
-#else
- #define IOSTREAMGETLINE_BUFFER_SIZE 4
-#endif
-
-// Just a very large upper bound for line size to avoid
-// people sending lots of data over sockets and causing memory problems.
-#define IOSTREAMGETLINE_MAX_LINE_SIZE (1024*256)
-
-=======
#include "GetLine.h"
#include "IOStream.h"
->>>>>>> 0.12
// --------------------------------------------------------------------------
//
// Class
@@ -38,67 +23,38 @@
// Created: 2003/07/24
//
// --------------------------------------------------------------------------
-<<<<<<< HEAD
-class IOStreamGetLine
-{
-public:
- IOStreamGetLine(IOStream &Stream);
- ~IOStreamGetLine();
-=======
class IOStreamGetLine : public GetLine
{
public:
IOStreamGetLine(IOStream &Stream);
virtual ~IOStreamGetLine();
->>>>>>> 0.12
private:
IOStreamGetLine(const IOStreamGetLine &rToCopy);
public:
bool GetLine(std::string &rOutput, bool Preprocess = false, int Timeout = IOStream::TimeOutInfinite);
-<<<<<<< HEAD
- bool IsEOF() {return mEOF;}
- int GetLineNumber() {return mLineNumber;}
-=======
->>>>>>> 0.12
// Call to detach, setting file pointer correctly to last bit read.
// Only works for lseek-able file descriptors.
void DetachFile();
-<<<<<<< HEAD
-=======
virtual bool IsStreamDataLeft()
{
return mrStream.StreamDataLeft();
}
->>>>>>> 0.12
// For doing interesting stuff with the remaining data...
// Be careful with this!
const void *GetBufferedData() const {return mBuffer + mBufferBegin;}
int GetSizeOfBufferedData() const {return mBytesInBuffer - mBufferBegin;}
void IgnoreBufferedData(int BytesToIgnore);
IOStream &GetUnderlyingStream() {return mrStream;}
-<<<<<<< HEAD
-
-private:
- char mBuffer[IOSTREAMGETLINE_BUFFER_SIZE];
- IOStream &mrStream;
- int mLineNumber;
- int mBufferBegin;
- int mBytesInBuffer;
- bool mPendingEOF;
- bool mEOF;
- std::string mPendingString;
-=======
protected:
int ReadMore(int Timeout = IOStream::TimeOutInfinite);
private:
IOStream &mrStream;
->>>>>>> 0.12
};
#endif // IOSTREAMGETLINE__H
diff --git a/lib/common/Logging.cpp b/lib/common/Logging.cpp
index 4a7e5e0a..7ce0dd3f 100644
--- a/lib/common/Logging.cpp
+++ b/lib/common/Logging.cpp
@@ -22,12 +22,9 @@
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
-<<<<<<< HEAD
-=======
#ifdef WIN32
#include <process.h>
#endif
->>>>>>> 0.12
#include <cstring>
#include <iomanip>
@@ -49,15 +46,12 @@ Log::Level Logging::sGlobalLevel = Log::EVERYTHING;
Logging Logging::sGlobalLogging; //automatic initialisation
std::string Logging::sProgramName;
-<<<<<<< HEAD
-=======
HideSpecificExceptionGuard::SuppressedExceptions_t
HideSpecificExceptionGuard::sSuppressedExceptions;
int Logging::Guard::sGuardCount = 0;
Log::Level Logging::Guard::sOriginalLevel = Log::INVALID;
->>>>>>> 0.12
Logging::Logging()
{
ASSERT(!spConsole);
@@ -259,15 +253,12 @@ Logger::~Logger()
Logging::Remove(this);
}
-<<<<<<< HEAD
-=======
bool Logger::IsEnabled(Log::Level level)
{
return Logging::IsEnabled(level) &&
(int)mCurrentLevel >= (int)level;
}
->>>>>>> 0.12
bool Console::sShowTime = false;
bool Console::sShowTimeMicros = false;
bool Console::sShowTag = false;
@@ -367,13 +358,6 @@ bool Console::Log(Log::Level level, const std::string& rFile,
#ifdef WIN32
std::string output = buf.str();
-<<<<<<< HEAD
- ConvertUtf8ToConsole(output.c_str(), output);
- fprintf(target, "%s\n", output.c_str());
- #else
- fprintf(target, "%s\n", buf.str().c_str());
- #endif
-=======
if(ConvertUtf8ToConsole(output.c_str(), output) == false)
{
fprintf(target, "%s (and failed to convert to console encoding)\n",
@@ -388,7 +372,6 @@ bool Console::Log(Log::Level level, const std::string& rFile,
#endif
fflush(target);
->>>>>>> 0.12
return true;
}
@@ -487,8 +470,6 @@ int Syslog::GetNamedFacility(const std::string& rFacility)
bool FileLogger::Log(Log::Level Level, const std::string& rFile,
int line, std::string& rMessage)
{
-<<<<<<< HEAD
-=======
if (mLogFile.StreamClosed())
{
/* skip this logger to allow logging failure to open
@@ -496,19 +477,14 @@ bool FileLogger::Log(Log::Level Level, const std::string& rFile,
return true;
}
->>>>>>> 0.12
if (Level > GetLevel())
{
return true;
}
/* avoid infinite loop if this throws an exception */
-<<<<<<< HEAD
- Logging::Remove(this);
-=======
Log::Level oldLevel = GetLevel();
Filter(Log::NOTHING);
->>>>>>> 0.12
std::ostringstream buf;
buf << FormatTime(GetCurrentBoxTime(), true, false);
@@ -548,12 +524,8 @@ bool FileLogger::Log(Log::Level Level, const std::string& rFile,
mLogFile.Write(output.c_str(), output.length());
-<<<<<<< HEAD
- Logging::Add(this);
-=======
// no infinite loop, reset to saved logging level
Filter(oldLevel);
->>>>>>> 0.12
return true;
}
@@ -577,8 +549,6 @@ std::string PrintEscapedBinaryData(const std::string& rInput)
return output.str();
}
-<<<<<<< HEAD
-=======
bool HideSpecificExceptionGuard::IsHidden(int type, int subtype)
{
@@ -594,4 +564,3 @@ bool HideSpecificExceptionGuard::IsHidden(int type, int subtype)
return false;
}
->>>>>>> 0.12
diff --git a/lib/common/Logging.h b/lib/common/Logging.h
index bc0203bb..1074b7c3 100644
--- a/lib/common/Logging.h
+++ b/lib/common/Logging.h
@@ -10,11 +10,8 @@
#ifndef LOGGING__H
#define LOGGING__H
-<<<<<<< HEAD
-=======
#include <assert.h>
->>>>>>> 0.12
#include <cerrno>
#include <cstring>
#include <iomanip>
@@ -46,33 +43,6 @@
if (Logging::IsEnabled(Log::TRACE)) \
{ BOX_LOG(Log::TRACE, stuff) }
-<<<<<<< HEAD
-#define BOX_SYS_ERROR(stuff) \
- stuff << ": " << std::strerror(errno) << " (" << errno << ")"
-
-#define BOX_LOG_SYS_WARNING(stuff) \
- BOX_WARNING(BOX_SYS_ERROR(stuff))
-#define BOX_LOG_SYS_ERROR(stuff) \
- BOX_ERROR(BOX_SYS_ERROR(stuff))
-#define BOX_LOG_SYS_FATAL(stuff) \
- BOX_FATAL(BOX_SYS_ERROR(stuff))
-
-#define LOG_AND_THROW_ERROR(message, filename, exception, subtype) \
- BOX_LOG_SYS_ERROR(message << ": " << filename); \
- THROW_EXCEPTION_MESSAGE(exception, subtype, \
- BOX_SYS_ERROR(message << ": " << filename));
-
-inline std::string GetNativeErrorMessage()
-{
-#ifdef WIN32
- return GetErrorMessage(GetLastError());
-#else
- std::ostringstream _box_log_line;
- _box_log_line << std::strerror(errno) << " (" << errno << ")";
- return _box_log_line.str();
-#endif
-}
-=======
#define BOX_SYS_ERRNO_MESSAGE(error_number, stuff) \
stuff << ": " << std::strerror(error_number) << \
" (" << error_number << ")"
@@ -113,7 +83,6 @@ inline std::string GetNativeErrorMessage()
#define THROW_FILE_ERROR(message, filename, exception, subtype) \
THROW_EXCEPTION_MESSAGE(exception, subtype, \
BOX_FILE_MESSAGE(filename, message))
->>>>>>> 0.12
#ifdef WIN32
#define BOX_LOG_WIN_ERROR(stuff) \
@@ -126,8 +95,6 @@ inline std::string GetNativeErrorMessage()
BOX_WARNING(stuff << ": " << GetErrorMessage(number))
#define BOX_LOG_NATIVE_ERROR(stuff) BOX_LOG_WIN_ERROR(stuff)
#define BOX_LOG_NATIVE_WARNING(stuff) BOX_LOG_WIN_WARNING(stuff)
-<<<<<<< HEAD
-=======
#define BOX_WIN_ERRNO_MESSAGE(error_number, stuff) \
stuff << ": " << GetErrorMessage(error_number)
#define THROW_WIN_ERROR_NUMBER(message, error_number, exception, subtype) \
@@ -139,17 +106,11 @@ inline std::string GetNativeErrorMessage()
#define THROW_WIN_FILE_ERROR(message, filename, exception, subtype) \
THROW_WIN_FILE_ERRNO(message, filename, GetLastError(), \
exception, subtype)
->>>>>>> 0.12
#else
#define BOX_LOG_NATIVE_ERROR(stuff) BOX_LOG_SYS_ERROR(stuff)
#define BOX_LOG_NATIVE_WARNING(stuff) BOX_LOG_SYS_WARNING(stuff)
#endif
-<<<<<<< HEAD
-#define BOX_LOG_SOCKET_ERROR(_type, _name, _port, stuff) \
- BOX_LOG_NATIVE_ERROR(stuff << " (type " << _type << ", name " << \
- _name << ", port " << _port << ")")
-=======
#ifdef WIN32
# define BOX_LOG_SOCKET_ERROR(_type, _name, _port, stuff) \
BOX_LOG_WIN_ERROR_NUMBER(stuff << " (type " << _type << ", name " << \
@@ -159,7 +120,6 @@ inline std::string GetNativeErrorMessage()
BOX_LOG_NATIVE_ERROR(stuff << " (type " << _type << ", name " << \
_name << ", port " << _port << ")")
#endif
->>>>>>> 0.12
#define BOX_FORMAT_HEX32(number) \
std::hex << \
@@ -184,15 +144,12 @@ inline std::string GetNativeErrorMessage()
std::setw(6) << \
timespec.tv_usec
-<<<<<<< HEAD
-=======
#define BOX_FORMAT_MICROSECONDS(t) \
(int)((t) / 1000000) << "." << \
std::setw(6) << \
std::setfill('0') << \
(int)((t) % 1000000) << " seconds"
->>>>>>> 0.12
#undef ERROR
namespace Log
@@ -240,10 +197,6 @@ class Logger
virtual const char* GetType() = 0;
Log::Level GetLevel() { return mCurrentLevel; }
-<<<<<<< HEAD
-
- virtual void SetProgramName(const std::string& rProgramName) = 0;
-=======
bool IsEnabled(Log::Level level);
virtual void SetProgramName(const std::string& rProgramName) = 0;
@@ -265,7 +218,6 @@ class Logger
mLogger.Filter(mOldLevel);
}
};
->>>>>>> 0.12
};
// --------------------------------------------------------------------------
@@ -373,42 +325,29 @@ class Logging
static void SetProgramName(const std::string& rProgramName);
static std::string GetProgramName() { return sProgramName; }
static void SetFacility(int facility);
-<<<<<<< HEAD
-=======
static Console& GetConsole() { return *spConsole; }
static Syslog& GetSyslog() { return *spSyslog; }
->>>>>>> 0.12
class Guard
{
private:
Log::Level mOldLevel;
-<<<<<<< HEAD
-=======
static int sGuardCount;
static Log::Level sOriginalLevel;
->>>>>>> 0.12
public:
Guard(Log::Level newLevel)
{
mOldLevel = Logging::GetGlobalLevel();
-<<<<<<< HEAD
-=======
if(sGuardCount == 0)
{
sOriginalLevel = mOldLevel;
}
sGuardCount++;
->>>>>>> 0.12
Logging::SetGlobalLevel(newLevel);
}
~Guard()
{
-<<<<<<< HEAD
- Logging::SetGlobalLevel(mOldLevel);
- }
-=======
sGuardCount--;
Logging::SetGlobalLevel(mOldLevel);
}
@@ -420,7 +359,6 @@ class Logging
return IsActive() &&
(int)sOriginalLevel >= (int)originalLevel;
}
->>>>>>> 0.12
};
class Tagger
@@ -429,11 +367,6 @@ class Logging
std::string mOldTag;
public:
-<<<<<<< HEAD
- Tagger(const std::string& rTempTag)
- {
- mOldTag = Logging::GetProgramName();
-=======
Tagger()
: mOldTag(Logging::GetProgramName())
{
@@ -441,21 +374,17 @@ class Logging
Tagger(const std::string& rTempTag)
: mOldTag(Logging::GetProgramName())
{
->>>>>>> 0.12
Logging::SetProgramName(mOldTag + " " + rTempTag);
}
~Tagger()
{
Logging::SetProgramName(mOldTag);
}
-<<<<<<< HEAD
-=======
void Change(const std::string& newTempTag)
{
Logging::SetProgramName(mOldTag + " " + newTempTag);
}
->>>>>>> 0.12
};
};
@@ -498,8 +427,6 @@ class HideExceptionMessageGuard
bool mOldHiddenState;
};
-<<<<<<< HEAD
-=======
class HideSpecificExceptionGuard
{
private:
@@ -524,7 +451,6 @@ class HideSpecificExceptionGuard
static bool IsHidden(int type, int subtype);
};
->>>>>>> 0.12
std::string PrintEscapedBinaryData(const std::string& rInput);
#endif // LOGGING__H
diff --git a/lib/common/MainHelper.h b/lib/common/MainHelper.h
index 453b5b5f..3c6e9ff0 100644
--- a/lib/common/MainHelper.h
+++ b/lib/common/MainHelper.h
@@ -12,16 +12,12 @@
#include <stdio.h>
-<<<<<<< HEAD
-#include "BoxException.h"
-=======
#ifdef NEED_BOX_VERSION_H
# include "BoxVersion.h"
#endif
#include "BoxException.h"
#include "Logging.h"
->>>>>>> 0.12
#define MAINHELPER_START \
if(argc == 2 && ::strcmp(argv[1], "--version") == 0) \
@@ -29,18 +25,6 @@
MEMLEAKFINDER_INIT \
MEMLEAKFINDER_START \
try {
-<<<<<<< HEAD
-#define MAINHELPER_END \
- } catch(BoxException &e) { \
- printf("Exception: %s (%d/%d)\n", e.what(), e.GetType(), e.GetSubType()); \
- return 1; \
- } catch(std::exception &e) { \
- printf("Exception: %s\n", e.what()); \
- return 1; \
- } catch(...) { \
- printf("Exception: <UNKNOWN>\n"); \
- return 1; }
-=======
#define MAINHELPER_END \
} catch(std::exception &e) { \
@@ -50,7 +34,6 @@
BOX_FATAL("UNKNOWN"); \
return 1; \
}
->>>>>>> 0.12
#ifdef BOX_MEMORY_LEAK_TESTING
#define MAINHELPER_SETUP_MEMORY_LEAK_EXIT_REPORT(file, marker) \
diff --git a/lib/common/MemBlockStream.cpp b/lib/common/MemBlockStream.cpp
index 554fc6ae..3a43a304 100644
--- a/lib/common/MemBlockStream.cpp
+++ b/lib/common/MemBlockStream.cpp
@@ -22,8 +22,6 @@
//
// Function
// Name: MemBlockStream::MemBlockStream()
-<<<<<<< HEAD
-=======
// Purpose: Constructor with no contents
// Created: 2012/11/07
//
@@ -38,7 +36,6 @@ MemBlockStream::MemBlockStream()
//
// Function
// Name: MemBlockStream::MemBlockStream()
->>>>>>> 0.12
// Purpose: Constructor (doesn't copy block, careful with lifetimes)
// Created: 2003/09/05
//
@@ -86,10 +83,6 @@ MemBlockStream::MemBlockStream(const CollectInBufferStream &rBuffer)
ASSERT(mBytesInBuffer >= 0);
}
-<<<<<<< HEAD
-
-=======
->>>>>>> 0.12
// --------------------------------------------------------------------------
//
// Function
diff --git a/lib/common/MemBlockStream.h b/lib/common/MemBlockStream.h
index ed0bf4ff..5234525b 100644
--- a/lib/common/MemBlockStream.h
+++ b/lib/common/MemBlockStream.h
@@ -27,10 +27,7 @@ class CollectInBufferStream;
class MemBlockStream : public IOStream
{
public:
-<<<<<<< HEAD
-=======
MemBlockStream();
->>>>>>> 0.12
MemBlockStream(const void *pBuffer, int Size);
MemBlockStream(const StreamableMemBlock &rBlock);
MemBlockStream(const CollectInBufferStream &rBuffer);
@@ -45,11 +42,8 @@ public:
virtual void Seek(pos_type Offset, int SeekType);
virtual bool StreamDataLeft();
virtual bool StreamClosed();
-<<<<<<< HEAD
-=======
virtual const void* GetBuffer() const { return mpBuffer; }
virtual int GetSize() const { return mBytesInBuffer; }
->>>>>>> 0.12
private:
const char *mpBuffer;
diff --git a/lib/common/MemLeakFinder.h b/lib/common/MemLeakFinder.h
index e4e9a1ae..1a2cf90c 100644
--- a/lib/common/MemLeakFinder.h
+++ b/lib/common/MemLeakFinder.h
@@ -28,10 +28,7 @@ class MemLeakSuppressionGuard
extern "C"
{
void *memleakfinder_malloc(size_t size, const char *file, int line);
-<<<<<<< HEAD
-=======
void *memleakfinder_calloc(size_t blocks, size_t size, const char *file, int line);
->>>>>>> 0.12
void *memleakfinder_realloc(void *ptr, size_t size);
void memleakfinder_free(void *ptr);
}
@@ -40,11 +37,8 @@ void memleakfinder_init();
int memleakfinder_numleaks();
-<<<<<<< HEAD
-=======
void memleakfinder_report_usage_summary();
->>>>>>> 0.12
void memleakfinder_reportleaks();
void memleakfinder_reportleaks_appendfile(const char *filename, const char *markertext);
@@ -63,10 +57,7 @@ void *operator new[](size_t size, const char *file, int line);
// define the malloc functions now, if required
#ifdef MEMLEAKFINDER_FULL_MALLOC_MONITORING
#define malloc(X) memleakfinder_malloc(X, __FILE__, __LINE__)
-<<<<<<< HEAD
-=======
#define calloc(X, Y) memleakfinder_calloc(X, Y, __FILE__, __LINE__)
->>>>>>> 0.12
#define realloc memleakfinder_realloc
#define free memleakfinder_free
#define MEMLEAKFINDER_MALLOC_MONITORING_DEFINED
diff --git a/lib/common/StreamableMemBlock.cpp b/lib/common/StreamableMemBlock.cpp
index ce2e1f98..b376f037 100644
--- a/lib/common/StreamableMemBlock.cpp
+++ b/lib/common/StreamableMemBlock.cpp
@@ -3,10 +3,7 @@
// File
// Name: StreamableMemBlock.cpp
// Purpose: Memory blocks which can be loaded and saved from streams
-<<<<<<< HEAD
-=======
// with a header indicating the size of the block.
->>>>>>> 0.12
// Created: 2003/09/05
//
// --------------------------------------------------------------------------
diff --git a/lib/common/StreamableMemBlock.h b/lib/common/StreamableMemBlock.h
index 3fcc62b3..6c1c5ab8 100644
--- a/lib/common/StreamableMemBlock.h
+++ b/lib/common/StreamableMemBlock.h
@@ -2,12 +2,8 @@
//
// File
// Name: StreamableMemBlock.h
-<<<<<<< HEAD
-// Purpose: Memory blocks which can be loaded and saved from streams
-=======
// Purpose: Memory blocks which can be loaded and saved from streams,
// with a header indicating the size of the block.
->>>>>>> 0.12
// Created: 2003/09/05
//
// --------------------------------------------------------------------------
diff --git a/lib/common/TemporaryDirectory.h b/lib/common/TemporaryDirectory.h
deleted file mode 100644
index 9d52ecd9..00000000
--- a/lib/common/TemporaryDirectory.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// --------------------------------------------------------------------------
-//
-// File
-// Name: TemporaryDirectory.h
-// Purpose: Location of temporary directory
-// Created: 2003/10/13
-//
-// --------------------------------------------------------------------------
-
-#ifndef TEMPORARYDIRECTORY__H
-#define TEMPORARYDIRECTORY__H
-
-#include <string>
-
-#ifdef WIN32
- #include <windows.h>
-#endif
-
-// Prefix name with Box to avoid clashing with OS API names
-std::string BoxGetTemporaryDirectoryName()
-{
-#ifdef WIN32
- // http://msdn.microsoft.com/library/default.asp?
- // url=/library/en-us/fileio/fs/creating_and_using_a_temporary_file.asp
-
- DWORD dwRetVal;
- char lpPathBuffer[1024];
- DWORD dwBufSize = sizeof(lpPathBuffer);
-
- // Get the temp path.
- dwRetVal = GetTempPath(dwBufSize, // length of the buffer
- lpPathBuffer); // buffer for path
- if (dwRetVal > dwBufSize)
- {
- THROW_EXCEPTION(CommonException, TempDirPathTooLong)
- }
-
- return std::string(lpPathBuffer);
-#elif defined TEMP_DIRECTORY_NAME
- return std::string(TEMP_DIRECTORY_NAME);
-#else
- #error non-static temporary directory names not supported yet
-#endif
-}
-
-#endif // TEMPORARYDIRECTORY__H
diff --git a/lib/common/Test.cpp b/lib/common/Test.cpp
index b627ac18..de87c465 100644
--- a/lib/common/Test.cpp
+++ b/lib/common/Test.cpp
@@ -21,10 +21,7 @@
#include <unistd.h>
#endif
-<<<<<<< HEAD
-=======
#include "BoxTime.h"
->>>>>>> 0.12
#include "Test.h"
bool TestFileExists(const char *Filename)
@@ -47,17 +44,10 @@ bool TestDirExists(const char *Filename)
}
// -1 if doesn't exist
-<<<<<<< HEAD
-int TestGetFileSize(const char *Filename)
-{
- EMU_STRUCT_STAT st;
- if(EMU_STAT(Filename, &st) == 0)
-=======
int TestGetFileSize(const std::string& Filename)
{
EMU_STRUCT_STAT st;
if(EMU_STAT(Filename.c_str(), &st) == 0)
->>>>>>> 0.12
{
return st.st_size;
}
@@ -462,40 +452,6 @@ void wait_for_operation(int seconds, const char* message)
void safe_sleep(int seconds)
{
-<<<<<<< HEAD
- BOX_TRACE("sleeping for " << seconds << " seconds");
-
-#ifdef WIN32
- Sleep(seconds * 1000);
-#else
- struct timespec ts;
- memset(&ts, 0, sizeof(ts));
- ts.tv_sec = seconds;
- ts.tv_nsec = 0;
- while (nanosleep(&ts, &ts) == -1 && errno == EINTR)
- {
- // FIXME evil hack for OSX, where ts.tv_sec contains
- // a negative number interpreted as unsigned 32-bit
- // when nanosleep() returns later than expected.
-
- int32_t secs = (int32_t) ts.tv_sec;
- int64_t remain_ns = (secs * 1000000000) + ts.tv_nsec;
-
- if (remain_ns < 0)
- {
- BOX_WARNING("nanosleep interrupted " <<
- ((float)(0 - remain_ns) / 1000000000) <<
- " secs late");
- return;
- }
-
- BOX_TRACE("nanosleep interrupted with " <<
- (remain_ns / 1000000000) << " secs remaining, "
- "sleeping again");
- }
-#endif
-=======
ShortSleep(SecondsToBoxTime(seconds), true);
->>>>>>> 0.12
}
diff --git a/lib/common/Test.h b/lib/common/Test.h
index a09a64af..f318c811 100644
--- a/lib/common/Test.h
+++ b/lib/common/Test.h
@@ -51,33 +51,6 @@ extern std::string bbackupd_args, bbstored_args, bbackupquery_args, test_args;
#define TEST_THAT_ABORTONFAIL(condition) {if(!(condition)) TEST_ABORT_WITH_MESSAGE("Condition [" #condition "] failed")}
// NOTE: The 0- bit is to allow this to work with stuff which has negative constants for flags (eg ConnectionException)
-<<<<<<< HEAD
-#define TEST_CHECK_THROWS(statement, excepttype, subtype) \
- { \
- bool didthrow = false; \
- HideExceptionMessageGuard hide; \
- try \
- { \
- statement; \
- } \
- catch(excepttype &e) \
- { \
- if(e.GetSubType() != ((unsigned int)excepttype::subtype) \
- && e.GetSubType() != (unsigned int)(0-excepttype::subtype)) \
- { \
- throw; \
- } \
- didthrow = true; \
- } \
- catch(...) \
- { \
- throw; \
- } \
- if(!didthrow) \
- { \
- TEST_FAIL_WITH_MESSAGE("Didn't throw exception " #excepttype "(" #subtype ")") \
- } \
-=======
#define TEST_CHECK_THROWS(statement, excepttype, subtype) \
{ \
bool didthrow = false; \
@@ -105,7 +78,6 @@ extern std::string bbackupd_args, bbstored_args, bbackupquery_args, test_args;
{ \
TEST_FAIL_WITH_MESSAGE("Didn't throw exception " #excepttype "(" #subtype ")") \
} \
->>>>>>> 0.12
}
// utility macro for comparing two strings in a line
@@ -121,11 +93,7 @@ extern std::string bbackupd_args, bbstored_args, bbackupquery_args, test_args;
\
if(_exp_str != _found_str) \
{ \
-<<<<<<< HEAD
- BOX_WARNING("Expected <" << _exp_str << "> but found <" << \
-=======
BOX_ERROR("Expected <" << _exp_str << "> but found <" << \
->>>>>>> 0.12
_found_str << ">"); \
\
std::ostringstream _oss3; \
@@ -161,34 +129,22 @@ extern std::string bbackupd_args, bbstored_args, bbackupquery_args, test_args;
} \
}
-<<<<<<< HEAD
-
-=======
->>>>>>> 0.12
// utility macro for testing a line
#define TEST_LINE(_condition, _line) \
TEST_THAT(_condition); \
if (!(_condition)) \
{ \
-<<<<<<< HEAD
- printf("Test failed on <%s>\n", _line.c_str()); \
-=======
std::ostringstream _ossl; \
_ossl << _line; \
std::string _line_str = _ossl.str(); \
printf("Test failed on <%s>\n", _line_str.c_str()); \
->>>>>>> 0.12
}
bool TestFileExists(const char *Filename);
bool TestDirExists(const char *Filename);
// -1 if doesn't exist
-<<<<<<< HEAD
-int TestGetFileSize(const char *Filename);
-=======
int TestGetFileSize(const std::string& Filename);
->>>>>>> 0.12
std::string ConvertPaths(const std::string& rOriginal);
int RunCommand(const std::string& rCommandLine);
bool ServerIsAlive(int pid);
diff --git a/lib/common/Timer.cpp b/lib/common/Timer.cpp
index 390ddf8e..ad6b5e8d 100644
--- a/lib/common/Timer.cpp
+++ b/lib/common/Timer.cpp
@@ -8,14 +8,6 @@
//
// --------------------------------------------------------------------------
-<<<<<<< HEAD
-#ifdef WIN32
- #define _WIN32_WINNT 0x0500
-#endif
-
-#include "Box.h"
-
-=======
#include "Box.h"
#ifdef WIN32
@@ -26,7 +18,6 @@
# endif
#endif
->>>>>>> 0.12
#include <signal.h>
#include <cstring>
@@ -39,11 +30,7 @@ std::vector<Timer*>* Timers::spTimers = NULL;
bool Timers::sRescheduleNeeded = false;
#define TIMER_ID "timer " << mName << " (" << this << ") "
-<<<<<<< HEAD
-#define TIMER_ID_OF(t) "timer " << (t).GetName() << " (" << &(t) << ") "
-=======
#define TIMER_ID_OF(t) "timer " << (t).GetName() << " (" << &(t) << ")"
->>>>>>> 0.12
typedef void (*sighandler_t)(int);
@@ -132,10 +119,7 @@ void Timers::Add(Timer& rTimer)
{
ASSERT(spTimers);
ASSERT(&rTimer);
-<<<<<<< HEAD
-=======
BOX_TRACE(TIMER_ID_OF(rTimer) " added to global queue, rescheduling");
->>>>>>> 0.12
spTimers->push_back(&rTimer);
Reschedule();
}
@@ -153,10 +137,7 @@ void Timers::Remove(Timer& rTimer)
{
ASSERT(spTimers);
ASSERT(&rTimer);
-<<<<<<< HEAD
-=======
BOX_TRACE(TIMER_ID_OF(rTimer) " removed from global queue, rescheduling");
->>>>>>> 0.12
bool restart = true;
while (restart)
@@ -191,13 +172,6 @@ void Timers::RescheduleIfNeeded()
}
}
-<<<<<<< HEAD
-#define FORMAT_MICROSECONDS(t) \
- (int)(t / 1000000) << "." << \
- (int)(t % 1000000) << " seconds"
-
-=======
->>>>>>> 0.12
// --------------------------------------------------------------------------
//
// Function
@@ -260,19 +234,9 @@ void Timers::Reschedule()
if (timeToExpiry <= 0)
{
-<<<<<<< HEAD
- /*
- BOX_TRACE("timer " << *i << " has expired, "
- "triggering it");
- */
- BOX_TRACE(TIMER_ID_OF(**i) "has expired, "
- "triggering " <<
- FORMAT_MICROSECONDS(-timeToExpiry) <<
-=======
BOX_TRACE(TIMER_ID_OF(**i) " has expired, "
"triggering " <<
BOX_FORMAT_MICROSECONDS(-timeToExpiry) <<
->>>>>>> 0.12
" late");
rTimer.OnExpire();
spTimers->erase(i);
@@ -282,13 +246,8 @@ void Timers::Reschedule()
else
{
/*
-<<<<<<< HEAD
- BOX_TRACE("timer " << *i << " has not "
- "expired, triggering in " <<
-=======
BOX_TRACE(TIMER_ID_OF(**i) " has not expired, "
"triggering in " <<
->>>>>>> 0.12
FORMAT_MICROSECONDS(timeToExpiry) <<
" seconds");
*/
@@ -329,13 +288,8 @@ void Timers::Reschedule()
}
else
{
-<<<<<<< HEAD
- BOX_TRACE("timer: next event: " << nameOfNextEvent <<
- " expires in " << FORMAT_MICROSECONDS(timeToNextEvent));
-=======
BOX_TRACE("timer: next event: " << nameOfNextEvent << " at " <<
FormatTime(timeNow + timeToNextEvent, false, true));
->>>>>>> 0.12
}
struct itimerval timeout;
@@ -375,11 +329,7 @@ void Timers::SignalHandler(int unused)
// --------------------------------------------------------------------------
//
// Function
-<<<<<<< HEAD
-// Name: Timer::Timer(size_t timeoutSecs,
-=======
// Name: Timer::Timer(size_t timeoutMillis,
->>>>>>> 0.12
// const std::string& rName)
// Purpose: Standard timer constructor, takes a timeout in
// seconds from now, and an optional name for
@@ -388,161 +338,82 @@ void Timers::SignalHandler(int unused)
//
// --------------------------------------------------------------------------
-<<<<<<< HEAD
-Timer::Timer(size_t timeoutSecs, const std::string& rName)
-: mExpires(GetCurrentBoxTime() + SecondsToBoxTime(timeoutSecs)),
-=======
Timer::Timer(size_t timeoutMillis, const std::string& rName)
: mExpires(0),
->>>>>>> 0.12
mExpired(false),
mName(rName)
#ifdef WIN32
, mTimerHandle(INVALID_HANDLE_VALUE)
#endif
{
-<<<<<<< HEAD
- #ifndef BOX_RELEASE_BUILD
- if (timeoutSecs == 0)
- {
- BOX_TRACE(TIMER_ID "initialised for " << timeoutSecs <<
- " secs, will not fire");
- }
- else
- {
- BOX_TRACE(TIMER_ID "initialised for " << timeoutSecs <<
- " secs, to fire at " << FormatTime(mExpires, false, true));
- }
- #endif
-
- if (timeoutSecs == 0)
- {
- mExpires = 0;
- }
- else
- {
- Timers::Add(*this);
- Start(timeoutSecs * MICRO_SEC_IN_SEC_LL);
- }
-=======
Set(timeoutMillis, true /* isInit */);
->>>>>>> 0.12
}
// --------------------------------------------------------------------------
//
// Function
// Name: Timer::Start()
-<<<<<<< HEAD
-// Purpose: This internal function initialises an OS TimerQueue
-// timer on Windows, while on Unixes there is only a
-// single global timer, managed by the Timers class,
-// so this method does nothing.
-=======
// Purpose: This internal function recalculates the remaining
// time (timeout) from the expiry time, and then calls
// Start(timeoutMillis).
->>>>>>> 0.12
// Created: 27/07/2008
//
// --------------------------------------------------------------------------
void Timer::Start()
{
-<<<<<<< HEAD
-#ifdef WIN32
-=======
->>>>>>> 0.12
box_time_t timeNow = GetCurrentBoxTime();
int64_t timeToExpiry = mExpires - timeNow;
if (timeToExpiry <= 0)
{
BOX_WARNING(TIMER_ID << "fudging expiry from -" <<
-<<<<<<< HEAD
- FORMAT_MICROSECONDS(-timeToExpiry))
- timeToExpiry = 1;
- }
-
- Start(timeToExpiry);
-#endif
-=======
BOX_FORMAT_MICROSECONDS(-timeToExpiry))
timeToExpiry = 1;
}
Start(timeToExpiry / MICRO_SEC_IN_MILLI_SEC);
->>>>>>> 0.12
}
// --------------------------------------------------------------------------
//
// Function
-<<<<<<< HEAD
-// Name: Timer::Start(int64_t delayInMicros)
-// Purpose: This internal function initialises an OS TimerQueue
-// timer on Windows, with a specified delay already
-// calculated to save us doing it again. Like
-// Timer::Start(), on Unixes it does nothing.
-=======
// Name: Timer::Start(int64_t timeoutMillis)
// Purpose: This internal function adds this timer to the global
// timer list, and on Windows it initialises an OS
// TimerQueue timer for it.
->>>>>>> 0.12
// Created: 27/07/2008
//
// --------------------------------------------------------------------------
-<<<<<<< HEAD
-void Timer::Start(int64_t delayInMicros)
-{
-=======
void Timer::Start(int64_t timeoutMillis)
{
ASSERT(mExpires != 0);
Timers::Add(*this);
->>>>>>> 0.12
#ifdef WIN32
// only call me once!
ASSERT(mTimerHandle == INVALID_HANDLE_VALUE);
-<<<<<<< HEAD
- int64_t delayInMillis = delayInMicros / 1000;
-
-=======
->>>>>>> 0.12
// Windows XP always seems to fire timers up to 20 ms late,
// at least on my test laptop. Not critical in practice, but our
// tests are precise enough that they will fail if we don't
// correct for it.
-<<<<<<< HEAD
- delayInMillis -= 20;
-
- // Set a system timer to call our timer routine
- if (CreateTimerQueueTimer(&mTimerHandle, NULL, TimerRoutine,
- (PVOID)this, delayInMillis, 0, WT_EXECUTEINTIMERTHREAD)
-=======
timeoutMillis -= 20;
// Set a system timer to call our timer routine
if (CreateTimerQueueTimer(&mTimerHandle, NULL, TimerRoutine,
(PVOID)this, timeoutMillis, 0, WT_EXECUTEINTIMERTHREAD)
->>>>>>> 0.12
== FALSE)
{
BOX_ERROR(TIMER_ID "failed to create timer: " <<
GetErrorMessage(GetLastError()));
mTimerHandle = INVALID_HANDLE_VALUE;
}
-<<<<<<< HEAD
-=======
else
{
BOX_INFO(TIMER_ID << "set for " << timeoutMillis << " ms");
}
->>>>>>> 0.12
#endif
}
@@ -550,29 +421,20 @@ void Timer::Start(int64_t timeoutMillis)
//
// Function
// Name: Timer::Stop()
-<<<<<<< HEAD
-// Purpose: This internal function deletes the associated OS
-// TimerQueue timer on Windows, and on Unixes does
-// nothing.
-=======
// Purpose: This internal function removes us from the global
// list of timers, resets our expiry time, and on
// Windows it deletes the associated OS TimerQueue timer.
->>>>>>> 0.12
// Created: 27/07/2008
//
// --------------------------------------------------------------------------
void Timer::Stop()
{
-<<<<<<< HEAD
-=======
if (mExpires != 0)
{
Timers::Remove(*this);
}
->>>>>>> 0.12
#ifdef WIN32
if (mTimerHandle != INVALID_HANDLE_VALUE)
{
@@ -602,12 +464,6 @@ Timer::~Timer()
BOX_TRACE(TIMER_ID "destroyed");
#endif
-<<<<<<< HEAD
- Timers::Remove(*this);
- Stop();
-}
-
-=======
Stop();
}
@@ -632,7 +488,6 @@ void Timer::LogAssignment(const Timer &From)
#endif
}
->>>>>>> 0.12
// --------------------------------------------------------------------------
//
// Function
@@ -652,36 +507,10 @@ Timer::Timer(const Timer& rToCopy)
, mTimerHandle(INVALID_HANDLE_VALUE)
#endif
{
-<<<<<<< HEAD
- #ifndef BOX_RELEASE_BUILD
- if (mExpired)
- {
- BOX_TRACE(TIMER_ID "initialised from timer " << &rToCopy << ", "
- "already expired, will not fire");
- }
- else if (mExpires == 0)
- {
- BOX_TRACE(TIMER_ID "initialised from timer " << &rToCopy << ", "
- "no expiry, will not fire");
- }
- else
- {
- BOX_TRACE(TIMER_ID "initialised from timer " << &rToCopy << ", "
- "to fire at " <<
- (int)(mExpires / 1000000) << "." <<
- (int)(mExpires % 1000000));
- }
- #endif
-
- if (!mExpired && mExpires != 0)
- {
- Timers::Add(*this);
-=======
LogAssignment(rToCopy);
if (!mExpired && mExpires != 0)
{
->>>>>>> 0.12
Start();
}
}
@@ -700,32 +529,8 @@ Timer::Timer(const Timer& rToCopy)
Timer& Timer::operator=(const Timer& rToCopy)
{
-<<<<<<< HEAD
- #ifndef BOX_RELEASE_BUILD
- if (rToCopy.mExpired)
- {
- BOX_TRACE(TIMER_ID "initialised from timer " << &rToCopy << ", "
- "already expired, will not fire");
- }
- else if (rToCopy.mExpires == 0)
- {
- BOX_TRACE(TIMER_ID "initialised from timer " << &rToCopy << ", "
- "no expiry, will not fire");
- }
- else
- {
- BOX_TRACE(TIMER_ID "initialised from timer " << &rToCopy << ", "
- "to fire at " <<
- (int)(rToCopy.mExpires / 1000000) << "." <<
- (int)(rToCopy.mExpires % 1000000));
- }
- #endif
-
- Timers::Remove(*this);
-=======
LogAssignment(rToCopy);
->>>>>>> 0.12
Stop();
mExpires = rToCopy.mExpires;
@@ -734,10 +539,6 @@ Timer& Timer::operator=(const Timer& rToCopy)
if (!mExpired && mExpires != 0)
{
-<<<<<<< HEAD
- Timers::Add(*this);
-=======
->>>>>>> 0.12
Start();
}
@@ -747,8 +548,6 @@ Timer& Timer::operator=(const Timer& rToCopy)
// --------------------------------------------------------------------------
//
// Function
-<<<<<<< HEAD
-=======
// Name: Timer::Reset(size_t timeoutMillis)
// Purpose: Simple reset operation for an existing Timer. Avoids
// the need to create a temporary timer just to modify
@@ -810,7 +609,6 @@ void Timer::Set(size_t timeoutMillis, bool isInit)
// --------------------------------------------------------------------------
//
// Function
->>>>>>> 0.12
// Name: Timer::OnExpire()
// Purpose: Method called by Timers::Reschedule (on Unixes)
// on next poll after timer expires, or from
diff --git a/lib/common/Timer.h b/lib/common/Timer.h
index d3e46b2a..09be58fa 100644
--- a/lib/common/Timer.h
+++ b/lib/common/Timer.h
@@ -53,11 +53,7 @@ class Timers
class Timer
{
public:
-<<<<<<< HEAD
- Timer(size_t timeoutSecs, const std::string& rName = "");
-=======
Timer(size_t timeoutMillis, const std::string& rName = "");
->>>>>>> 0.12
virtual ~Timer();
Timer(const Timer &);
Timer &operator=(const Timer &);
@@ -71,10 +67,7 @@ public:
}
const std::string& GetName() const { return mName; }
-<<<<<<< HEAD
-=======
virtual void Reset(size_t timeoutMillis);
->>>>>>> 0.12
private:
box_time_t mExpires;
@@ -82,15 +75,10 @@ private:
std::string mName;
void Start();
-<<<<<<< HEAD
- void Start(int64_t delayInMicros);
- void Stop();
-=======
void Start(int64_t timeoutMillis);
void Stop();
void LogAssignment(const Timer &From);
virtual void Set(size_t timeoutMillis, bool isReset);
->>>>>>> 0.12
#ifdef WIN32
HANDLE mTimerHandle;
diff --git a/lib/common/UnixUser.cpp b/lib/common/UnixUser.cpp
index 7e69b10a..32acacfa 100644
--- a/lib/common/UnixUser.cpp
+++ b/lib/common/UnixUser.cpp
@@ -31,21 +31,13 @@
// Created: 21/1/04
//
// --------------------------------------------------------------------------
-<<<<<<< HEAD
-UnixUser::UnixUser(const char *Username)
-=======
UnixUser::UnixUser(const std::string& Username)
->>>>>>> 0.12
: mUID(0),
mGID(0),
mRevertOnDestruction(false)
{
// Get password info
-<<<<<<< HEAD
- struct passwd *pwd = ::getpwnam(Username);
-=======
struct passwd *pwd = ::getpwnam(Username.c_str());
->>>>>>> 0.12
if(pwd == 0)
{
THROW_EXCEPTION(CommonException, CouldNotLookUpUsername)
diff --git a/lib/common/UnixUser.h b/lib/common/UnixUser.h
index 361971b8..dafe6aa7 100644
--- a/lib/common/UnixUser.h
+++ b/lib/common/UnixUser.h
@@ -13,11 +13,7 @@
class UnixUser
{
public:
-<<<<<<< HEAD
- UnixUser(const char *Username);
-=======
UnixUser(const std::string& Username);
->>>>>>> 0.12
UnixUser(uid_t UID, gid_t GID);
~UnixUser();
private:
diff --git a/lib/common/Utils.cpp b/lib/common/Utils.cpp
index 3137d980..decc80e8 100644
--- a/lib/common/Utils.cpp
+++ b/lib/common/Utils.cpp
@@ -24,11 +24,6 @@
#include <cxxabi.h>
#endif
-<<<<<<< HEAD
-#include "Utils.h"
-#include "CommonException.h"
-#include "Logging.h"
-=======
#ifdef HAVE_DLFCN_H
#include <dlfcn.h>
#endif
@@ -40,7 +35,6 @@
#include "CommonException.h"
#include "Logging.h"
#include "Utils.h"
->>>>>>> 0.12
#include "MemLeakFindOn.h"
@@ -87,14 +81,6 @@ void SplitString(const std::string &String, char SplitOn, std::vector<std::strin
}
#ifdef SHOW_BACKTRACE_ON_EXCEPTION
-<<<<<<< HEAD
-void DumpStackBacktrace()
-{
- void *array[10];
- size_t size = backtrace (array, 10);
- char **strings = backtrace_symbols (array, size);
-
-=======
static std::string demangle(const std::string& mangled_name)
{
#ifdef HAVE_CXXABI_H
@@ -159,85 +145,10 @@ void DumpStackBacktrace()
{
void *array[10];
size_t size = backtrace(array, 10);
->>>>>>> 0.12
BOX_TRACE("Obtained " << size << " stack frames.");
for(size_t i = 0; i < size; i++)
{
-<<<<<<< HEAD
- // Demangling code copied from
- // cctbx_sources/boost_adaptbx/meta_ext.cpp, BSD license
-
- std::string mangled_frame = strings[i];
- std::string output_frame = strings[i]; // default
-
- #ifdef HAVE_CXXABI_H
- int start = mangled_frame.find('(');
- int end = mangled_frame.find('+', start);
- std::string mangled_func = mangled_frame.substr(start + 1,
- end - start - 1);
-
- int status;
-
-#include "MemLeakFindOff.h"
- char* result = abi::__cxa_demangle(mangled_func.c_str(),
- NULL, NULL, &status);
-#include "MemLeakFindOn.h"
-
- if (result == NULL)
- {
- if (status == 0)
- {
- BOX_WARNING("Demangle failed but no error: " <<
- mangled_func);
- }
- else if (status == -1)
- {
- BOX_WARNING("Demangle failed with "
- "memory allocation error: " <<
- mangled_func);
- }
- else if (status == -2)
- {
- // Probably non-C++ name, don't demangle
- /*
- BOX_WARNING("Demangle failed with "
- "with invalid name: " <<
- mangled_func);
- */
- }
- else if (status == -3)
- {
- BOX_WARNING("Demangle failed with "
- "with invalid argument: " <<
- mangled_func);
- }
- else
- {
- BOX_WARNING("Demangle failed with "
- "with unknown error " << status <<
- ": " << mangled_func);
- }
- }
- else
- {
- output_frame = mangled_frame.substr(0, start + 1) +
- result + mangled_frame.substr(end);
-#include "MemLeakFindOff.h"
- std::free(result);
-#include "MemLeakFindOn.h"
- }
- #endif // HAVE_CXXABI_H
-
- BOX_TRACE("Stack frame " << i << ": " << output_frame);
- }
-
-#include "MemLeakFindOff.h"
- std::free (strings);
-#include "MemLeakFindOn.h"
-}
-#endif
-=======
std::ostringstream output;
output << "Stack frame " << i << ": ";
@@ -270,7 +181,6 @@ void DumpStackBacktrace()
}
}
#endif // SHOW_BACKTRACE_ON_EXCEPTION
->>>>>>> 0.12
@@ -429,8 +339,6 @@ std::string FormatUsageLineStart(const std::string& rName,
return result.str();
}
-<<<<<<< HEAD
-=======
std::string BoxGetTemporaryDirectoryName()
{
@@ -459,4 +367,3 @@ std::string BoxGetTemporaryDirectoryName()
}
->>>>>>> 0.12
diff --git a/lib/common/Utils.h b/lib/common/Utils.h
index 8a938981..3134245a 100644
--- a/lib/common/Utils.h
+++ b/lib/common/Utils.h
@@ -39,11 +39,8 @@ std::string FormatUsageBar(int64_t Blocks, int64_t Bytes, int64_t Max,
std::string FormatUsageLineStart(const std::string& rName,
bool MachineReadable);
-<<<<<<< HEAD
-=======
std::string BoxGetTemporaryDirectoryName();
->>>>>>> 0.12
#include "MemLeakFindOff.h"
#endif // UTILS__H
diff --git a/lib/common/ZeroStream.cpp b/lib/common/ZeroStream.cpp
index 26fd62cb..d11ed80c 100644
--- a/lib/common/ZeroStream.cpp
+++ b/lib/common/ZeroStream.cpp
@@ -152,11 +152,7 @@ void ZeroStream::Close()
// --------------------------------------------------------------------------
bool ZeroStream::StreamDataLeft()
{
-<<<<<<< HEAD
- return false;
-=======
return (BytesLeftToRead() > 0);
->>>>>>> 0.12
}
// --------------------------------------------------------------------------
diff --git a/lib/common/makeexception.pl.in b/lib/common/makeexception.pl.in
index 593740da..b1b3a8ac 100755
--- a/lib/common/makeexception.pl.in
+++ b/lib/common/makeexception.pl.in
@@ -191,11 +191,7 @@ unsigned int ${class}Exception::GetSubType() const throw()
const char *${class}Exception::what() const throw()
{
#ifdef EXCEPTION_CODENAMES_EXTENDED
-<<<<<<< HEAD
- if(mSubType < 0 || mSubType > (sizeof(whats) / sizeof(whats[0])))
-=======
if(mSubType > (sizeof(whats) / sizeof(whats[0])))
->>>>>>> 0.12
{
return "${class}";
}