git.stg.codes
/
stg.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix debug build, use separate clang-tidy config.
[stg.git]
/
projects
/
stargazer
/
plugins
/
other
/
smux
/
utils.cpp
diff --git
a/projects/stargazer/plugins/other/smux/utils.cpp
b/projects/stargazer/plugins/other/smux/utils.cpp
index 0ea39bbb39c016193495e7a64365f60e897fbbee..d1a0c281a585dec96f34d532bba0e0338f60b1c2 100644
(file)
--- a/
projects/stargazer/plugins/other/smux/utils.cpp
+++ b/
projects/stargazer/plugins/other/smux/utils.cpp
@@
-1,23
+1,26
@@
-#include <unistd.h> // write
-
-#include <cstring> // memset
-#include <cerrno>
+#include "utils.h"
+#include "pen.h"
#include "stg/common.h"
#include "stg/common.h"
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wold-style-cast"
#include "stg/OpenPDU.h"
#include "stg/ClosePDU.h"
#include "stg/RReqPDU.h"
#include "stg/ber_decoder.h"
#include "stg/der_encoder.h"
#include "stg/OpenPDU.h"
#include "stg/ClosePDU.h"
#include "stg/RReqPDU.h"
#include "stg/ber_decoder.h"
#include "stg/der_encoder.h"
+#pragma GCC diagnostic pop
-#include "pen.h"
-#include "utils.h"
+#include <cstring> // memset
+#include <cerrno>
+
+#include <unistd.h> // write
bool String2OI(const std::string & str, OBJECT_IDENTIFIER_t * oi)
{
size_t left = 0, pos = 0, arcPos = 0;
bool String2OI(const std::string & str, OBJECT_IDENTIFIER_t * oi)
{
size_t left = 0, pos = 0, arcPos = 0;
-
in
t arcs[1024];
+
uint32_
t arcs[1024];
pos = str.find_first_of('.', left);
if (pos == 0)
{
pos = str.find_first_of('.', left);
if (pos == 0)
{
@@
-44,7
+47,7
@@
if (left < str.length())
}
arcs[arcPos++] = arc;
}
}
arcs[arcPos++] = arc;
}
-OBJECT_IDENTIFIER_set_arcs(oi, arcs, s
izeof(arcs[0]), s
tatic_cast<unsigned int>(arcPos));
+OBJECT_IDENTIFIER_set_arcs(oi, arcs, static_cast<unsigned int>(arcPos));
return true;
}
return true;
}
@@
-122,7
+125,7
@@
return true;
bool SendRReqPDU(int fd)
{
bool SendRReqPDU(int fd)
{
-
in
t oid[] = {1, 3, 6, 1, 4, 1, 38313, 1};
+
uint32_
t oid[] = {1, 3, 6, 1, 4, 1, 38313, 1};
asn_enc_rval_t error;
RReqPDU_t msg;
asn_enc_rval_t error;
RReqPDU_t msg;
@@
-132,7
+135,6
@@
msg.priority = 0;
asn_long2INTEGER(&msg.operation, RReqPDU__operation_readOnly);
OBJECT_IDENTIFIER_set_arcs(&msg.subtree,
oid,
asn_long2INTEGER(&msg.operation, RReqPDU__operation_readOnly);
OBJECT_IDENTIFIER_set_arcs(&msg.subtree,
oid,
- sizeof(oid[0]),
8);
char buffer[1024];
8);
char buffer[1024];
@@
-168,12
+170,13
@@
size_t length = read(fd, buffer, sizeof(buffer));
if (length < 1)
return NULL;
asn_dec_rval_t error;
if (length < 1)
return NULL;
asn_dec_rval_t error;
-error = ber_decode(0, &asn_DEF_SMUX_PDUs, (void **)&pdus, buffer, length);
+void* p = pdus;
+error = ber_decode(0, &asn_DEF_SMUX_PDUs, &p, buffer, length);
if(error.code != RC_OK)
{
printfd(__FILE__, "Failed to decode PDUs at byte %ld\n",
if(error.code != RC_OK)
{
printfd(__FILE__, "Failed to decode PDUs at byte %ld\n",
-
(long)error.consumed
);
+
static_cast<long>(error.consumed)
);
return NULL;
}
return pdus;
return NULL;
}
return pdus;