Skip to content

Commit

Permalink
This builds (tests not included, need test PR as well)
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerkaraszewski committed Aug 1, 2024
1 parent 42f72cf commit 85aeda3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions libstuff/SSignal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ void SInitializeSignals() {
sigprocmask(SIG_BLOCK, &signals, 0);

// This is the signal action structure we'll use to specify what to listen for.
struct sigaction newAction = {0};
struct sigaction newAction = {};

// The old style handler is explicitly null
newAction.sa_handler = nullptr;
Expand Down Expand Up @@ -219,8 +219,9 @@ void _SSignal_StackTrace(int signum, siginfo_t *info, void *ucontext) {
int status{0};
char* front = strchr(frame[0], '(') + 1;
char* end = strchr(front, '+');
char copy[end - front + 1]{0};
strncpy(copy, front, end - front);
char copy[1000];
memset(copy, 0, 1000);
strncpy(copy, front, min((size_t)999, (size_t)(end - front)));
char* demangled = abi::__cxa_demangle(copy, 0, 0, &status);
char* tolog = status ? copy : demangled;
if (tolog[0] == '\0') {
Expand Down
7 changes: 4 additions & 3 deletions libstuff/libstuff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <fcntl.h>
#include <errno.h>
#include <dirent.h>
#include <string.h>
#ifdef __APPLE__
// Apple specific tweaks
#include <sys/types.h>
Expand Down Expand Up @@ -1686,7 +1687,7 @@ string SGZip(const string& content) {
}

string SGUnzip (const string& content) {
int CHUNK = 16384;
const int CHUNK = 16384;
int status;
unsigned have;
z_stream strm;
Expand Down Expand Up @@ -2754,13 +2755,13 @@ string SGetCurrentExceptionName()
// __cxa_demangle takes all its parameters by reference, so we create a buffer where it can demangle the current
// exception name.
int status = 0;
size_t length = 1000;
const size_t length = 1000;
char buffer[length];
memset(buffer, 0, length);

// Demangle the name of the current exception.
// See: https://libcxxabi.llvm.org/spec.html for details on this ABI interface.
abi::__cxa_demangle(abi::__cxa_current_exception_type()->name(), buffer, &length, &status);
abi::__cxa_demangle(abi::__cxa_current_exception_type()->name(), buffer, nullptr, &status);
string exceptionName = buffer;

// If it failed, use the original name instead.
Expand Down

0 comments on commit 85aeda3

Please sign in to comment.