Files
SirHumza--orbisRPC/installer/version.cpp
T
CyberMask367 55d8df0c28 Rebuild installer as a full setup app
Replace the standalone wizard with a graphical installer featuring settings, update checks, install and uninstall flows, and optional GoldHEN and nanoDNS configuration. Add the packaging and artwork pipeline, preserve user settings across config updates, and include additional custom title mappings.
2026-10-15 23:06:19 +01:00

49 lines
1.1 KiB
C++

#include "version.h"
#include <string.h>
namespace version
{
// Numeric components, compared left to right. No pre-release handling: the tag
// scheme is digits and dots only, and pretending otherwise would only add ways to
// be wrong.
bool IsNewer(const char *candidate, const char *current)
{
if (!candidate || !current)
return false;
while (*candidate || *current)
{
// One component each. A missing component counts as 0, so "1.2" loses to
// "1.2.1" and ties with "1.2.0".
long a = 0;
long b = 0;
while (*candidate >= '0' && *candidate <= '9')
a = a * 10 + (*candidate++ - '0');
while (*current >= '0' && *current <= '9')
b = b * 10 + (*current++ - '0');
if (a != b)
return a > b;
// Equal so far. Step over the separator; stop when both strings end.
while (*candidate && *candidate != '.')
candidate++;
while (*current && *current != '.')
current++;
if (*candidate == '.')
candidate++;
if (*current == '.')
current++;
if (!*candidate && !*current)
return false; // equal
}
return false;
}
} // namespace version