Index: Source/CFStream.m
===================================================================
--- Source/CFStream.m	(revision 29954)
+++ Source/CFStream.m	(working copy)
@@ -72,10 +72,8 @@
 Boolean
 _CFStreamOpen (CFTypeRef stream)
 {
-  Boolean ret;
-  
   [(NSStream *)stream open];
-  return (_CFStreamGetStatus (stream) == kCFStreamStatusOpen ? true : false);
+  return (_CFStreamGetStatus (stream) == kCFStreamStatusOpen ? TRUE : FALSE);
 }
 
 void
@@ -163,6 +161,7 @@
                                          CFAllocatorRef bufferAllocator)
 {
   // FIXME: ???
+  return NULL;
 }
 
 CFWriteStreamRef
@@ -204,7 +203,7 @@
 Boolean
 CFWriteStreamOpen (CFWriteStreamRef stream)
 {
-  _CFStreamOpen (stream);
+  return _CFStreamOpen (stream);
 }
 
 void
@@ -221,7 +220,7 @@
                         CFStreamClientContext *clientContext)
 {
   // FIXME
-  return false;
+  return FALSE;
 }
 
 Boolean
@@ -272,6 +271,7 @@
                                    CFIndex length, CFAllocatorRef bytesDeallocator)
 {
   // FIXME
+  return NULL;
 }
 
 CFReadStreamRef
@@ -286,6 +286,7 @@
                        CFIndex *numBytesRead)
 {
   // FIXME: docs are  bit confusing
+  return NULL;
 }
 
 CFStreamError
@@ -338,7 +339,7 @@
                        CFStreamClientContext *clientContext)
 {
   // FIXME
-  return false;
+  return FALSE;
 }
 
 Boolean
Index: Source/CFDate.m
===================================================================
--- Source/CFDate.m	(revision 29954)
+++ Source/CFDate.m	(working copy)
@@ -41,6 +41,7 @@
   CFGregorianUnits units)
 {
   // FIXME
+  return 0.0;
 }
 
 CFAbsoluteTime
@@ -53,12 +54,14 @@
 CFAbsoluteTimeGetDayOfWeek (CFAbsoluteTime at, CFTimeZoneRef tz)
 {
   // FIXME
+  return 0;
 }
 
 SInt32
 CFAbsoluteTimeGetDayOfYear (CFAbsoluteTime at, CFTimeZoneRef tz)
 {
   // FIXME
+  return 0;
 }
 
 CFGregorianUnits
@@ -66,38 +69,42 @@
   CFAbsoluteTime at2, CFTimeZoneRef tz, CFOptionFlags unitFlags)
 {
   // FIXME
+  return (CFGregorianUnits){0, 0, 0, 0, 0, 0.0};
 }
 
 CFGregorianDate
 CFAbsoluteTimeGetGregorianDate (CFAbsoluteTime at, CFTimeZoneRef tz)
 {
   // FIXME
+  return (CFGregorianDate){0, 0, 0, 0, 0, 0.0};
 }
 
 SInt32
 CFAbsoluteTimeGetWeekOfYear (CFAbsoluteTime at, CFTimeZoneRef tz)
 {
   // FIXME
+  return 0;
 }
 
 CFAbsoluteTime
 CFGregorianDateGetAbsoluteTime (CFGregorianDate gdate, CFTimeZoneRef tz)
 {
-  // FIXME  
+  // FIXME
+  return 0.0;
 }
 
 Boolean
 CFGregorianDateIsValid (CFGregorianDate gdate, CFOptionFlags unitFlags)
 {
   /* unitFlags is unused, must be ignored */
-  Boolean isValid = false;
+  Boolean isValid = FALSE;
   
   if (unitFlags | kCFGregorianUnitsYears)
-    isValid = true; // FIXME: What's the test here?
+    isValid = TRUE; // FIXME: What's the test here?
   if (unitFlags | kCFGregorianUnitsMonths)
     isValid = ((gdate.month >= 1) && (gdate.month <= 12));
   if (unitFlags | kCFGregorianUnitsDays)
-    isValid = true; // FIXME
+    isValid = TRUE; // FIXME
   if (unitFlags | kCFGregorianUnitsHours)
     isValid = ((gdate.hour >= 0) && (gdate.hour < 24));
     // FIXME: I'm assuming this would be in 24 hour time (24 == 0 in this case)
Index: Source/CFArray.m
===================================================================
--- Source/CFArray.m	(revision 29954)
+++ Source/CFArray.m	(working copy)
@@ -134,6 +134,7 @@
                             const void *value)
 {
   // FIXME
+  return 0;
 }
 
 CFTypeID
Index: Source/CFPropertyList.m
===================================================================
--- Source/CFPropertyList.m	(revision 29954)
+++ Source/CFPropertyList.m	(working copy)
@@ -61,6 +61,7 @@
                               CFOptionFlags mutabilityOption)
 {
   // FIXME
+  return NULL;
 }
 
 // Function is marked as obsolete as of 10.6
@@ -150,7 +151,7 @@
   CFDataRef data;
   CFPropertyListRef ret;
 
-  CFReadStreamRead(stream, buffer, streamLength);
+  CFReadStreamRead(stream, (UInt8 *)buffer, streamLength);
   data = CFDataCreateWithBytesNoCopy(NULL, buffer, streamLength, NULL);
   ret = CFPropertyListCreateWithData(NULL, data, options, format, error);
   CFRelease(data);
Index: Source/CFString.m
===================================================================
--- Source/CFString.m	(revision 29954)
+++ Source/CFString.m	(working copy)
@@ -309,7 +309,7 @@
                               CFIndex numChars)
 {
   return CFStringCreateWithBytes (alloc, (const UInt8 *)chars,
-    numChars * sizeof(UniChar), kCFStringEncodingUnicode, false);
+    numChars * sizeof(UniChar), kCFStringEncodingUnicode, FALSE);
 }
 
 CFStringRef
@@ -317,8 +317,8 @@
                                     const UniChar *chars, CFIndex numChars,
                                     CFAllocatorRef contentsDeallocator)
 {
-  return CFStringCreateWithBytesNoCopy (alloc, (const char *)chars, numChars *
-    sizeof(UniChar), CFStringGetSystemEncoding(), false, contentsDeallocator);
+  return CFStringCreateWithBytesNoCopy (alloc, (const UInt8 *)chars, numChars *
+    sizeof(UniChar), CFStringGetSystemEncoding(), FALSE, contentsDeallocator);
 }
 
 CFStringRef
@@ -409,7 +409,7 @@
   CFRange ret;
   
   if (CFStringFindWithOptions (theString, stringToFind,
-    (CFRange){0, CFStringGetLength(theString)}, compareOptions, &ret) == false)
+    (CFRange){0, CFStringGetLength(theString)}, compareOptions, &ret) == FALSE)
     {
       ret = CFRangeMake (0, 0);
     }
@@ -430,11 +430,11 @@
 
   if (range.location == 0 && range.length == 0)
     {
-      return false;
+      return FALSE;
     }
   
   *result = CFRangeMake(range.location, range.length);
-  return true;
+  return TRUE;
 }
 
 Boolean
@@ -460,11 +460,11 @@
 
   if (range.location == 0 && range.length == 0)
     {
-      return false;
+      return FALSE;
     }
 
   *result = CFRangeMake(range.location, range.length);
-  return true;
+  return TRUE;
 }
 
 CFIndex
@@ -616,7 +616,7 @@
 CFStringGetPascalString (CFStringRef theString, StringPtr buffer,
                          CFIndex bufferSize, CFStringEncoding encoding)
 {
-  return false;
+  return FALSE;
 }
 
 ConstStringPtr
@@ -677,7 +677,7 @@
 Boolean
 CFStringIsEncodingAvailable (CFStringEncoding encoding)
 {
-  return false;
+  return FALSE;
 }
 
 //
@@ -836,6 +836,7 @@
                    CFStringRef transform, Boolean reverse)
 {
   // FIXME
+  return FALSE;
 }
 
 void
Index: Source/CFNumber.m
===================================================================
--- Source/CFNumber.m	(revision 29954)
+++ Source/CFNumber.m	(working copy)
@@ -153,9 +153,9 @@
   if (CFNumberGetType(number) == theType)
     {
       [(NSNumber *)number getValue: valuePtr];
-      return true;
+      return TRUE;
     }
-  return false;
+  return FALSE;
 }
 
 Boolean CFNumberIsFloatType (CFNumberRef number)
@@ -167,7 +167,7 @@
       || strcmp (@encode(double), type) == 0
       || strcmp (@encode(Float32), type) == 0
       || strcmp (@encode(Float64), type) == 0)
-    return true;
+    return TRUE;
   
-  return false;
+  return FALSE;
 }
Index: Source/CFBase.m
===================================================================
--- Source/CFBase.m	(revision 29954)
+++ Source/CFBase.m	(working copy)
@@ -24,48 +24,17 @@
    Boston, MA 02110-1301, USA.
 */ 
 
-#include <Foundation/Foundation.h>
 #include <stddef.h>
 #include <stdlib.h>
+#import <Foundation/NSObject.h>
+#import <Foundation/NSString.h>
+#import <Foundation/NSNull.h>
 
 #include "CoreFoundation/CFBase.h"
 
 const double kCFCoreFoundationVersionNumber = 550.13;
 
 //
-// CFAllocator
-//
-/* FIXME: taken from NSObject.m verbatum for compatibility */
-#ifdef ALIGN
-#undef ALIGN
-#endif
-#define	ALIGN __alignof__(double)
-
-/*
- *	Define a structure to hold information that is held locally
- *	(before the start) in each object.
- */
-typedef struct obj_layout_unpadded {
-    NSUInteger	retained;
-    NSZone	*zone;
-} unp;
-#define	UNP sizeof(unp)
-
-/*
- *	Now do the REAL version - using the other version to determine
- *	what padding (if any) is required to get the alignment of the
- *	structure correct.
- */
-struct obj_layout {
-    NSUInteger	retained;
-    NSZone	*zone;
-    char	padding[ALIGN - ((UNP % ALIGN) ? (UNP % ALIGN) : ALIGN)];
-};
-typedef	struct obj_layout *obj;
-
-
-
-//
 // kCFAllocatorMalloc
 //
 static void * malloc_malloc (CFAllocatorRef alloc, size_t size)
@@ -123,7 +92,7 @@
 //
 static void * null_malloc (CFAllocatorRef alloc, size_t size)
 {
-  return ;
+  return NULL;
 }
 
 static void * null_realloc (CFAllocatorRef alloc, void *ptr, size_t size)
@@ -183,8 +152,6 @@
 
 
 
-/* FIXME: The next few functions were adapted from what's in NSObject.m.  It
-   would really help if parts of those functions were made public. */
 CFAllocatorRef
 CFAllocatorCreate(CFAllocatorRef allocator, CFAllocatorContext *context)
 {
@@ -195,61 +162,31 @@
 void *
 CFAllocatorAllocate(CFAllocatorRef allocator, CFIndex size, CFOptionFlags hint)
 {
-  void *new;
-  int  newSize;
-  
-  newSize = size + sizeof(struct obj_layout);
-  if (allocator == 0)
-    {
-      allocator = CFAllocatorGetDefault();
-    }
-  
-  new = NSZoneMalloc(allocator, size);
-  if (new != NULL)
-    {
-      memset (new, 0, size);
-      ((obj)new)->zone = allocator;
-      new = (void *)&((obj)new)[1];
-    }
-  
-  return new;
-
+  /* A similar check is done in NSZoneMalloc() but our default allocator
+   * may be set to something other than what is returned by
+   * NSDefaultMallocZone(), even though we still don't have that ability.
+   */
+  if (NULL == allocator)
+    allocator = CFAllocatorGetDefault ();
+  return NSZoneMalloc(allocator, size);
 }
 
 void
 CFAllocatorDeallocate(CFAllocatorRef allocator, void *ptr)
 {
-  if (ptr != NULL)
-    {
-      obj o = &((obj)ptr)[-1];
-      NSZoneFree(allocator, o);
-    }
-  
-  return;
+  NSZoneFree(allocator, ptr);
 }
 
 CFIndex
 CFAllocatorGetPreferredSizeForSize(CFAllocatorRef allocator, CFIndex size, CFOptionFlags hint)
 {
-  return 0;  /* FIXME */
+  return 0;  // FIXME
 }
 
 void *
 CFAllocatorReallocate(CFAllocatorRef allocator, void *ptr, CFIndex newsize, CFOptionFlags hint)
 {
-  void *new;
-  CFIndex size;
-  
-  if (allocator == NULL)
-    {
-      allocator = CFAllocatorGetDefault();
-    }
-  
-  size = size + sizeof(struct obj_layout);
-  new = NSZoneRealloc (allocator, &((obj)ptr)[-1], size);
-  new = (void *)&((obj)new)[1];
-  
-  return new;
+  return NSZoneRealloc (allocator, ptr, newsize);
 }
 
 CFAllocatorRef
@@ -261,6 +198,7 @@
 void
 CFAllocatorSetDefault(CFAllocatorRef allocator)
 {
+  // FIXME
 }
 
 void
@@ -272,6 +210,7 @@
 CFTypeID
 CFAllocatorGetTypeID(void)
 {
+  // FIXME
   return 0;
 }
 
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 29954)
+++ ChangeLog	(working copy)
@@ -1,5 +1,17 @@
 2010-02-28 08:43-EST Gregory John Casamento <greg.casamento@gmail.com>
 
+	* Source/CFBase.m: Cleaned up CFAllocator and removed things 
+	that should not have been there in the first place.
+	* Source/CFString.m:
+	* Source/CFDate.m:
+	* Source/CFArray.m:
+	* Source/CFPropertyList.m:
+	* Source/CFString.m:
+	* Source/CFNumber.m: Cleaned up
+	* Headers/CoreFoundation/CFBase.h: Added and fixed defines and types.
+
+2010-02-28 08:43-EST Gregory John Casamento <greg.casamento@gmail.com>
+
 	* Headers/CoreFoundation/CFBase.h: Declare externs where appropriate.
 
 2010-02-12 19:35-EST Gregory John Casamento <greg.casamento@gmail.com>
Index: Headers/CoreFoundation/CFBase.h
===================================================================
--- Headers/CoreFoundation/CFBase.h	(revision 29954)
+++ Headers/CoreFoundation/CFBase.h	(working copy)
@@ -40,7 +40,6 @@
 //
 // CoreFoundation types
 //
-/* These defines are in Apple's CFBase.h */
 typedef uint8_t  Boolean;
 typedef uint8_t  UInt8;
 typedef int8_t   SInt8;
@@ -62,15 +61,36 @@
 typedef SInt16           OSErr;
 typedef SInt16           RegionCode;
 typedef SInt16           LangCode;
+typedef SInt16           ScriptCode;
+typedef UInt32           FourCharCode;
+typedef FourCharCode     OSType;
+typedef UInt8            Byte;
+typedef SInt8            SignedByte;
 
+typedef UInt32 UTF32Char;
+typedef UInt16 UTF16Char;
+typedef UInt8  UTF8Char;
 
 
-#ifndef true
-# define true	1
+
+#ifndef CF_EXPORT_C_BEGIN
+# if defined(__cplusplus)
+#  define CF_EXPORT_C_BEGIN extern "C" {
+#  define CF_EXPORT_C_END }
+# else
+#  define CF_EXPORT_C_BEGIN
+#  define CF_EXPORT_C_END
+# endif
 #endif
-#ifndef false
-# define false	0
+
+#define CF_EXPORT GS_EXPORT
+
+#ifndef TRUE
+# define TRUE  1
 #endif
+#ifndef FALSE
+# define FALSE 0
+#endif
 
 //
 // CFType types
@@ -82,8 +102,9 @@
 //
 // Base Utilities
 //
+typedef unsigned long CFOptionFlags;
 typedef signed long CFIndex;
-typedef UInt32 CFOptionFlags;
+
 struct CFRange
 {
   CFIndex location;
@@ -110,7 +131,7 @@
 typedef CFComparisonResult (*CFComparatorFunction)(const void *val1, const void *val2, void *context);
 
 /* CoreFoundation version numbers */
-extern const double kCFCoreFoundationVersionNumber; 
+CF_EXPORT const double kCFCoreFoundationVersionNumber; 
 #define kCFCoreFoundationVersionNumber10_0    196.40
 #define kCFCoreFoundationVersionNumber10_0_3  196.50
 #define kCFCoreFoundationVersionNumber10_1    226.00
@@ -213,14 +234,14 @@
 };
 typedef struct _CFAllocatorContext CFAllocatorContext;
 
-extern const CFAllocatorRef kCFAllocatorDefault;
-extern const CFAllocatorRef kCFAllocatorSystemDefault;
-extern const CFAllocatorRef kCFAllocatorMalloc;
+CF_EXPORT const CFAllocatorRef kCFAllocatorDefault;
+CF_EXPORT const CFAllocatorRef kCFAllocatorSystemDefault;
+CF_EXPORT const CFAllocatorRef kCFAllocatorMalloc;
 #if 0 // FIXME: OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
-extern const CFAllocatorRef kCFAllocatorMallocZone;
+CF_EXPORT const CFAllocatorRef kCFAllocatorMallocZone;
 #endif
-extern const CFAllocatorRef kCFAllocatorNull;
-extern const CFAllocatorRef kCFAllocatorUseContext;
+CF_EXPORT const CFAllocatorRef kCFAllocatorNull;
+CF_EXPORT const CFAllocatorRef kCFAllocatorUseContext;
 
 CFAllocatorRef
 CFAllocatorCreate (CFAllocatorRef allocator, CFAllocatorContext *context);
