Skip to content

Commit

Permalink
Merge branch 'master' into development/fix-channel-notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
pwielders authored Dec 17, 2024
2 parents 4ba540a + e032a10 commit 6175bf3
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 8 deletions.
3 changes: 2 additions & 1 deletion Source/com/Ids.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ namespace RPC {
ID_SYSTEM_METADATA = (ID_OFFSET_INTERNAL + 0x0071),

ID_EXTERNAL_INTERFACE_OFFSET = (ID_OFFSET_INTERNAL + 0x0080),
ID_EXTERNAL_QA_INTERFACE_OFFSET = (ID_OFFSET_INTERNAL + 0xA000)
ID_EXTERNAL_QA_INTERFACE_OFFSET = (0xA000),
ID_EXTERNAL_CC_INTERFACE_OFFSET = (0xCC00) // ends on 0xDFFF
};
}
}
52 changes: 47 additions & 5 deletions Source/core/JSONRPC.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,15 @@ namespace Core {
// this magical value as a base for Thunder error codes (0..999).
// These error codes are *not* related to the JSONRPC transport
// layer but relate to the application layer.
// Seems the spec is expecting a value > -32767, so with a value
// range of 0-999 Thunder codes, -31000 should be oke :-)
// Seems the spec is expecting a value > -32000, so with a value
// range of 0-499 Thunder non COMRPC error codes and 500-999 COMRPC errors,
// so -31000 as base should be oke :-)
// Please note: do NOT change the base number as there might be external
// code depending on this number to get to a certain error
// value for JSON RPC, so changing this number will break
// backwards compatibility not only for code below but
// also external code.

static constexpr int32_t ApplicationErrorCodeBase = -31000;

class Info : public Core::JSON::Container {
Expand Down Expand Up @@ -166,7 +173,11 @@ namespace Core {
Text = _T("Requested service is not available.");
break;
default:
Code = ApplicationErrorCodeBase - static_cast<int32_t>(frameworkError);
if ((frameworkError & 0x80000000) == 0) {
Code = ApplicationErrorCodeBase - static_cast<int32_t>(frameworkError);
} else {
Code = ApplicationErrorCodeBase - static_cast<int32_t>(frameworkError & 0x7FFFFFFF) - 500;
}
Text = Core::ErrorToString(frameworkError);
break;
}
Expand Down Expand Up @@ -260,14 +271,21 @@ namespace Core {
size_t end = designator.find_last_of('@');
size_t begin = designator.find_last_of('.', end);
size_t lookup = designator.find_first_of('#', begin+1);
string method;

if (lookup != string::npos) {
size_t ns = designator.find_first_of(':', lookup + 1);
return (designator.substr((begin == string::npos) ? 0 : begin + 1, lookup - begin - 1) + (ns != string::npos? designator.substr(ns, end - ns) : string{}));
method = designator.substr((begin == string::npos) ? 0 : begin + 1, lookup - begin - 1) + (ns != string::npos? designator.substr(ns, end - ns) : string{});
}
else {
return (designator.substr((begin == string::npos) ? 0 : begin + 1, (end == string::npos ? string::npos : (begin == string::npos) ? end : end - begin - 1)));
method = designator.substr((begin == string::npos) ? 0 : begin + 1, (end == string::npos ? string::npos : (begin == string::npos) ? end : end - begin - 1));
}

PUSH_WARNING(DISABLE_WARNING_DEPRECATED_USE) // Support pascal casing during the transition period
ToCamelCase(method);
POP_WARNING()

return (method);
}
static string FullMethod(const string& designator)
{
Expand Down Expand Up @@ -420,6 +438,30 @@ namespace Core {
Core::JSON::String Result;
Info Error;

private:
DEPRECATED static void ToCamelCase(string& source)
{
// speed optimized, does not care for locale settings

char* raw = &source[0];

auto const isup = [](const char ch) {
return (static_cast<uint8_t>(ch - 'A') <= 25);
};

auto const islow = [](const char ch) {
return (static_cast<uint8_t>(ch - 'a') <= 25);
};

if (isup(raw[0])) {
*raw++ |= 32;

while (isup(raw[0]) && !islow(raw[1])) {
*raw++ |= 32;
}
}
}

private:
string _implicitCallsign;
};
Expand Down
3 changes: 1 addition & 2 deletions Source/cryptalgo/SecureSocketPort.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* If not stated otherwise in this file or this component's LICENSE file the
* following copyright and licenses apply:
*
Expand Down Expand Up @@ -206,7 +206,6 @@ static int passwd_callback(char* buffer, int size, int /* flags */, void* passwo
Key::Key(const string& fileName, const string& password)
: _key(nullptr) {
BIO* bio_key = BIO_new_file(fileName.c_str(), "rb");
FILE* file = ::fopen(fileName.c_str(), "rt");

if (bio_key != nullptr) {
_key = PEM_read_bio_PrivateKey(bio_key, NULL, passwd_callback, const_cast<void*>(static_cast<const void*>(password.c_str())));
Expand Down

0 comments on commit 6175bf3

Please sign in to comment.