Skip to content

Commit

Permalink
Nits for Windows OSS builds
Browse files Browse the repository at this point in the history
Summary: Taking the useful bits from d051127, which doesn't import well.

Reviewed By: finik

Differential Revision: D57990127

fbshipit-source-id: 84d895616dd2a70009a85e2e65d7b8aed974d8f6
  • Loading branch information
Georges Berenger authored and facebook-github-bot committed May 31, 2024
1 parent b316384 commit b4008a0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 30 deletions.
2 changes: 1 addition & 1 deletion vrs/MultiRecordFileReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ uint32_t MultiRecordFileReader::getRecordCount() const {
if (hasSingleFile()) {
return readers_.front()->getRecordCount();
}
return XR_DEV_PRECONDITION_NOTNULL(recordIndex_)->size();
return static_cast<uint32_t>(recordIndex_->size());
}

uint32_t MultiRecordFileReader::getRecordCount(UniqueStreamId uniqueStreamId) const {
Expand Down
40 changes: 11 additions & 29 deletions vrs/os/System.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,41 +71,23 @@ string vrs::os::getOsFingerPrint() {
string osFingerprintString;
struct utsname linuxNames;
if (uname(&linuxNames) == 0) {
osFingerprintString = linuxNames.sysname;
osFingerprintString += " ";
osFingerprintString += linuxNames.release;
osFingerprintString += ", ";
osFingerprintString += linuxNames.machine;
osFingerprintString += ", ";
osFingerprintString += linuxNames.version;
osFingerprintString = fmt::format(
"{} {}, {}, {}",
linuxNames.sysname,
linuxNames.release,
linuxNames.machine,
linuxNames.version);
} else {
osFingerprintString = "Linux version: <Unknown>";
}
return osFingerprintString;

#elif IS_WINDOWS_PLATFORM()
DWORD dwVersion = 0;
DWORD dwMajorVersion = 0;
DWORD dwMinorVersion = 0;
DWORD dwBuild = 0;
dwVersion = GetVersion();

// Get the Windows version.
dwMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion)));
dwMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion)));

// Get the build number.
if (dwVersion < 0x80000000) {
dwBuild = (DWORD)(HIWORD(dwVersion));
}
string osFingerprintString;
osFingerprintString = "Windows ";
osFingerprintString += to_string(dwMajorVersion);
osFingerprintString += ".";
osFingerprintString += to_string(dwMinorVersion);
osFingerprintString += ", build #";
osFingerprintString += to_string(dwBuild);
return osFingerprintString;
DWORD dwVersion = GetVersion();
DWORD dwMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion)));
DWORD dwMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion)));
DWORD dwBuild = (dwVersion < 0x80000000) ? (DWORD)(HIWORD(dwVersion)) : 0;
return fmt::format("Windows {}.{}, build #{}", dwMajorVersion, dwMinorVersion, dwBuild);

#else
XR_LOGW("OS fingerprint not implemented for this OS.");
Expand Down

0 comments on commit b4008a0

Please sign in to comment.