Fix "-Wshorten-64-to-32" errors in Apple code

Also rename AndroidCallstack -> AppleCallstack in apple_callstack.cpp
This commit is contained in:
Jake Turner
2022-07-21 11:49:49 +01:00
committed by Baldur Karlsson
parent 9ab43e6c5a
commit cb2e4f1253
4 changed files with 22 additions and 22 deletions
+2 -2
View File
@@ -710,8 +710,8 @@ static uint32_t GetPlaneByteSize(uint32_t width, uint32_t height, uint32_t depth
MTL::Size planeShape(mipWidth, mipHeight, 0);
BlockShape blockShape(GetBlockShape(mtlFormat, plane));
uint32_t widthInBlocks = (planeShape.width + blockShape.width - 1) / blockShape.width;
uint32_t heightInBlocks = (planeShape.height + blockShape.height - 1) / blockShape.height;
uint32_t widthInBlocks = (uint32_t)(planeShape.width + blockShape.width - 1) / blockShape.width;
uint32_t heightInBlocks = (uint32_t)(planeShape.height + blockShape.height - 1) / blockShape.height;
return blockShape.bytes * widthInBlocks * heightInBlocks * mipDepth;
}
+7 -7
View File
@@ -153,9 +153,9 @@ static bool ValidData(MTL::RenderPassSampleBufferAttachmentDescriptor *descripto
template <typename MTL_TYPE>
static void GetWrappedNSArray(rdcarray<typename UnwrapHelper<MTL_TYPE>::Outer *> &to, NS::Array *from)
{
int count = from->count();
size_t count = from->count();
to.resize(count);
for(int i = 0; i < count; ++i)
for(size_t i = 0; i < count; ++i)
{
to[i] = GetWrapped((MTL_TYPE)from->object(i));
}
@@ -328,19 +328,19 @@ LinkedFunctions::LinkedFunctions(MTL::LinkedFunctions *objc)
{
NS::Dictionary *objcGroups = objc->groups();
NS::Array *keys = objcGroups->keyEnumerator()->allObjects();
int countKeys = keys->count();
size_t countKeys = keys->count();
groups.resize(countKeys);
for(int i = 0; i < countKeys; ++i)
for(size_t i = 0; i < countKeys; ++i)
{
NS::String *key = (NS::String *)keys->object(i);
NS::Array *funcs = (NS::Array *)objcGroups->object(key);
int countFuncs = funcs->count();
size_t countFuncs = funcs->count();
FunctionGroup &funcGroup = groups[i];
funcGroup.callsite.assign(key->utf8String());
funcGroup.functions.resize(countFuncs);
for(int j = 0; j < countFuncs; ++j)
for(size_t j = 0; j < countFuncs; ++j)
{
funcGroup.functions[j] = GetWrapped((MTL::Function *)funcs->object(j));
}
@@ -577,7 +577,7 @@ RenderPassDescriptor::RenderPassDescriptor(MTL::RenderPassDescriptor *objc)
{
GETOBJCARRAY(RenderPassColorAttachmentDescriptor, MAX_RENDER_PASS_COLOR_ATTACHMENTS,
colorAttachments, ValidData);
uint32_t count = objc->getSamplePositions(NULL, 0);
size_t count = objc->getSamplePositions(NULL, 0);
if(count)
{
samplePositions.resize(count);
+9 -9
View File
@@ -25,30 +25,30 @@
#include "common/common.h"
#include "os/os_specific.h"
class AndroidCallstack : public Callstack::Stackwalk
class AppleCallstack : public Callstack::Stackwalk
{
public:
AndroidCallstack()
AppleCallstack()
{
RDCEraseEl(addrs);
numLevels = 0;
}
AndroidCallstack(uint64_t *calls, size_t num) { Set(calls, num); }
~AndroidCallstack() {}
AppleCallstack(uint64_t *calls, size_t num) { Set(calls, num); }
~AppleCallstack() {}
void Set(uint64_t *calls, size_t num)
{
numLevels = num;
for(int i = 0; i < numLevels; i++)
for(size_t i = 0; i < numLevels; i++)
addrs[i] = calls[i];
}
size_t NumLevels() const { return 0; }
const uint64_t *GetAddrs() const { return addrs; }
private:
AndroidCallstack(const Callstack::Stackwalk &other);
AppleCallstack(const Callstack::Stackwalk &other);
uint64_t addrs[128];
int numLevels;
size_t numLevels;
};
namespace Callstack
@@ -59,12 +59,12 @@ void Init()
Stackwalk *Collect()
{
return new AndroidCallstack();
return new AppleCallstack();
}
Stackwalk *Create()
{
return new AndroidCallstack(NULL, 0);
return new AppleCallstack(NULL, 0);
}
bool GetLoadedModules(byte *buf, size_t &size)
+4 -4
View File
@@ -90,11 +90,11 @@ int GetIdentPort(pid_t childPid)
// n*:<PORT>
rdcstr parseResult(result);
const size_t len = parseResult.length();
const int len = parseResult.count();
if(parseResult[0] == 'p')
{
size_t tokenStart = 1;
size_t i = tokenStart;
int tokenStart = 1;
int i = tokenStart;
for(; i < len; i++)
{
if(parseResult[i] < '0' || parseResult[i] > '9')
@@ -114,7 +114,7 @@ int GetIdentPort(pid_t childPid)
const int netStart = parseResult.find(netString, i);
if(netStart >= 0)
{
tokenStart = netStart + strlen(netString);
tokenStart = netStart + (int)strlen(netString);
i = tokenStart;
for(; i < len; i++)
{