X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/73f662acc31034cd98fdc6e157454f7763ef0792..1347f3d1e04bedd1508589173f577673ee2c5554:/projects/stargazer/plugins/other/smux/types.cpp diff --git a/projects/stargazer/plugins/other/smux/types.cpp b/projects/stargazer/plugins/other/smux/types.cpp index eb09a73c..4e547492 100644 --- a/projects/stargazer/plugins/other/smux/types.cpp +++ b/projects/stargazer/plugins/other/smux/types.cpp @@ -5,6 +5,13 @@ #include "types.h" +namespace +{ + +bool ParseArcs(const char * str, ptrdiff_t length, unsigned * a, size_t * pos); +bool StringToArcs(const char * str, size_t length, std::vector & arcs); +bool AppendToArcs(const char * str, size_t length, std::vector & arcs); + bool ParseArcs(const char * str, ptrdiff_t length, unsigned * a, size_t * pos) { if (length == 0) @@ -16,7 +23,7 @@ size_t arcPos = 0; while ((left - str) < length) { char * pos = NULL; - unsigned arc = strtoul(left, &pos, 10); + unsigned arc = static_cast(strtoul(left, &pos, 10)); if (pos == left) return false; a[arcPos++] = arc; @@ -52,6 +59,8 @@ std::copy(&a[0], &a[pos], std::back_inserter(arcs)); return true; } +} + OID::OID(const std::string & str) : arcs() { @@ -182,7 +191,7 @@ return stream.str(); void OID::ToOID(OBJECT_IDENTIFIER_t * oid) const { -OBJECT_IDENTIFIER_set_arcs(oid, &arcs.front(), sizeof(unsigned), arcs.size()); +OBJECT_IDENTIFIER_set_arcs(oid, &arcs.front(), sizeof(unsigned), static_cast(arcs.size())); } OID & OID::operator=(const OID & rvalue)