Clean up build for 64 bit.

Fix up some broken mac projects.
Consolidate project settings in xcconfig files.

http://breakpad.appspot.com/130001



git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@627 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
dmaclach 2010-07-19 20:43:49 +00:00
parent 786275e719
commit 4ac61acb3a
53 changed files with 1791 additions and 1084 deletions

File diff suppressed because it is too large Load diff

View file

@ -265,7 +265,7 @@ bool Breakpad::ExceptionHandlerDirectCallback(void *context,
//=============================================================================
#pragma mark -
#include <mach-o/dyld.h>
#include <dlfcn.h>
//=============================================================================
// Returns the pathname to the Resources directory for this version of
@ -286,23 +286,16 @@ NSString * GetResourcePath() {
//
// Get the pathname to the code which contains this function
void *address = nil;
NSModule module = nil;
_dyld_lookup_and_bind_fully("_GetResourcePath",
&address,
&module);
if (module && address) {
const char* moduleName = NSNameOfModule(module);
if (moduleName) {
// The "Resources" directory should be in the same directory as the
// executable code, since that's how the Breakpad framework is built.
resourcePath = [NSString stringWithUTF8String:moduleName];
resourcePath = [resourcePath stringByDeletingLastPathComponent];
resourcePath = [resourcePath stringByAppendingPathComponent:@"Resources/"];
} else {
DEBUGLOG(stderr, "Missing moduleName\n");
}
Dl_info info;
if (dladdr((const void*)GetResourcePath, &info) != 0) {
NSFileManager *filemgr = [NSFileManager defaultManager];
NSString *filePath
= [filemgr stringWithFileSystemRepresentation:info.dli_fname
length:strlen(info.dli_fname)];
NSString *bundlePath = [filePath stringByDeletingLastPathComponent];
// The "Resources" directory should be in the same directory as the
// executable code, since that's how the Breakpad framework is built.
resourcePath = [bundlePath stringByAppendingPathComponent:@"Resources/"];
} else {
DEBUGLOG(stderr, "Could not find GetResourcePath\n");
// fallback plan
@ -573,7 +566,7 @@ bool Breakpad::ExtractParameters(NSDictionary *parameters) {
struct timeval tv;
gettimeofday(&tv, NULL);
char timeStartedString[32];
sprintf(timeStartedString, "%d", tv.tv_sec);
sprintf(timeStartedString, "%zd", tv.tv_sec);
dictionary.SetKeyValue(BREAKPAD_PROCESS_START_TIME,
timeStartedString);
@ -591,7 +584,7 @@ bool Breakpad::ExtractParameters(NSDictionary *parameters) {
// For each key-value pair, call BreakpadAddUploadParameter()
NSEnumerator *keyEnumerator = [serverParameters keyEnumerator];
NSString *aParameter;
while (aParameter = [keyEnumerator nextObject]) {
while ((aParameter = [keyEnumerator nextObject])) {
BreakpadAddUploadParameter(this, aParameter,
[serverParameters objectForKey:aParameter]);
}

View file

@ -116,7 +116,7 @@ void OnDemandServer::LaunchOnDemand() {
// and holding on to this port delays launching until the current process
// exits!
mach_port_deallocate(mach_task_self(), server_port_);
server_port_ = NULL;
server_port_ = MACH_PORT_DEAD;
// Now, the service is still registered and all we need to do is send
// a mach message to the service port in order to launch the server.

View file

@ -44,6 +44,8 @@
#import "common/mac/SimpleStringDictionary.h"
#import "common/mac/MachIPC.h"
#import "GTMDefines.h"
#import <Foundation/Foundation.h>
#if VERBOSE
@ -91,14 +93,14 @@ static BOOL EnsureDirectoryPathExists(NSString *dirPath) {
// Break up the difference into components
NSString *diff = [dirPath substringFromIndex:[common length] + 1];
NSArray *components = [diff pathComponents];
unsigned count = [components count];
NSUInteger count = [components count];
// Rebuild the path one component at a time
NSDictionary *attrs =
[NSDictionary dictionaryWithObject:[NSNumber numberWithUnsignedLong:0750]
forKey:NSFilePosixPermissions];
path = common;
for (unsigned i = 0; i < count; ++i) {
for (NSUInteger i = 0; i < count; ++i) {
path = [path stringByAppendingPathComponent:[components objectAtIndex:i]];
if (![mgr createDirectoryAtPath:path attributes:attrs])
@ -329,7 +331,6 @@ kern_return_t Inspector::ReadMessages() {
// we are expected to read.
// Read each key/value pair, one mach message per key/value pair.
for (unsigned int i = 0; i < info.parameter_count; ++i) {
MachReceiveMessage message;
result = receive_port.WaitForMessage(&message, 1000);
if(result == KERN_SUCCESS) {
@ -376,11 +377,11 @@ void Inspector::SetCrashTimeParameters() {
if (processStartTimeString) {
time_t processStartTime = strtol(processStartTimeString, NULL, 10);
time_t processUptime = tv.tv_sec - processStartTime;
sprintf(processUptimeString, "%d", processUptime);
sprintf(processUptimeString, "%zd", processUptime);
config_params_.SetKeyValue(BREAKPAD_PROCESS_UP_TIME, processUptimeString);
}
sprintf(processCrashtimeString, "%d", tv.tv_sec);
sprintf(processCrashtimeString, "%zd", tv.tv_sec);
config_params_.SetKeyValue(BREAKPAD_PROCESS_CRASH_TIME,
processCrashtimeString);
}

View file

@ -137,7 +137,7 @@ __breakpad_fdnlist_64(int fd, breakpad_nlist *list, const char **symbolNames) {
breakpad_nlist space[BUFSIZ/sizeof (breakpad_nlist)];
const register char *s1, *s2;
register int n, m;
register register_t n, m;
int maxlen, nreq;
off_t sa; /* symbol address */
off_t ss; /* start of strings */
@ -160,14 +160,14 @@ __breakpad_fdnlist_64(int fd, breakpad_nlist *list, const char **symbolNames) {
(N_BADMAG(buf) && *((long *)&buf) != MH_MAGIC &&
NXSwapBigLongToHost(*((long *)&buf)) != FAT_MAGIC) &&
/* nealsid: The following is the big-endian ppc64 check */
(*((uint32_t*)&buf)) != FAT_MAGIC) {
(*((long*)&buf)) != FAT_MAGIC) {
return (-1);
}
/* Deal with fat file if necessary */
if (NXSwapBigLongToHost(*((long *)&buf)) == FAT_MAGIC ||
/* nealsid: The following is the big-endian ppc64 check */
*((int*)&buf) == FAT_MAGIC) {
*((unsigned int *)&buf) == FAT_MAGIC) {
struct host_basic_info hbi;
struct fat_header fh;
struct fat_arch *fat_archs, *fap;
@ -191,7 +191,7 @@ __breakpad_fdnlist_64(int fd, breakpad_nlist *list, const char **symbolNames) {
}
/* Convert fat_narchs to host byte order */
fh.nfat_arch = NXSwapBigLongToHost(fh.nfat_arch);
fh.nfat_arch = NXSwapBigIntToHost(fh.nfat_arch);
/* Read in the fat archs */
fat_archs = (struct fat_arch *)malloc(fh.nfat_arch *
@ -201,7 +201,7 @@ __breakpad_fdnlist_64(int fd, breakpad_nlist *list, const char **symbolNames) {
}
if (read(fd, (char *)fat_archs,
sizeof(struct fat_arch) * fh.nfat_arch) !=
sizeof(struct fat_arch) * fh.nfat_arch) {
(ssize_t)sizeof(struct fat_arch) * fh.nfat_arch) {
free(fat_archs);
return (-1);
}
@ -212,15 +212,15 @@ __breakpad_fdnlist_64(int fd, breakpad_nlist *list, const char **symbolNames) {
*/
for (i = 0; i < fh.nfat_arch; i++) {
fat_archs[i].cputype =
NXSwapBigLongToHost(fat_archs[i].cputype);
NXSwapBigIntToHost(fat_archs[i].cputype);
fat_archs[i].cpusubtype =
NXSwapBigLongToHost(fat_archs[i].cpusubtype);
NXSwapBigIntToHost(fat_archs[i].cpusubtype);
fat_archs[i].offset =
NXSwapBigLongToHost(fat_archs[i].offset);
NXSwapBigIntToHost(fat_archs[i].offset);
fat_archs[i].size =
NXSwapBigLongToHost(fat_archs[i].size);
NXSwapBigIntToHost(fat_archs[i].size);
fat_archs[i].align =
NXSwapBigLongToHost(fat_archs[i].align);
NXSwapBigIntToHost(fat_archs[i].align);
}
fap = NULL;
@ -257,7 +257,7 @@ __breakpad_fdnlist_64(int fd, breakpad_nlist *list, const char **symbolNames) {
}
}
if (*((int *)&buf) == MH_MAGIC_64) {
if (*((unsigned int *)&buf) == MH_MAGIC_64) {
struct mach_header_64 mh;
struct load_command *load_commands, *lcp;
struct symtab_command *stp;

View file

@ -129,7 +129,7 @@ static void* ReadTaskString(task_port_t target_task,
size_to_end > kMaxStringLength ? kMaxStringLength : size_to_end;
kern_return_t kr;
return ReadTaskMemory(target_task, address, size_to_read, &kr);
return ReadTaskMemory(target_task, address, (size_t)size_to_read, &kr);
}
return NULL;
@ -276,13 +276,11 @@ void DynamicImage::Print() {
//==============================================================================
// Loads information about dynamically loaded code in the given task.
DynamicImages::DynamicImages(mach_port_t task)
: task_(task) {
: task_(task), image_list_() {
ReadImageInfoForTask();
}
void* DynamicImages::GetDyldAllImageInfosPointer()
{
void* DynamicImages::GetDyldAllImageInfosPointer() {
const char *imageSymbolName = "_dyld_all_image_infos";
const char *dyldPath = "/usr/lib/dyld";
#ifndef __LP64__
@ -364,7 +362,7 @@ void DynamicImages::ReadImageInfoForTask() {
// Now determine the total amount we really want to read based on the
// size of the load commands. We need the header plus all of the
// load commands.
unsigned int header_size =
size_t header_size =
sizeof(breakpad_mach_header) + header->sizeofcmds;
free(header);

View file

@ -103,7 +103,7 @@ class MachHeader {
class DynamicImage {
public:
DynamicImage(breakpad_mach_header *header, // we take ownership
int header_size, // includes load commands
size_t header_size, // includes load commands
breakpad_mach_header *load_address,
char *inFilePath,
uintptr_t image_mod_date,
@ -112,7 +112,12 @@ class DynamicImage {
header_size_(header_size),
load_address_(load_address),
file_mod_date_(image_mod_date),
task_(task) {
task_(task),
vmaddr_(0),
vmsize_(0),
slide_(0),
version_(0),
file_path_(NULL) {
InitializeFilePath(inFilePath);
CalculateMemoryAndVersionInfo();
}
@ -128,7 +133,7 @@ class DynamicImage {
breakpad_mach_header *GetMachHeader() {return header_;}
// Size of mach_header plus load commands
int GetHeaderSize() const {return header_size_;}
size_t GetHeaderSize() const {return header_size_;}
// Full path to mach-o binary
char *GetFilePath() {return file_path_;}
@ -160,6 +165,9 @@ class DynamicImage {
void Print();
private:
DynamicImage(const DynamicImage &);
DynamicImage &operator=(const DynamicImage &);
friend class DynamicImages;
// Sanity checking
@ -180,7 +188,7 @@ class DynamicImage {
void CalculateMemoryAndVersionInfo();
breakpad_mach_header *header_; // our local copy of the header
int header_size_; // mach_header plus load commands
size_t header_size_; // mach_header plus load commands
breakpad_mach_header *load_address_; // base address image is mapped into
mach_vm_address_t vmaddr_;
mach_vm_size_t vmsize_;
@ -231,13 +239,13 @@ class DynamicImages {
explicit DynamicImages(mach_port_t task);
~DynamicImages() {
for (int i = 0; i < (int)image_list_.size(); ++i) {
for (int i = 0; i < GetImageCount(); ++i) {
delete image_list_[i];
}
}
// Returns the number of dynamically loaded mach-o images.
int GetImageCount() const {return image_list_.size();}
int GetImageCount() const {return static_cast<int>(image_list_.size());}
// Returns an individual image.
DynamicImage *GetImage(int i) {
@ -256,14 +264,14 @@ class DynamicImages {
// Debugging
void Print() {
for (int i = 0; i < (int)image_list_.size(); ++i) {
for (int i = 0; i < GetImageCount(); ++i) {
image_list_[i]->Print();
}
}
void TestPrint() {
const breakpad_mach_header *header;
for (int i = 0; i < (int)image_list_.size(); ++i) {
for (int i = 0; i < GetImageCount(); ++i) {
printf("dyld: %p: name = %s\n", _dyld_get_image_header(i),
_dyld_get_image_name(i) );

View file

@ -61,8 +61,8 @@ static void SoonToCrash() {
Crasher();
}
bool MDCallback(const char *dump_dir, const char *file_name,
void *context, bool success) {
static bool MDCallback(const char *dump_dir, const char *file_name,
void *context, bool success) {
string path(dump_dir);
string dest(dump_dir);
path.append(file_name);

View file

@ -57,7 +57,8 @@ namespace google_breakpad {
// constructor when generating from within the crashed process
MinidumpGenerator::MinidumpGenerator()
: exception_type_(0),
: writer_(),
exception_type_(0),
exception_code_(0),
exception_subcode_(0),
exception_thread_(0),
@ -71,12 +72,14 @@ MinidumpGenerator::MinidumpGenerator()
// crashed process
MinidumpGenerator::MinidumpGenerator(mach_port_t crashing_task,
mach_port_t handler_thread)
: exception_type_(0),
: writer_(),
exception_type_(0),
exception_code_(0),
exception_subcode_(0),
exception_thread_(0),
crashing_task_(crashing_task),
handler_thread_(handler_thread) {
handler_thread_(handler_thread),
dynamic_images_(NULL) {
if (crashing_task != mach_task_self()) {
dynamic_images_ = new DynamicImages(crashing_task_);
} else {
@ -488,7 +491,7 @@ bool MinidumpGenerator::WriteContext(breakpad_thread_state_data_t state,
// not used in the flags register. Since the minidump format
// specifies 32 bits for the flags register, we can truncate safely
// with no loss.
context_ptr->eflags = machine_state->__rflags;
context_ptr->eflags = static_cast<u_int32_t>(machine_state->__rflags);
AddReg(cs);
AddReg(fs);
AddReg(gs);
@ -727,7 +730,7 @@ bool MinidumpGenerator::WriteModuleStream(unsigned int index,
return false;
module->base_of_image = image->GetVMAddr() + image->GetVMAddrSlide();
module->size_of_image = image->GetVMSize();
module->size_of_image = static_cast<u_int32_t>(image->GetVMSize());
module->module_name_rva = string_location.rva;
// We'll skip the executable module, because they don't have
@ -794,7 +797,7 @@ bool MinidumpGenerator::WriteModuleStream(unsigned int index,
return false;
module->base_of_image = seg->vmaddr + slide;
module->size_of_image = seg->vmsize;
module->size_of_image = static_cast<u_int32_t>(seg->vmsize);
module->module_name_rva = string_location.rva;
if (!WriteCVRecord(module, cpu_type, name))
@ -943,8 +946,10 @@ bool MinidumpGenerator::WriteMiscInfoStream(MDRawDirectory *misc_info_stream) {
struct rusage usage;
if (getrusage(RUSAGE_SELF, &usage) != -1) {
// Omit the fractional time since the MDRawMiscInfo only wants seconds
info_ptr->process_user_time = usage.ru_utime.tv_sec;
info_ptr->process_kernel_time = usage.ru_stime.tv_sec;
info_ptr->process_user_time =
static_cast<u_int32_t>(usage.ru_utime.tv_sec);
info_ptr->process_kernel_time =
static_cast<u_int32_t>(usage.ru_stime.tv_sec);
}
int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, info_ptr->process_id };
size_t size;
@ -956,20 +961,22 @@ bool MinidumpGenerator::WriteMiscInfoStream(MDRawDirectory *misc_info_stream) {
true) == KERN_SUCCESS) {
struct kinfo_proc *proc = (struct kinfo_proc *)addr;
if (!sysctl(mib, sizeof(mib) / sizeof(mib[0]), proc, &size, NULL, 0))
info_ptr->process_create_time = proc->kp_proc.p_starttime.tv_sec;
info_ptr->process_create_time =
static_cast<u_int32_t>(proc->kp_proc.p_starttime.tv_sec);
mach_vm_deallocate(mach_task_self(), addr, size);
}
}
// Speed
uint64_t speed;
const uint64_t kOneMillion = 1000 * 1000;
size = sizeof(speed);
sysctlbyname("hw.cpufrequency_max", &speed, &size, NULL, 0);
info_ptr->processor_max_mhz = speed / (1000 * 1000);
info_ptr->processor_mhz_limit = speed / (1000 * 1000);
info_ptr->processor_max_mhz = static_cast<u_int32_t>(speed / kOneMillion);
info_ptr->processor_mhz_limit = static_cast<u_int32_t>(speed / kOneMillion);
size = sizeof(speed);
sysctlbyname("hw.cpufrequency", &speed, &size, NULL, 0);
info_ptr->processor_current_mhz = speed / (1000 * 1000);
info_ptr->processor_current_mhz = static_cast<u_int32_t>(speed / kOneMillion);
return true;
}

View file

@ -59,7 +59,7 @@ ProtectedMemoryAllocator::~ProtectedMemoryAllocator() {
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
char *ProtectedMemoryAllocator::Allocate(size_t bytes) {
char *ProtectedMemoryAllocator::Allocate(vm_size_t bytes) {
if (valid_ && next_alloc_offset_ + bytes <= pool_size_) {
char *p = (char*)base_address_ + next_alloc_offset_;
next_alloc_offset_ += bytes;

View file

@ -53,7 +53,7 @@ class ProtectedMemoryAllocator {
// Fails by returning NULL is no more space is available.
// Please note that the pointers returned from this method should not
// be freed in any way (for example by calling free() on them ).
char * Allocate(size_t n);
char * Allocate(vm_size_t n);
// Returns the base address of the allocation pool.
char * GetBaseAddress() { return (char*)base_address_; }
@ -78,7 +78,7 @@ class ProtectedMemoryAllocator {
private:
vm_size_t pool_size_;
vm_address_t base_address_;
int next_alloc_offset_;
vm_size_t next_alloc_offset_;
bool valid_;
};

View file

@ -35,6 +35,7 @@
#include <Foundation/Foundation.h>
#include "client/mac/Framework/Breakpad.h"
#import "GTMDefines.h"
#define kClientIdPreferenceKey @"clientid"
@ -53,10 +54,10 @@ extern NSString *const kDefaultServerType;
// work in the middle of a validation.
@interface LengthLimitingTextField : NSTextField {
@private
unsigned int maximumLength_;
NSUInteger maximumLength_;
}
- (void) setMaximumLength:(unsigned int)maxLength;
- (void)setMaximumLength:(NSUInteger)maxLength;
@end
@interface Reporter : NSObject {

View file

@ -56,20 +56,20 @@ NSString *const kDefaultServerType = @"google";
@interface NSView (ResizabilityExtentions)
// Shifts the view vertically by the given amount.
- (void)breakpad_shiftVertically:(float)offset;
- (void)breakpad_shiftVertically:(CGFloat)offset;
// Shifts the view horizontally by the given amount.
- (void)breakpad_shiftHorizontally:(float)offset;
- (void)breakpad_shiftHorizontally:(CGFloat)offset;
@end
@implementation NSView (ResizabilityExtentions)
- (void)breakpad_shiftVertically:(float)offset {
- (void)breakpad_shiftVertically:(CGFloat)offset {
NSPoint origin = [self frame].origin;
origin.y += offset;
[self setFrameOrigin:origin];
}
- (void)breakpad_shiftHorizontally:(float)offset {
- (void)breakpad_shiftHorizontally:(CGFloat)offset {
NSPoint origin = [self frame].origin;
origin.x += offset;
[self setFrameOrigin:origin];
@ -79,11 +79,11 @@ NSString *const kDefaultServerType = @"google";
@interface NSWindow (ResizabilityExtentions)
// Adjusts the window height by heightDelta relative to its current height,
// keeping all the content at the same size.
- (void)breakpad_adjustHeight:(float)heightDelta;
- (void)breakpad_adjustHeight:(CGFloat)heightDelta;
@end
@implementation NSWindow (ResizabilityExtentions)
- (void)breakpad_adjustHeight:(float)heightDelta {
- (void)breakpad_adjustHeight:(CGFloat)heightDelta {
[[self contentView] setAutoresizesSubviews:NO];
NSRect windowFrame = [self frame];
@ -101,16 +101,16 @@ NSString *const kDefaultServerType = @"google";
// Grows or shrinks the height of the field to the minimum required to show the
// current text, preserving the existing width and origin.
// Returns the change in height.
- (float)breakpad_adjustHeightToFit;
- (CGFloat)breakpad_adjustHeightToFit;
// Grows or shrinks the width of the field to the minimum required to show the
// current text, preserving the existing height and origin.
// Returns the change in width.
- (float)breakpad_adjustWidthToFit;
- (CGFloat)breakpad_adjustWidthToFit;
@end
@implementation NSTextField (ResizabilityExtentions)
- (float)breakpad_adjustHeightToFit {
- (CGFloat)breakpad_adjustHeightToFit {
NSRect oldFrame = [self frame];
// Starting with the 10.5 SDK, height won't grow, so make it huge to start.
NSRect presizeFrame = oldFrame;
@ -125,7 +125,7 @@ NSString *const kDefaultServerType = @"google";
return newSize.height - NSHeight(oldFrame);
}
- (float)breakpad_adjustWidthToFit {
- (CGFloat)breakpad_adjustWidthToFit {
NSRect oldFrame = [self frame];
[self sizeToFit];
return NSWidth([self frame]) - NSWidth(oldFrame);
@ -136,11 +136,11 @@ NSString *const kDefaultServerType = @"google";
// Resizes to fit the label using IB-style size-to-fit metrics and enforcing a
// minimum width of 70, while preserving the right edge location.
// Returns the change in width.
- (float)breakpad_smartSizeToFit;
- (CGFloat)breakpad_smartSizeToFit;
@end
@implementation NSButton (ResizabilityExtentions)
- (float)breakpad_smartSizeToFit {
- (CGFloat)breakpad_smartSizeToFit {
NSRect oldFrame = [self frame];
[self sizeToFit];
NSRect newFrame = [self frame];
@ -218,7 +218,8 @@ NSString *const kDefaultServerType = @"google";
// Run an alert window with the given timeout. Returns
// NSRunStoppedResponse if the timeout is exceeded. A timeout of 0
// queues the message immediately in the modal run loop.
- (int)runModalWindow:(NSWindow*)window withTimeout:(NSTimeInterval)timeout;
- (NSInteger)runModalWindow:(NSWindow*)window
withTimeout:(NSTimeInterval)timeout;
// Returns a unique client id (user-specific), creating a persistent
// one in the user defaults, if necessary.
@ -386,7 +387,7 @@ NSString *const kDefaultServerType = @"google";
}
// Otherwise, if we have no client id, generate one!
srandom([[NSDate date] timeIntervalSince1970]);
srandom((int)[[NSDate date] timeIntervalSince1970]);
long clientId1 = random();
long clientId2 = random();
long clientId3 = random();
@ -403,8 +404,8 @@ NSString *const kDefaultServerType = @"google";
unsigned int logFileCounter = 0;
NSString *logPath;
int logFileTailSize = [[parameters_ objectForKey:@BREAKPAD_LOGFILE_UPLOAD_SIZE]
intValue];
size_t logFileTailSize =
[[parameters_ objectForKey:@BREAKPAD_LOGFILE_UPLOAD_SIZE] intValue];
NSMutableArray *logFilenames; // An array of NSString, one per log file
logFilenames = [[NSMutableArray alloc] init];
@ -544,7 +545,7 @@ NSString *const kDefaultServerType = @"google";
// Get the timeout value for the notification.
NSTimeInterval timeout = [self messageTimeout];
int buttonPressed = NSAlertAlternateReturn;
NSInteger buttonPressed = NSAlertAlternateReturn;
// Determine whether we should create a text box for user feedback.
if ([self shouldRequestComments]) {
BOOL didLoadNib = [NSBundle loadNibNamed:@"Breakpad" owner:self];
@ -592,7 +593,7 @@ NSString *const kDefaultServerType = @"google";
[commentMessage_ setStringValue:[NSString stringWithFormat:@"%@\n\n%@",
[self explanatoryDialogText],
NSLocalizedString(@"commentsMsg", @"")]];
float commentHeightDelta = [commentMessage_ breakpad_adjustHeightToFit];
CGFloat commentHeightDelta = [commentMessage_ breakpad_adjustHeightToFit];
[headerBox_ breakpad_shiftVertically:commentHeightDelta];
[alertWindow_ breakpad_adjustHeight:commentHeightDelta];
@ -600,7 +601,7 @@ NSString *const kDefaultServerType = @"google";
// section depending on whether or not we are asking for email.
if (includeEmail) {
[emailMessage_ setStringValue:NSLocalizedString(@"emailMsg", @"")];
float emailHeightDelta = [emailMessage_ breakpad_adjustHeightToFit];
CGFloat emailHeightDelta = [emailMessage_ breakpad_adjustHeightToFit];
[preEmailBox_ breakpad_shiftVertically:emailHeightDelta];
[alertWindow_ breakpad_adjustHeight:emailHeightDelta];
} else {
@ -609,7 +610,7 @@ NSString *const kDefaultServerType = @"google";
// Localize the email label, and shift the associated text field.
[emailLabel_ setStringValue:NSLocalizedString(@"emailLabel", @"")];
float emailLabelWidthDelta = [emailLabel_ breakpad_adjustWidthToFit];
CGFloat emailLabelWidthDelta = [emailLabel_ breakpad_adjustWidthToFit];
[emailEntryField_ breakpad_shiftHorizontally:emailLabelWidthDelta];
// Localize the placeholder text.
@ -620,12 +621,12 @@ NSString *const kDefaultServerType = @"google";
// Localize the privacy policy label, and keep it right-aligned to the arrow.
[privacyLinkLabel_ setStringValue:NSLocalizedString(@"privacyLabel", @"")];
float privacyLabelWidthDelta = [privacyLinkLabel_ breakpad_adjustWidthToFit];
CGFloat privacyLabelWidthDelta = [privacyLinkLabel_ breakpad_adjustWidthToFit];
[privacyLinkLabel_ breakpad_shiftHorizontally:(-privacyLabelWidthDelta)];
// Localize the buttons, and keep the cancel button at the right distance.
[sendButton_ setTitle:NSLocalizedString(@"sendReportButton", @"")];
float sendButtonWidthDelta = [sendButton_ breakpad_smartSizeToFit];
CGFloat sendButtonWidthDelta = [sendButton_ breakpad_smartSizeToFit];
[cancelButton_ breakpad_shiftHorizontally:(-sendButtonWidthDelta)];
[cancelButton_ setTitle:NSLocalizedString(@"cancelButton", @"")];
[cancelButton_ breakpad_smartSizeToFit];
@ -633,12 +634,13 @@ NSString *const kDefaultServerType = @"google";
- (void)removeEmailPrompt {
[emailSectionBox_ setHidden:YES];
float emailSectionHeight = NSHeight([emailSectionBox_ frame]);
CGFloat emailSectionHeight = NSHeight([emailSectionBox_ frame]);
[preEmailBox_ breakpad_shiftVertically:(-emailSectionHeight)];
[alertWindow_ breakpad_adjustHeight:(-emailSectionHeight)];
}
- (int)runModalWindow:(NSWindow*)window withTimeout:(NSTimeInterval)timeout {
- (NSInteger)runModalWindow:(NSWindow*)window
withTimeout:(NSTimeInterval)timeout {
// Queue a |stopModal| message to be performed in |timeout| seconds.
if (timeout > 0.001) {
remainingDialogTime_ = timeout;
@ -653,7 +655,7 @@ NSString *const kDefaultServerType = @"google";
// Run the window modally and wait for either a |stopModal| message or a
// button click.
[NSApp activateIgnoringOtherApps:YES];
int returnMethod = [NSApp runModalForWindow:window];
NSInteger returnMethod = [NSApp runModalForWindow:window];
return returnMethod;
}
@ -717,7 +719,7 @@ doCommandBySelector:(SEL)commandSelector {
if (remainingDialogTime_ > 59) {
// calculate minutes remaining for UI purposes
displayedTimeLeft = (remainingDialogTime_ / 60);
displayedTimeLeft = (int)(remainingDialogTime_ / 60);
if (displayedTimeLeft == 1) {
formatString = NSLocalizedString(@"countdownMsgMinuteSingular", @"");
@ -725,8 +727,8 @@ doCommandBySelector:(SEL)commandSelector {
formatString = NSLocalizedString(@"countdownMsgMinutesPlural", @"");
}
} else {
displayedTimeLeft = remainingDialogTime_;
if (remainingDialogTime_ == 1) {
displayedTimeLeft = (int)remainingDialogTime_;
if (displayedTimeLeft == 1) {
formatString = NSLocalizedString(@"countdownMsgSecondSingular", @"");
} else {
formatString = NSLocalizedString(@"countdownMsgSecondsPlural", @"");
@ -797,7 +799,8 @@ doCommandBySelector:(SEL)commandSelector {
NSTimeInterval now = CFAbsoluteTimeGetCurrent();
NSTimeInterval spanSeconds = (now - lastTime);
[programDict setObject:[NSNumber numberWithFloat:now] forKey:kLastSubmission];
[programDict setObject:[NSNumber numberWithDouble:now]
forKey:kLastSubmission];
[ud setObject:programDict forKey:program];
[ud synchronize];
@ -1055,7 +1058,7 @@ doCommandBySelector:(SEL)commandSelector {
//=============================================================================
@implementation LengthLimitingTextField
- (void) setMaximumLength:(unsigned int)maxLength {
- (void)setMaximumLength:(NSUInteger)maxLength {
maximumLength_ = maxLength;
}
@ -1072,7 +1075,7 @@ shouldChangeTextInRange:(NSRange)affectedCharRange
}
// Figure out what the new string length would be, taking into
// account user selections.
int newStringLength =
NSUInteger newStringLength =
[[textView string] length] - affectedCharRange.length +
[replacementString length];
if (newStringLength > maximumLength_) {
@ -1088,7 +1091,7 @@ shouldChangeTextInRange:(NSRange)affectedCharRange
NSText* fieldEditor = [self currentEditor];
if (fieldEditor != nil) {
// Check for a single "Command" modifier
unsigned int modifiers = [event modifierFlags];
NSUInteger modifiers = [event modifierFlags];
modifiers &= NSDeviceIndependentModifierFlagsMask;
if (modifiers == NSCommandKeyMask) {
// Now, check for Select All, Cut, Copy, or Paste key equivalents.

View file

@ -31,6 +31,7 @@
#import "Controller.h"
#import "TestClass.h"
#import "GTMDefines.h"
#include <unistd.h>
#include <mach/mach.h>
@ -51,7 +52,7 @@
}
- (IBAction)forkTestOptions:(id)sender {
int tag = [[sender selectedCell] tag];
NSInteger tag = [[sender selectedCell] tag];
NSLog(@"sender tag: %d", tag);
if (tag <= 2) {
bpForkOption = tag;
@ -129,11 +130,11 @@
}
- (IBAction)crash:(id)sender {
int tag = [sender tag];
NSInteger tag = [sender tag];
if (tag == 1) {
[NSObject cancelPreviousPerformRequestsWithTarget:self];
[self performSelector:@selector(causeCrash) withObject:nil afterDelay:10];
[self performSelector:@selector(causeCrash) withObject:nil afterDelay:10.0];
[sender setState:NSOnState];
return;
}

File diff suppressed because it is too large Load diff

View file

@ -78,7 +78,7 @@ void InternalTestClass::InternalFunction(AStruct &s) {
float InternalTestClass::kStaticFloatValue = 42;
static float PlainOldFunction() {
return 3.14145;
return 3.14145f;
}
@implementation TestClass

View file

@ -27,7 +27,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#import <GTMSenTestCase.h>
#import "GTMSenTestCase.h"
#import "SimpleStringDictionary.h"
@interface SimpleStringDictionaryTest : GTMTestCase {

View file

@ -61,27 +61,30 @@ inline bool TypedMDRVA<MDType>::AllocateArray(size_t count) {
}
template<typename MDType>
inline bool TypedMDRVA<MDType>::AllocateObjectAndArray(unsigned int count,
size_t size) {
assert(count && size);
inline bool TypedMDRVA<MDType>::AllocateObjectAndArray(size_t count,
size_t length) {
assert(count && length);
allocation_state_ = SINGLE_OBJECT_WITH_ARRAY;
return UntypedMDRVA::Allocate(minidump_size<MDType>::size() + count * size);
return UntypedMDRVA::Allocate(minidump_size<MDType>::size() + count * length);
}
template<typename MDType>
inline bool TypedMDRVA<MDType>::CopyIndex(unsigned int index, MDType *item) {
assert(allocation_state_ == ARRAY);
return writer_->Copy(position_ + index * minidump_size<MDType>::size(), item,
minidump_size<MDType>::size());
return writer_->Copy(
static_cast<MDRVA>(position_ + index * minidump_size<MDType>::size()),
item, minidump_size<MDType>::size());
}
template<typename MDType>
inline bool TypedMDRVA<MDType>::CopyIndexAfterObject(unsigned int index,
const void *src,
size_t size) {
size_t length) {
assert(allocation_state_ == SINGLE_OBJECT_WITH_ARRAY);
return writer_->Copy(position_ + minidump_size<MDType>::size() + index * size,
src, size);
return writer_->Copy(
static_cast<MDRVA>(position_ + minidump_size<MDType>::size()
+ index * length),
src, length);
}
template<typename MDType>

View file

@ -107,7 +107,7 @@ bool MinidumpFileWriter::CopyStringToMDString(const wchar_t *str,
// zero, but the second one may be zero, depending on the conversion from
// UTF-32.
int out_count = out[1] ? 2 : 1;
int out_size = sizeof(u_int16_t) * out_count;
size_t out_size = sizeof(u_int16_t) * out_count;
result = mdstring->CopyIndexAfterObject(out_idx, out, out_size);
out_idx += out_count;
}
@ -134,7 +134,7 @@ bool MinidumpFileWriter::CopyStringToMDString(const char *str,
// Append the one or two UTF-16 characters
int out_count = out[1] ? 2 : 1;
int out_size = sizeof(u_int16_t) * out_count;
size_t out_size = sizeof(u_int16_t) * out_count;
result = mdstring->CopyIndexAfterObject(out_idx, out, out_size);
out_idx += out_count;
}
@ -161,7 +161,8 @@ bool MinidumpFileWriter::WriteStringCore(const CharType *str,
return false;
// Set length excluding the NULL and copy the string
mdstring.get()->length = mdstring_length * sizeof(u_int16_t);
mdstring.get()->length =
static_cast<u_int32_t>(mdstring_length * sizeof(u_int16_t));
bool result = CopyStringToMDString(str, mdstring_length, &mdstring);
// NULL terminate
@ -235,15 +236,15 @@ bool MinidumpFileWriter::Copy(MDRVA position, const void *src, ssize_t size) {
assert(file_ != -1);
// Ensure that the data will fit in the allocated space
if (size + position > size_)
if (static_cast<size_t>(size + position) > size_)
return false;
// Seek and write the data
#if __linux__
if (sys_lseek(file_, position, SEEK_SET) == static_cast<off_t>(position)) {
if (sys_lseek(file_, position, SEEK_SET) == position) {
if (sys_write(file_, src, size) == size) {
#else
if (lseek(file_, position, SEEK_SET) == static_cast<off_t>(position)) {
if (lseek(file_, position, SEEK_SET) == position) {
if (write(file_, src, size) == size) {
#endif
return true;
@ -260,11 +261,11 @@ bool UntypedMDRVA::Allocate(size_t size) {
return position_ != MinidumpFileWriter::kInvalidMDRVA;
}
bool UntypedMDRVA::Copy(MDRVA position, const void *src, size_t size) {
bool UntypedMDRVA::Copy(MDRVA pos, const void *src, size_t size) {
assert(src);
assert(size);
assert(position + size <= position_ + size_);
return writer_->Copy(position, src, size);
assert(pos + size <= position_ + size_);
return writer_->Copy(pos, src, size);
}
} // namespace google_breakpad

View file

@ -151,7 +151,7 @@ class UntypedMDRVA {
// Return size and position
inline MDLocationDescriptor location() const {
MDLocationDescriptor location = { size_, position_ };
MDLocationDescriptor location = { static_cast<int>(size_), position_ };
return location;
}
@ -218,7 +218,7 @@ class TypedMDRVA : public UntypedMDRVA {
// Allocate an array of |count| elements of |size| after object of MDType
// Must not call more than once.
// Return true on success, or false on failure
bool AllocateObjectAndArray(unsigned int count, size_t size);
bool AllocateObjectAndArray(size_t count, size_t size);
// Copy |item| to |index|
// Must have been allocated using AllocateArray().

View file

@ -144,22 +144,23 @@ static bool CompareFile(const char *path) {
0x0000000a, 0x000a1c09, 0x0000000b, 0x00000000,
#endif
};
unsigned int expected_byte_count = sizeof(expected);
size_t expected_byte_count = sizeof(expected);
int fd = open(path, O_RDONLY, 0600);
void *buffer = malloc(expected_byte_count);
ASSERT_NE(fd, -1);
ASSERT_TRUE(buffer);
ASSERT_EQ(read(fd, buffer, expected_byte_count), expected_byte_count);
ASSERT_EQ(read(fd, buffer, expected_byte_count),
static_cast<ssize_t>(expected_byte_count));
char *b1, *b2;
b1 = (char*)buffer;
b2 = (char*)expected;
b1 = reinterpret_cast<char*>(buffer);
b2 = reinterpret_cast<char*>(expected);
while (*b1 == *b2) {
b1++;
b2++;
}
printf("%d\n",b1 - (char*)buffer);
printf("%p\n", reinterpret_cast<void*>(b1 - (char*)buffer));
ASSERT_EQ(memcmp(buffer, expected, expected_byte_count), 0);
return true;