Replace calls to deprecated siginterrupt()

This commit is contained in:
Vinnie Falco
2013-07-08 07:28:59 -07:00
parent 5855e8d0cf
commit 9746861e46
5 changed files with 29 additions and 10 deletions

View File

@@ -32,7 +32,7 @@ public:
stopReadOperation (false)
{
signal (SIGPIPE, signalHandler);
siginterrupt (SIGPIPE, 1);
beast_siginterrupt (SIGPIPE, 1);
}
~Pimpl()

View File

@@ -174,6 +174,21 @@ bool File::setAsCurrentWorkingDirectory() const
return chdir (getFullPathName().toUTF8()) == 0;
}
//==============================================================================
// The unix siginterrupt function is deprecated - this does the same job.
int beast_siginterrupt (int sig, int flag)
{
struct ::sigaction act;
(void) ::sigaction (sig, nullptr, &act);
if (flag != 0)
act.sa_flags &= ~SA_RESTART;
else
act.sa_flags |= SA_RESTART;
return ::sigaction (sig, &act, nullptr);
}
//==============================================================================
namespace
{

View File

@@ -209,13 +209,15 @@ template <> struct BeastStaticAssert <true> { static void dummy() {} };
//------------------------------------------------------------------------------
// Cross-compiler deprecation macros..
#if DOXYGEN || (BEAST_MSVC && ! BEAST_NO_DEPRECATION_WARNINGS)
/** This can be used to wrap a function which has been deprecated. */
# define BEAST_DEPRECATED(functionDef) __declspec(deprecated) functionDef
#elif BEAST_GCC && ! BEAST_NO_DEPRECATION_WARNINGS
# define BEAST_DEPRECATED(functionDef) functionDef __attribute__ ((deprecated))
#ifdef DOXYGEN
/** This macro can be used to wrap a function which has been deprecated. */
#define BEAST_DEPRECATED(functionDef)
#elif BEAST_MSVC && ! BEAST_NO_DEPRECATION_WARNINGS
#define BEAST_DEPRECATED(functionDef) __declspec(deprecated) functionDef
#elif BEAST_GCC && ! BEAST_NO_DEPRECATION_WARNINGS
#define BEAST_DEPRECATED(functionDef) functionDef __attribute__ ((deprecated))
#else
# define BEAST_DEPRECATED(functionDef) functionDef
#define BEAST_DEPRECATED(functionDef) functionDef
#endif
//------------------------------------------------------------------------------

View File

@@ -79,7 +79,7 @@ String SystemStats::getStackBacktrace()
int frames = (int) CaptureStackBackTrace (0, numElementsInArray (stack), stack, nullptr);
HeapBlock<SYMBOL_INFO> symbol;
symbol.calloc (sizeof(SYMBOL_INFO) + 256, 1);
symbol.calloc (sizeof (SYMBOL_INFO) + 256, 1);
symbol->MaxNameLen = 255;
symbol->SizeOfStruct = sizeof (SYMBOL_INFO);
@@ -131,6 +131,8 @@ static void handleCrash (int)
globalCrashHandler();
kill (getpid(), SIGKILL);
}
int beast_siginterrupt (int sig, int flag);
#endif
void SystemStats::setApplicationCrashHandler (CrashHandlerFunction handler)
@@ -146,7 +148,7 @@ void SystemStats::setApplicationCrashHandler (CrashHandlerFunction handler)
for (int i = 0; i < numElementsInArray (signals); ++i)
{
::signal (signals[i], handleCrash);
::siginterrupt (signals[i], 1);
beast_siginterrupt (signals[i], 1);
}
#endif
}

View File

@@ -1219,7 +1219,7 @@ private:
explicit String (const PreallocationBytes&); // This constructor preallocates a certain amount of memory
void appendFixedLength (const char* text, int numExtraChars);
size_t getByteOffsetOfEnd() const noexcept;
BEAST_DEPRECATED (String (const String& stringToCopy, size_t charsToAllocate));
BEAST_DEPRECATED (String (const String&, size_t));
// This private cast operator should prevent strings being accidentally cast
// to bools (this is possible because the compiler can add an implicit cast