mirror of
https://github.com/mumble-voip/mumble.git
synced 2025-10-26 11:19:16 +00:00
In various places we relied on compiler extensions such as variable-length arrays on the stack or using non-standard escape sequences. In order to make our code as portable as possible, these parts of the code have been refactored to only use standard C++. Furthermore, the new warning settings triggered a bunch of new warnings all over the place that have been addressed by this commit.
41 lines
1.2 KiB
C++
41 lines
1.2 KiB
C++
// Copyright 2022-2023 The Mumble Developers. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license
|
|
// that can be found in the LICENSE file at the root of the
|
|
// Mumble source tree or at <https://www.mumble.info/LICENSE>.
|
|
|
|
#include "ProtoUtils.h"
|
|
|
|
namespace MumbleProto {
|
|
|
|
::Version::full_t getVersion(const MumbleProto::Version &msg) {
|
|
if (msg.has_version_v2()) {
|
|
return static_cast<::Version::full_t >(msg.version_v2());
|
|
} else if (msg.has_version_v1()) {
|
|
return ::Version::fromLegacyVersion(msg.version_v1());
|
|
}
|
|
|
|
return ::Version::UNKNOWN;
|
|
}
|
|
|
|
void setVersion(MumbleProto::Version &msg, const ::Version::full_t version) {
|
|
msg.set_version_v2(version);
|
|
msg.set_version_v1(::Version::toLegacyVersion(version));
|
|
}
|
|
|
|
::Version::full_t getSuggestedVersion(const MumbleProto::SuggestConfig &msg) {
|
|
if (msg.has_version_v2()) {
|
|
return static_cast<::Version::full_t >(msg.version_v2());
|
|
} else if (msg.has_version_v1()) {
|
|
return ::Version::fromLegacyVersion(msg.version_v1());
|
|
}
|
|
|
|
return ::Version::UNKNOWN;
|
|
}
|
|
|
|
void setSuggestedVersion(MumbleProto::SuggestConfig &msg, const ::Version::full_t version) {
|
|
msg.set_version_v2(version);
|
|
msg.set_version_v1(::Version::toLegacyVersion(version));
|
|
}
|
|
|
|
} // namespace MumbleProto
|