diff --git a/Source/PLCrashReport.m b/Source/PLCrashReport.m index 8312bc83..0694d02f 100644 --- a/Source/PLCrashReport.m +++ b/Source/PLCrashReport.m @@ -264,29 +264,33 @@ - (Plcrash__CrashReport *) decodeCrashData: (NSData *) data error: (NSError **) /* Verify that the crash log is sufficently large */ if (sizeof(struct PLCrashReportFileHeader) >= [data length]) { - populate_nserror(outError, PLCrashReporterErrorCrashReportInvalid, NSLocalizedString(@"Could not decode truncated crash log", - @"Crash log decoding error message")); + populate_nserror(outError, PLCrashReporterErrorCrashReportInvalid, NSLocalizedStringFromTable(@"Could not decode truncated crash log", + @"PLCrashReporter", + @"Crash log decoding error message")); return NULL; } /* Check the file magic */ if (memcmp(header->magic, PLCRASH_REPORT_FILE_MAGIC, strlen(PLCRASH_REPORT_FILE_MAGIC)) != 0) { - populate_nserror(outError, PLCrashReporterErrorCrashReportInvalid,NSLocalizedString(@"Could not decode invalid crash log header", - @"Crash log decoding error message")); + populate_nserror(outError, PLCrashReporterErrorCrashReportInvalid,NSLocalizedStringFromTable(@"Could not decode invalid crash log header", + @"PLCrashReporter", + @"Crash log decoding error message")); return NULL; } /* Check the version */ if(header->version != PLCRASH_REPORT_FILE_VERSION) { - populate_nserror(outError, PLCrashReporterErrorCrashReportInvalid, [NSString stringWithFormat: NSLocalizedString(@"Could not decode unsupported crash report version: %d", - @"Crash log decoding message"), header->version]); + populate_nserror(outError, PLCrashReporterErrorCrashReportInvalid, [NSString stringWithFormat: NSLocalizedStringFromTable(@"Could not decode unsupported crash report version: %d", + @"PLCrashReporter", + @"Crash log decoding message"), header->version]); return NULL; } Plcrash__CrashReport *crashReport = plcrash__crash_report__unpack(NULL, [data length] - sizeof(struct PLCrashReportFileHeader), header->data); if (crashReport == NULL) { - populate_nserror(outError, PLCrashReporterErrorCrashReportInvalid, NSLocalizedString(@"An unknown error occured decoding the crash report", - @"Crash log decoding error message")); + populate_nserror(outError, PLCrashReporterErrorCrashReportInvalid, NSLocalizedStringFromTable(@"An unknown error occured decoding the crash report", + @"PLCrashReporter", + @"Crash log decoding error message")); return NULL; } @@ -316,15 +320,17 @@ - (PLCrashReportSystemInfo *) extractSystemInfo: (Plcrash__CrashReport__SystemIn /* Validate */ if (systemInfo == NULL) { populate_nserror(outError, PLCrashReporterErrorCrashReportInvalid, - NSLocalizedString(@"Crash report is missing System Information section", - @"Missing sysinfo in crash report")); + NSLocalizedStringFromTable(@"Crash report is missing System Information section", + @"PLCrashReporter", + @"Missing sysinfo in crash report")); return nil; } if (systemInfo->os_version == NULL) { populate_nserror(outError, PLCrashReporterErrorCrashReportInvalid, - NSLocalizedString(@"Crash report is missing System Information OS version field", - @"Missing sysinfo operating system in crash report")); + NSLocalizedStringFromTable(@"Crash report is missing System Information OS version field", + @"PLCrashReporter", + @"Missing sysinfo operating system in crash report")); return nil; } @@ -362,8 +368,9 @@ - (PLCrashReportProcessorInfo *) extractProcessorInfo: (Plcrash__CrashReport__Pr /* Validate */ if (processorInfo == NULL) { populate_nserror(outError, PLCrashReporterErrorCrashReportInvalid, - NSLocalizedString(@"Crash report is missing processor info section", - @"Missing processor info in crash report")); + NSLocalizedStringFromTable(@"Crash report is missing processor info section", + @"PLCrashReporter", + @"Missing processor info in crash report")); return nil; } @@ -411,8 +418,9 @@ - (PLCrashReportProcessorInfo *) synthesizeProcessorInfoFromArchitecture: (Plcra default: populate_nserror(outError, PLCrashReporterErrorCrashReportInvalid, - NSLocalizedString(@"Crash report has an unknown architecture", - @"Unknown architecture in crash report")); + NSLocalizedStringFromTable(@"Crash report has an unknown architecture", + @"PLCrashReporter", + @"Unknown architecture in crash report")); return nil; } @@ -431,8 +439,9 @@ - (PLCrashReportMachineInfo *) extractMachineInfo: (Plcrash__CrashReport__Machin /* Validate */ if (machineInfo == NULL) { populate_nserror(outError, PLCrashReporterErrorCrashReportInvalid, - NSLocalizedString(@"Crash report is missing Machine Information section", - @"Missing machine_info in crash report")); + NSLocalizedStringFromTable(@"Crash report is missing Machine Information section", + @"PLCrashReporter", + @"Missing machine_info in crash report")); return nil; } @@ -465,24 +474,27 @@ - (PLCrashReportApplicationInfo *) extractApplicationInfo: (Plcrash__CrashReport /* Validate */ if (applicationInfo == NULL) { populate_nserror(outError, PLCrashReporterErrorCrashReportInvalid, - NSLocalizedString(@"Crash report is missing Application Information section", - @"Missing app info in crash report")); + NSLocalizedStringFromTable(@"Crash report is missing Application Information section", + @"PLCrashReporter", + @"Missing app info in crash report")); return nil; } /* Identifier available? */ if (applicationInfo->identifier == NULL) { populate_nserror(outError, PLCrashReporterErrorCrashReportInvalid, - NSLocalizedString(@"Crash report is missing Application Information app identifier field", - @"Missing app identifier in crash report")); + NSLocalizedStringFromTable(@"Crash report is missing Application Information app identifier field", + @"PLCrashReporter", + @"Missing app identifier in crash report")); return nil; } /* Version available? */ if (applicationInfo->version == NULL) { populate_nserror(outError, PLCrashReporterErrorCrashReportInvalid, - NSLocalizedString(@"Crash report is missing Application Information app version field", - @"Missing app version in crash report")); + NSLocalizedStringFromTable(@"Crash report is missing Application Information app version field", + @"PLCrashReporter", + @"Missing app version in crash report")); return nil; } @@ -510,8 +522,9 @@ - (PLCrashReportProcessInfo *) extractProcessInfo: (Plcrash__CrashReport__Proces /* Validate */ if (processInfo == NULL) { populate_nserror(outError, PLCrashReporterErrorCrashReportInvalid, - NSLocalizedString(@"Crash report is missing Process Information section", - @"Missing process info in crash report")); + NSLocalizedStringFromTable(@"Crash report is missing Process Information section", + @"PLCrashReporter", + @"Missing process info in crash report")); return nil; } @@ -556,8 +569,9 @@ - (PLCrashReportProcessInfo *) extractProcessInfo: (Plcrash__CrashReport__Proces - (PLCrashReportSymbolInfo *) extractSymbolInfo: (Plcrash__CrashReport__Symbol *) symbol error: (NSError **) outError { if (symbol == NULL) { populate_nserror(outError, PLCrashReporterErrorCrashReportInvalid, - NSLocalizedString(@"Crash report is missing symbol information", - @"Missing symbol info in crash report")); + NSLocalizedStringFromTable(@"Crash report is missing symbol information", + @"PLCrashReporter", + @"Missing symbol info in crash report")); return nil; } @@ -575,8 +589,9 @@ - (PLCrashReportStackFrameInfo *) extractStackFrameInfo: (Plcrash__CrashReport__ /* There should be at least one thread */ if (stackFrame == NULL) { populate_nserror(outError, PLCrashReporterErrorCrashReportInvalid, - NSLocalizedString(@"Crash report is missing stack frame information", - @"Missing stack frame info in crash report")); + NSLocalizedStringFromTable(@"Crash report is missing stack frame information", + @"PLCrashReporter", + @"Missing stack frame info in crash report")); return nil; } @@ -598,8 +613,9 @@ - (NSArray *) extractThreadInfo: (Plcrash__CrashReport *) crashReport error: (NS /* There should be at least one thread */ if (crashReport->n_threads == 0) { populate_nserror(outError, PLCrashReporterErrorCrashReportInvalid, - NSLocalizedString(@"Crash report is missing thread state information", - @"Missing thread info in crash report")); + NSLocalizedStringFromTable(@"Crash report is missing thread state information", + @"PLCrashReporter", + @"Missing thread info in crash report")); return nil; } @@ -655,8 +671,9 @@ - (NSArray *) extractImageInfo: (Plcrash__CrashReport *) crashReport error: (NSE /* There should be at least one image */ if (crashReport->n_binary_images == 0) { populate_nserror(outError, PLCrashReporterErrorCrashReportInvalid, - NSLocalizedString(@"Crash report is missing binary image information", - @"Missing image info in crash report")); + NSLocalizedStringFromTable(@"Crash report is missing binary image information", + @"PLCrashReporter", + @"Missing image info in crash report")); return nil; } @@ -710,24 +727,27 @@ - (PLCrashReportExceptionInfo *) extractExceptionInfo: (Plcrash__CrashReport__Ex /* Validate */ if (exceptionInfo == NULL) { populate_nserror(outError, PLCrashReporterErrorCrashReportInvalid, - NSLocalizedString(@"Crash report is missing Exception Information section", - @"Missing appinfo in crash report")); + NSLocalizedStringFromTable(@"Crash report is missing Exception Information section", + @"PLCrashReporter", + @"Missing appinfo in crash report")); return nil; } /* Name available? */ if (exceptionInfo->name == NULL) { populate_nserror(outError, PLCrashReporterErrorCrashReportInvalid, - NSLocalizedString(@"Crash report is missing exception name field", - @"Missing appinfo operating system in crash report")); + NSLocalizedStringFromTable(@"Crash report is missing exception name field", + @"PLCrashReporter", + @"Missing appinfo operating system in crash report")); return nil; } /* Reason available? */ if (exceptionInfo->reason == NULL) { populate_nserror(outError, PLCrashReporterErrorCrashReportInvalid, - NSLocalizedString(@"Crash report is missing exception reason field", - @"Missing appinfo operating system in crash report")); + NSLocalizedStringFromTable(@"Crash report is missing exception reason field", + @"PLCrashReporter", + @"Missing appinfo operating system in crash report")); return nil; } @@ -767,24 +787,27 @@ - (PLCrashReportSignalInfo *) extractSignalInfo: (Plcrash__CrashReport__Signal * /* Validate */ if (signalInfo == NULL) { populate_nserror(outError, PLCrashReporterErrorCrashReportInvalid, - NSLocalizedString(@"Crash report is missing Signal Information section", - @"Missing appinfo in crash report")); + NSLocalizedStringFromTable(@"Crash report is missing Signal Information section", + @"PLCrashReporter", + @"Missing appinfo in crash report")); return nil; } /* Name available? */ if (signalInfo->name == NULL) { populate_nserror(outError, PLCrashReporterErrorCrashReportInvalid, - NSLocalizedString(@"Crash report is missing signal name field", - @"Missing appinfo operating system in crash report")); + NSLocalizedStringFromTable(@"Crash report is missing signal name field", + @"PLCrashReporter", + @"Missing appinfo operating system in crash report")); return nil; } /* Code available? */ if (signalInfo->code == NULL) { populate_nserror(outError, PLCrashReporterErrorCrashReportInvalid, - NSLocalizedString(@"Crash report is missing signal code field", - @"Missing appinfo operating system in crash report")); + NSLocalizedStringFromTable(@"Crash report is missing signal code field", + @"PLCrashReporter", + @"Missing appinfo operating system in crash report")); return nil; } @@ -804,16 +827,18 @@ - (PLCrashReportMachExceptionInfo *) extractMachExceptionInfo: (Plcrash__CrashRe /* Validate */ if (machExceptionInfo == NULL) { populate_nserror(outError, PLCrashReporterErrorCrashReportInvalid, - NSLocalizedString(@"Crash report is missing Mach Exception Information section", - @"Missing mach exception info in crash report")); + NSLocalizedStringFromTable(@"Crash report is missing Mach Exception Information section", + @"PLCrashReporter", + @"Missing mach exception info in crash report")); return nil; } /* Sanity check; there should really only ever be 2 */ if (machExceptionInfo->n_codes > UINT8_MAX) { populate_nserror(outError, PLCrashReporterErrorCrashReportInvalid, - NSLocalizedString(@"Crash report includes too many Mach Exception codes", - @"Invalid mach exception info in crash report")); + NSLocalizedStringFromTable(@"Crash report includes too many Mach Exception codes", + @"PLCrashReporter", + @"Invalid mach exception info in crash report")); return nil; } diff --git a/Source/PLCrashReporter.m b/Source/PLCrashReporter.m index 113b8592..0cf28c22 100644 --- a/Source/PLCrashReporter.m +++ b/Source/PLCrashReporter.m @@ -721,7 +721,7 @@ - (NSData *) generateLiveReportWithThread: (thread_t) thread exception: (NSExcep int fd = mkstemp(path); if (fd < 0) { - plcrash_populate_posix_error(outError, errno, NSLocalizedString(@"Failed to create temporary path", @"Error opening temporary output path")); + plcrash_populate_posix_error(outError, errno, NSLocalizedStringFromTable(@"Failed to create temporary path", @"PLCrashReporter", @"Error opening temporary output path")); free(path); return nil; @@ -773,7 +773,7 @@ - (NSData *) generateLiveReportWithThread: (thread_t) thread exception: (NSExcep data = [NSData dataWithContentsOfFile: [NSString stringWithUTF8String: path]]; if (data == nil) { /* This should only happen if our data is deleted out from under us */ - plcrash_populate_error(outError, PLCrashReporterErrorUnknown, NSLocalizedString(@"Unable to open live crash report for reading", nil), nil); + plcrash_populate_error(outError, PLCrashReporterErrorUnknown, NSLocalizedStringFromTable(@"Unable to open live crash report for reading", @"PLCrashReporter", nil), nil); goto cleanup; }