BluesZhang / gdata-objectivec-client

Automatically exported from code.google.com/p/gdata-objectivec-client
Other
0 stars 0 forks source link

[PATCH] fix build on 10.4 with Xcode 2.5 #14

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. try to build on a 10.4 machine with Xcode 2.5.

What is the expected output?
a successful build.

What do you see instead?
errors caused by the use of the wrong GDATA_FOREACH variant (the new syntax
one that uses "for ... in").

the problem is that MAC_OS_X_VERSION_10_5, which you're using in the guard,
isn't [necessarily] defined on 10.4l; here's one possible fix:

Index: Source/GDataDefines.h
===================================================================
--- Source/GDataDefines.h       (revision 177)
+++ Source/GDataDefines.h       (working copy)
@@ -113,13 +113,14 @@
 // reliance on NSEnumerator for 10.4
 //
 #ifndef GDATA_FOREACH
-  #if defined(TARGET_OS_IPHONE) || MAC_OS_X_VERSION_MIN_REQUIRED >=
MAC_OS_X_VERSION_10_5
+  #if !defined(TARGET_OS_IPHONE) || \
+      MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4
     #define GDATA_FOREACH(element, collection) \
-      for (element in collection)
+      for(id _ ## element ## _enum = [collection objectEnumerator]; \
+          (element = [_ ## element ## _enum nextObject]) != nil; )
   #else
     #define GDATA_FOREACH(element, collection) \
-      for(id _ ## element ## _enum = [collection objectEnumerator]; \
-          (element = [_ ## element ## _enum nextObject]) != nil; )
+      for (element in collection)
   #endif
 #endif

i guess it would be more idiomatic to check defined(MAC_OS_X_VERSION_10_5)
before using it, but that makes the guard very long and awkward. reversing
the sense of the test seemed simpler.

Original issue reported on code.google.com by elliott....@gmail.com on 7 Jan 2009 at 6:47

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for pointing this out.

Original comment by gregrobbins on 7 Jan 2009 at 8:49