aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2011-02-03 01:30:10 +0000
committerGravatar gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2011-02-03 01:30:10 +0000
commit9bd71325f308d740da800b5c5066b8d8b9fdebba (patch)
treebff193c2328e0b2bad95a941d345883e65f64401
parentabd076bda593dcddb01c54e610fcd370dc48d31f (diff)
[Author: dmaclach]
Fix for building GTM on Snow Leopard. We were getting errors for being unable to protect buffers smaller than 8 chars. R=aharper,thomasvl DELTA=7 (4 added, 0 deleted, 3 changed)
-rw-r--r--AppKit/GTMCarbonEvent.m4
-rw-r--r--Foundation/GTMFourCharCodeTest.m14
2 files changed, 11 insertions, 7 deletions
diff --git a/AppKit/GTMCarbonEvent.m b/AppKit/GTMCarbonEvent.m
index a0fd6ef..a2cf3f9 100644
--- a/AppKit/GTMCarbonEvent.m
+++ b/AppKit/GTMCarbonEvent.m
@@ -157,7 +157,9 @@
// description utliity for debugging
//
- (NSString *)description {
- char cls[5];
+ // Use 8 bytes because stack protection gives us a warning if we use a
+ // smaller buffer.
+ char cls[8];
UInt32 kind;
// Need everything bigendian if we are printing out the class as a "string"
diff --git a/Foundation/GTMFourCharCodeTest.m b/Foundation/GTMFourCharCodeTest.m
index 2197f35..1799629 100644
--- a/Foundation/GTMFourCharCodeTest.m
+++ b/Foundation/GTMFourCharCodeTest.m
@@ -36,17 +36,19 @@ static const FourCharCode kGTMHighMacOSRomanCode = 0xA5A8A9AA; // '•®©™'
// 3.2.5 where in release mode it doesn't like some string constants
// that include high or low ascii using the @"blah" string style.
// So we build them by hand.
- char string[] = { 0, 0, 0, 1 };
- lowAsciiString_ = [[NSString alloc] initWithBytes:string
- length:sizeof(string)
+ // Use 8 bytes instead of 4, because stack protection gives us a warning
+ // if we have a buffer smaller than 8 bytes.
+ char string[8] = { 0, 0, 0, 1, 0, 0, 0, 0 };
+ lowAsciiString_ = [[NSString alloc] initWithBytes:string
+ length:4
encoding:NSASCIIStringEncoding];
-
+
// Must make sure our bytes are in the right order for building strings with,
// otherwise the string comes out in the wrong order on low-endian systems.
FourCharCode orderedString = htonl(kGTMHighMacOSRomanCode);
- highMacOSRomanString_
+ highMacOSRomanString_
= [[NSString alloc] initWithBytes:&orderedString
- length:sizeof(orderedString)
+ length:sizeof(orderedString)
encoding:NSMacOSRomanStringEncoding];
}