Skip to content

Commit

Permalink
Merge pull request #815 from bugsnag/fix-compiler-warnings
Browse files Browse the repository at this point in the history
Fix ‘implicit conversion loses integer precision’ warnings
  • Loading branch information
nickdowell authored Sep 22, 2020
2 parents 3a0bf68 + 57f8833 commit fcc42bb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const char *bsg_ksmachexceptionName(const exception_type_t exceptionType) {
return NULL;
}

const char *bsg_ksmachkernelReturnCodeName(const kern_return_t returnCode) {
const char *bsg_ksmachkernelReturnCodeName(const unsigned long long returnCode) {
switch (returnCode) {
RETURN_NAME_FOR_ENUM(KERN_SUCCESS);
RETURN_NAME_FOR_ENUM(KERN_INVALID_ADDRESS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ const char *bsg_ksmachexceptionName(exception_type_t exceptionType);
*
* @return The code's name or NULL if not found.
*/
const char *bsg_ksmachkernelReturnCodeName(kern_return_t returnCode);
const char *bsg_ksmachkernelReturnCodeName(unsigned long long returnCode);

// ============================================================================
#pragma mark - Thread State Info -
Expand Down
9 changes: 5 additions & 4 deletions Bugsnag/Payload/BugsnagStackframe.m
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,10 @@ + (BugsnagStackframe *)frameFromDict:(NSDictionary *)dict
symbolName = [string substringWithRange:symbolNameRange];
}

unsigned long long address = 0;
[[NSScanner scannerWithString:frameAddress] scanHexLongLong:&address];
uintptr_t address = 0;
if (frameAddress.UTF8String != NULL) {
sscanf(frameAddress.UTF8String, "%lx", &address);
}

BugsnagStackframe *frame = [BugsnagStackframe new];
frame.machoFile = imageName;
Expand All @@ -118,8 +120,7 @@ + (BugsnagStackframe *)frameFromDict:(NSDictionary *)dict
frame.isPc = [frameNumber isEqualToString:@"0"];

Dl_info dl_info;
uintptr_t address2 = address;
bsg_ksbt_symbolicate(&address2, &dl_info, 1, 0);
bsg_ksbt_symbolicate(&address, &dl_info, 1, 0);
if (dl_info.dli_fname != NULL) {
frame.machoFile = [NSString stringWithUTF8String:dl_info.dli_fname].lastPathComponent;
}
Expand Down

0 comments on commit fcc42bb

Please sign in to comment.