From 9522a0b7c16414fce2103cf58bfdd63aaf0cb01b Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 3 Nov 2022 14:58:32 -0400 Subject: DRTVWR-575: Fix llcommon assumptions that size_t fits in 4 bytes. It's a little distressing how often we have historically coded S32 or U32 to pass a length or index. There are more such assumptions in other viewer subdirectories, but this is a start. --- indra/llcommon/llsys_objc.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llcommon/llsys_objc.mm') diff --git a/indra/llcommon/llsys_objc.mm b/indra/llcommon/llsys_objc.mm index cdb1e320d5..9359503a19 100644 --- a/indra/llcommon/llsys_objc.mm +++ b/indra/llcommon/llsys_objc.mm @@ -27,12 +27,12 @@ #import "llsys_objc.h" #import -static int intAtStringIndex(NSArray *array, int index) +static NSInteger intAtStringIndex(NSArray *array, int index) { return [(NSString *)[array objectAtIndex:index] integerValue]; } -bool LLGetDarwinOSInfo(int &major, int &minor, int &patch) +bool LLGetDarwinOSInfo(NSInteger &major, NSInteger &minor, NSInteger &patch) { if (NSAppKitVersionNumber > NSAppKitVersionNumber10_8) { -- cgit v1.2.3 From 076737cb6c28e9e5ea47cd4cb6ea9c5c514e578b Mon Sep 17 00:00:00 2001 From: Brad Kittenbrink Date: Fri, 11 Nov 2022 18:09:23 -0800 Subject: DRTVWR-575 fix LLGetDarwinOSInfo for xcode-14.1. NSInteger is now 64 bits --- indra/llcommon/llsys_objc.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llcommon/llsys_objc.mm') diff --git a/indra/llcommon/llsys_objc.mm b/indra/llcommon/llsys_objc.mm index 9359503a19..ccd39a2d46 100644 --- a/indra/llcommon/llsys_objc.mm +++ b/indra/llcommon/llsys_objc.mm @@ -32,7 +32,7 @@ static NSInteger intAtStringIndex(NSArray *array, int index) return [(NSString *)[array objectAtIndex:index] integerValue]; } -bool LLGetDarwinOSInfo(NSInteger &major, NSInteger &minor, NSInteger &patch) +bool LLGetDarwinOSInfo(int64_t &major, int64_t &minor, int64_t &patch) { if (NSAppKitVersionNumber > NSAppKitVersionNumber10_8) { -- cgit v1.2.3 From 4349cb6165e983ff6bdd45ad1b82bb98bfc0436f Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Sat, 12 Nov 2022 18:59:21 -1000 Subject: DRTVWR-575: Address review comments on Xcode 14.1 type tweaks. Introduce LLSD template constructors and assignment operators to disambiguate construction or assignment from any integer type to Integer, likewise any floating point type to Real. Use new narrow() function to validate conversions. For LLSD method parameters converted from LLSD::Integer to size_t, where the method previously checked for a negative argument, make it now check for size_t converted from negative: in other words, more than S32_MAX. The risk of having a parameter forced from negative to unsigned exceeds the risk of a valid length or index over that max. In lltracerecording.cpp's PeriodicRecording, now that mCurPeriod and mNumRecordedPeriods are size_t instead of S32, defend against subtracting 1 from 0. Use narrow() to validate newly-introduced narrowing conversions. Make llclamp() return the type of the raw input value, even if the types of the boundary values differ. std::ostream::tellp() no longer returns a value we can directly report as a number. Cast to U64. --- indra/llcommon/llsys_objc.mm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'indra/llcommon/llsys_objc.mm') diff --git a/indra/llcommon/llsys_objc.mm b/indra/llcommon/llsys_objc.mm index 9359503a19..81032658d7 100644 --- a/indra/llcommon/llsys_objc.mm +++ b/indra/llcommon/llsys_objc.mm @@ -27,19 +27,19 @@ #import "llsys_objc.h" #import -static NSInteger intAtStringIndex(NSArray *array, int index) +static int intAtStringIndex(NSArray *array, int index) { - return [(NSString *)[array objectAtIndex:index] integerValue]; + return int([(NSString *)[array objectAtIndex:index] integerValue]); } -bool LLGetDarwinOSInfo(NSInteger &major, NSInteger &minor, NSInteger &patch) +bool LLGetDarwinOSInfo(int &major, int &minor, int &patch) { if (NSAppKitVersionNumber > NSAppKitVersionNumber10_8) { NSOperatingSystemVersion osVersion = [[NSProcessInfo processInfo] operatingSystemVersion]; - major = osVersion.majorVersion; - minor = osVersion.minorVersion; - patch = osVersion.patchVersion; + major = int(osVersion.majorVersion); + minor = int(osVersion.minorVersion); + patch = int(osVersion.patchVersion); } else { -- cgit v1.2.3