|
|
@ -92,7 +92,7 @@ void VerifyVersion(int headerVersion, |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
std::string VersionString(int version, bool cppMajor) { |
|
|
|
std::string VersionString(int version) { |
|
|
|
int major = version / 1000000; |
|
|
|
int major = version / 1000000; |
|
|
|
int minor = (version / 1000) % 1000; |
|
|
|
int minor = (version / 1000) % 1000; |
|
|
|
int micro = version % 1000; |
|
|
|
int micro = version % 1000; |
|
|
@ -100,11 +100,7 @@ std::string VersionString(int version, bool cppMajor) { |
|
|
|
// 128 bytes should always be enough, but we use snprintf() anyway to be
|
|
|
|
// 128 bytes should always be enough, but we use snprintf() anyway to be
|
|
|
|
// safe.
|
|
|
|
// safe.
|
|
|
|
char buffer[128]; |
|
|
|
char buffer[128]; |
|
|
|
if (cppMajor) { |
|
|
|
snprintf(buffer, sizeof(buffer), "%d.%d.%d", major, minor, micro); |
|
|
|
snprintf(buffer, sizeof(buffer), "%d.%d.%d", major, minor, micro); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
snprintf(buffer, sizeof(buffer), "%d.%d", minor, micro); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Guard against broken MSVC snprintf().
|
|
|
|
// Guard against broken MSVC snprintf().
|
|
|
|
buffer[sizeof(buffer)-1] = '\0'; |
|
|
|
buffer[sizeof(buffer)-1] = '\0'; |
|
|
@ -113,7 +109,19 @@ std::string VersionString(int version, bool cppMajor) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
std::string ProtocVersionString(int version) { |
|
|
|
std::string ProtocVersionString(int version) { |
|
|
|
return VersionString(version, false); |
|
|
|
int minor = (version / 1000) % 1000; |
|
|
|
|
|
|
|
int micro = version % 1000; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 128 bytes should always be enough, but we use snprintf() anyway to be
|
|
|
|
|
|
|
|
// safe.
|
|
|
|
|
|
|
|
char buffer[128]; |
|
|
|
|
|
|
|
snprintf(buffer, sizeof(buffer), "%d.%d", minor, micro); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Guard against broken MSVC snprintf().
|
|
|
|
|
|
|
|
buffer[sizeof(buffer)-1] = '\0'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return buffer; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} // namespace internal
|
|
|
|
} // namespace internal
|
|
|
|