adium 5522:56f9652ebff0: Remove breaks after returns in switch s...
commits at adium.im
commits at adium.im
Mon Jun 3 21:26:34 UTC 2013
details: http://hg.adium.im/adium/rev/56f9652ebff0
revision: 5522:56f9652ebff0
branch: (none)
author: Frank Dowsett <wixardy at adium.im>
date: Sun Jun 02 11:34:28 2013 -0400
Remove breaks after returns in switch statements.
Subject: adium 5523:47db4a69f78e: Remove redundant casts.
details: http://hg.adium.im/adium/rev/47db4a69f78e
revision: 5523:47db4a69f78e
branch: (none)
author: Frank Dowsett <wixardy at adium.im>
date: Sun Jun 02 11:36:07 2013 -0400
Remove redundant casts.
Subject: adium 5524:d1ec812f2847: Remove duplicate definitions.
details: http://hg.adium.im/adium/rev/d1ec812f2847
revision: 5524:d1ec812f2847
branch: (none)
author: Frank Dowsett <wixardy at adium.im>
date: Sun Jun 02 11:37:35 2013 -0400
Remove duplicate definitions.
Subject: adium 5525:c9a115801035: This method was removed in 767bcb7a5237.
details: http://hg.adium.im/adium/rev/c9a115801035
revision: 5525:c9a115801035
branch: (none)
author: Frank Dowsett <wixardy at adium.im>
date: Sun Jun 02 11:38:12 2013 -0400
This method was removed in 767bcb7a5237.
Subject: adium 5526:9d132aca3fb4: Don't shadow the instance variable.
details: http://hg.adium.im/adium/rev/9d132aca3fb4
revision: 5526:9d132aca3fb4
branch: (none)
author: Frank Dowsett <wixardy at adium.im>
date: Sun Jun 02 11:38:54 2013 -0400
Don't shadow the instance variable.
Subject: adium 5527:d651cb42808c: Use the proper type for the icon lookup.
details: http://hg.adium.im/adium/rev/d651cb42808c
revision: 5527:d651cb42808c
branch: (none)
author: Frank Dowsett <wixardy at adium.im>
date: Sun Jun 02 11:44:56 2013 -0400
Use the proper type for the icon lookup.
Subject: adium 5528:8a3574f29967: Guard against a nil comparator.
details: http://hg.adium.im/adium/rev/8a3574f29967
revision: 5528:8a3574f29967
branch: (none)
author: Frank Dowsett <wixardy at adium.im>
date: Sun Jun 02 11:57:24 2013 -0400
Guard against a nil comparator.
Subject: adium 5529:c3018a7b41de: merge adium-1.6 into default
details: http://hg.adium.im/adium/rev/c3018a7b41de
revision: 5529:c3018a7b41de
branch: (none)
author: Frank Dowsett <wixardy at adium.im>
date: Sun Jun 02 12:25:19 2013 -0400
merge adium-1.6 into default
Subject: adium 5530:90c61369e36d: Silence a warning about unused return value.
details: http://hg.adium.im/adium/rev/90c61369e36d
revision: 5530:90c61369e36d
branch: (none)
author: Frank Dowsett <wixardy at adium.im>
date: Sun Jun 02 12:26:04 2013 -0400
Silence a warning about unused return value.
Subject: adium 5531:a7ca86f2f35c: NSCalendarDate is deprecated. I've updated the ISO8601 parser to github.com/boredzo/iso-8601-date-formatter/commit/0da1785 and updated all uses of NSCalendarDate.
details: http://hg.adium.im/adium/rev/a7ca86f2f35c
revision: 5531:a7ca86f2f35c
branch: (none)
author: Frank Dowsett <wixardy at adium.im>
date: Mon Jun 03 17:17:12 2013 -0400
NSCalendarDate is deprecated. I've updated the ISO8601 parser to github.com/boredzo/iso-8601-date-formatter/commit/0da1785 and updated all uses of NSCalendarDate.
diffs (truncated from 4128 to 1000 lines):
diff -r f180ef3eb520 -r a7ca86f2f35c Adium.xcodeproj/project.pbxproj
--- a/Adium.xcodeproj/project.pbxproj Fri May 24 00:13:49 2013 +0200
+++ b/Adium.xcodeproj/project.pbxproj Mon Jun 03 17:17:12 2013 -0400
@@ -193,8 +193,6 @@
318EA69C0D7A659900EDB105 /* TestColorAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 318EA69B0D7A659900EDB105 /* TestColorAdditions.m */; };
319B29800CE8EC6F00C65398 /* TestDateAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 319B297F0CE8EC6E00C65398 /* TestDateAdditions.m */; };
31A764B90DA572B8000AC729 /* AutoHyperlinks.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3496A8EA07CE6CA30055BBAB /* AutoHyperlinks.framework */; };
- 31DDDA7112BDD5CE0048F6C0 /* scandate.m in Sources */ = {isa = PBXBuildFile; fileRef = 31DDDA6F12BDD5CE0048F6C0 /* scandate.m */; };
- 31DDDA7A12BDD6E90048F6C0 /* TestScandate.m in Sources */ = {isa = PBXBuildFile; fileRef = 31DDDA7912BDD6E90048F6C0 /* TestScandate.m */; };
31E0CD810C5EEF5200271DB1 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 31E0CD800C5EEF5200271DB1 /* CoreAudio.framework */; };
31FA804C0D4A8EB200ABE634 /* Adium.sdef in Resources */ = {isa = PBXBuildFile; fileRef = 0CAC6A130C0C657A0090AE95 /* Adium.sdef */; };
3402D5A5080DBC91004E50B4 /* SortConfiguration.xib in Resources */ = {isa = PBXBuildFile; fileRef = 347E791D07CAA52300350507 /* SortConfiguration.xib */; };
@@ -226,7 +224,6 @@
3419DE7D0A81042F00C3FC68 /* lock-unlocked.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 34DFF52607A62EB000B92233 /* lock-unlocked.tiff */; };
3419DE7F0A81042F00C3FC68 /* msg-send-file.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 34D8326307CBD598006466F2 /* msg-send-file.tiff */; };
3419DE820A81042F00C3FC68 /* ToolbarPrefs.plist in Resources */ = {isa = PBXBuildFile; fileRef = 34D8327607CBD5B3006466F2 /* ToolbarPrefs.plist */; };
- 3419DF3B0A8119BF00C3FC68 /* AICalendarDate.m in Sources */ = {isa = PBXBuildFile; fileRef = 340D0A000A7DD1F40059A3AF /* AICalendarDate.m */; };
3419E2DF0A81445800C3FC68 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 3419E2DE0A81445800C3FC68 /* Localizable.strings */; };
3419F7760531512200C68BA3 /* Adium.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 34BD9DE105314751000AB133 /* Adium.framework */; };
3419FE230531586A00C68BA3 /* Adium.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 34BD9DE105314751000AB133 /* Adium.framework */; };
@@ -1050,9 +1047,10 @@
5A6298DF1682BD9100F51DED /* AIAdvancedPreferencePane.m in Sources */ = {isa = PBXBuildFile; fileRef = 5A1E24A815BC746B003A6F9E /* AIAdvancedPreferencePane.m */; };
5A6298E31682BD9D00F51DED /* AIAdvancedPreferencePane.h in Headers */ = {isa = PBXBuildFile; fileRef = 5A1E24A715BC746B003A6F9E /* AIAdvancedPreferencePane.h */; settings = {ATTRIBUTES = (Public, ); }; };
5A799674133C3D6F0005AC6A /* MessageView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5A1FEA601334549300C14951 /* MessageView.xib */; };
- 5A804FEA12BE9E84007CDC1B /* scandate.m in Sources */ = {isa = PBXBuildFile; fileRef = 31DDDA6F12BDD5CE0048F6C0 /* scandate.m */; };
- 5A80508512BE9F00007CDC1B /* scandate.m in Sources */ = {isa = PBXBuildFile; fileRef = 31DDDA6F12BDD5CE0048F6C0 /* scandate.m */; };
5A8F637614DD1B21008412C8 /* Preferences-Privacy.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5A8F637514DD1B21008412C8 /* Preferences-Privacy.xib */; };
+ 5A914166175BD960002139D5 /* ISO8601DateFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = 5A914164175BD960002139D5 /* ISO8601DateFormatter.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
+ 5A914167175BD960002139D5 /* ISO8601DateFormatter.h in Headers */ = {isa = PBXBuildFile; fileRef = 5A914165175BD960002139D5 /* ISO8601DateFormatter.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 5A914168175BD97F002139D5 /* ISO8601DateFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = 5A914164175BD960002139D5 /* ISO8601DateFormatter.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
5A94397B1279ECB800FDD81D /* AIImgurImageUploader.m in Sources */ = {isa = PBXBuildFile; fileRef = 5A94397A1279ECB800FDD81D /* AIImgurImageUploader.m */; };
5A9A9F8911F2951400328DF9 /* AIDoNothingContactAlertPlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = 5A9A9F8811F2951400328DF9 /* AIDoNothingContactAlertPlugin.m */; };
5A9A9F8B11F295EB00328DF9 /* events-do-nothing.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 5A9A9F8A11F295EB00328DF9 /* events-do-nothing.tiff */; };
@@ -1252,10 +1250,6 @@
633400BC0F9C14C2003C77A9 /* AIWindowAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 6334FFF10F9C14C1003C77A9 /* AIWindowAdditions.m */; };
633400BF0F9C14C2003C77A9 /* OWAddressBookAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 6334FFF40F9C14C1003C77A9 /* OWAddressBookAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; };
633400C00F9C14C2003C77A9 /* OWAddressBookAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 6334FFF50F9C14C1003C77A9 /* OWAddressBookAdditions.m */; };
- 633400C10F9C14C2003C77A9 /* NSCalendarDate+ISO8601Parsing.h in Headers */ = {isa = PBXBuildFile; fileRef = 6334FFF60F9C14C1003C77A9 /* NSCalendarDate+ISO8601Parsing.h */; settings = {ATTRIBUTES = (Public, ); }; };
- 633400C20F9C14C2003C77A9 /* NSCalendarDate+ISO8601Parsing.m in Sources */ = {isa = PBXBuildFile; fileRef = 6334FFF70F9C14C1003C77A9 /* NSCalendarDate+ISO8601Parsing.m */; };
- 633400C30F9C14C2003C77A9 /* NSCalendarDate+ISO8601Unparsing.h in Headers */ = {isa = PBXBuildFile; fileRef = 6334FFF80F9C14C1003C77A9 /* NSCalendarDate+ISO8601Unparsing.h */; settings = {ATTRIBUTES = (Public, ); }; };
- 633400C40F9C14C2003C77A9 /* NSCalendarDate+ISO8601Unparsing.m in Sources */ = {isa = PBXBuildFile; fileRef = 6334FFF90F9C14C1003C77A9 /* NSCalendarDate+ISO8601Unparsing.m */; };
633400C50F9C14C2003C77A9 /* AIWindowControllerAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 6334FFFA0F9C14C1003C77A9 /* AIWindowControllerAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; };
633400C60F9C14C2003C77A9 /* AIWindowControllerAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 6334FFFB0F9C14C1003C77A9 /* AIWindowControllerAdditions.m */; };
633400C70F9C14C2003C77A9 /* AIPasteboardAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 6334FFFC0F9C14C1003C77A9 /* AIPasteboardAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -1279,7 +1273,6 @@
633D4FB70F9D30E3004F491E /* GetMetadataForFile.m in Sources */ = {isa = PBXBuildFile; fileRef = 633D4FB10F9D30E3004F491E /* GetMetadataForFile.m */; };
633D4FB80F9D30E3004F491E /* GetMetadataForHTMLLog.m in Sources */ = {isa = PBXBuildFile; fileRef = 633D4FB30F9D30E3004F491E /* GetMetadataForHTMLLog.m */; };
633D4FB90F9D30E3004F491E /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = 633D4FB40F9D30E3004F491E /* main.c */; };
- 633D4FBE0F9D30FA004F491E /* NSCalendarDate+ISO8601Parsing.m in Sources */ = {isa = PBXBuildFile; fileRef = 633D4FBD0F9D30FA004F491E /* NSCalendarDate+ISO8601Parsing.m */; };
633D4FC20F9D3116004F491E /* schema.xml in Resources */ = {isa = PBXBuildFile; fileRef = 633D4FC00F9D3116004F491E /* schema.xml */; };
633D514F0F9D31BE004F491E /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 633D50ED0F9D31BD004F491E /* InfoPlist.strings */; };
633D51500F9D31BE004F491E /* schema.strings in Resources */ = {isa = PBXBuildFile; fileRef = 633D50EF0F9D31BD004F491E /* schema.strings */; };
@@ -2009,10 +2002,6 @@
318EA69B0D7A659900EDB105 /* TestColorAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TestColorAdditions.m; path = UnitTests/TestColorAdditions.m; sourceTree = "<group>"; };
319B29420CE8D28300C65398 /* TestDateAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TestDateAdditions.h; path = UnitTests/TestDateAdditions.h; sourceTree = "<group>"; };
319B297F0CE8EC6E00C65398 /* TestDateAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TestDateAdditions.m; path = UnitTests/TestDateAdditions.m; sourceTree = "<group>"; };
- 31DDDA6E12BDD5CE0048F6C0 /* scandate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = scandate.h; path = Source/scandate.h; sourceTree = "<group>"; };
- 31DDDA6F12BDD5CE0048F6C0 /* scandate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = scandate.m; path = Source/scandate.m; sourceTree = "<group>"; };
- 31DDDA7812BDD6E90048F6C0 /* TestScandate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TestScandate.h; path = UnitTests/TestScandate.h; sourceTree = "<group>"; };
- 31DDDA7912BDD6E90048F6C0 /* TestScandate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TestScandate.m; path = UnitTests/TestScandate.m; sourceTree = "<group>"; };
31DDDAF112BDE54B0048F6C0 /* Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Prefix.pch; path = "Other/Adium Spotlight Importer/Prefix.pch"; sourceTree = "<group>"; };
31E0CD800C5EEF5200271DB1 /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = /System/Library/Frameworks/CoreAudio.framework; sourceTree = "<absolute>"; };
31E84DF10C7F387800674BCA /* AIUnitTestUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AIUnitTestUtilities.h; path = UnitTests/AIUnitTestUtilities.h; sourceTree = "<group>"; };
@@ -2075,8 +2064,6 @@
340D03A80A7D798A0059A3AF /* AIControllerProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AIControllerProtocol.h; path = "Frameworks/Adium Framework/Source/AIControllerProtocol.h"; sourceTree = "<group>"; };
340D081F0A7DBFE40059A3AF /* AIChatControllerProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AIChatControllerProtocol.h; path = "Frameworks/Adium Framework/Source/AIChatControllerProtocol.h"; sourceTree = "<group>"; };
340D083F0A7DC1540059A3AF /* AIContactAlertsControllerProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AIContactAlertsControllerProtocol.h; path = "Frameworks/Adium Framework/Source/AIContactAlertsControllerProtocol.h"; sourceTree = "<group>"; };
- 340D09FF0A7DD1F40059A3AF /* AICalendarDate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AICalendarDate.h; path = Source/AICalendarDate.h; sourceTree = "<group>"; };
- 340D0A000A7DD1F40059A3AF /* AICalendarDate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AICalendarDate.m; path = Source/AICalendarDate.m; sourceTree = "<group>"; };
340D0D5B0A7E72030059A3AF /* AIContactControllerProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AIContactControllerProtocol.h; path = "Frameworks/Adium Framework/Source/AIContactControllerProtocol.h"; sourceTree = "<group>"; };
340D0D630A7E72DA0059A3AF /* AIContentControllerProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AIContentControllerProtocol.h; path = "Frameworks/Adium Framework/Source/AIContentControllerProtocol.h"; sourceTree = "<group>"; };
340D0D720A7E750E0059A3AF /* AIDockControllerProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AIDockControllerProtocol.h; path = "Frameworks/Adium Framework/Source/AIDockControllerProtocol.h"; sourceTree = "<group>"; };
@@ -4002,6 +3989,8 @@
5A80CCAD121F5A7B00D0670A /* uk */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xib; name = uk; path = Resources/uk.lproj/StatusSortConfiguration.xib; sourceTree = "<group>"; };
5A80CCAE121F5A7B00D0670A /* uk */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xib; name = uk; path = "Plugins/WebKit Message View/Resources/uk.lproj/WebKitPreferencesView.xib"; sourceTree = "<group>"; };
5A8F637514DD1B21008412C8 /* Preferences-Privacy.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = "Preferences-Privacy.xib"; path = "Resources/Preferences-Privacy.xib"; sourceTree = "<group>"; };
+ 5A914164175BD960002139D5 /* ISO8601DateFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ISO8601DateFormatter.m; path = "Frameworks/AIUtilities Framework/Source/ISO8601DateFormatter.m"; sourceTree = "<group>"; };
+ 5A914165175BD960002139D5 /* ISO8601DateFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ISO8601DateFormatter.h; path = "Frameworks/AIUtilities Framework/Source/ISO8601DateFormatter.h"; sourceTree = "<group>"; };
5A9439791279ECB800FDD81D /* AIImgurImageUploader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AIImgurImageUploader.h; path = "Plugins/Image Uploading Plugin/AIImgurImageUploader.h"; sourceTree = "<group>"; };
5A94397A1279ECB800FDD81D /* AIImgurImageUploader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AIImgurImageUploader.m; path = "Plugins/Image Uploading Plugin/AIImgurImageUploader.m"; sourceTree = "<group>"; };
5A9A9F8711F2951400328DF9 /* AIDoNothingContactAlertPlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AIDoNothingContactAlertPlugin.h; sourceTree = "<group>"; };
@@ -4207,10 +4196,6 @@
6334FFF30F9C14C1003C77A9 /* AIFontAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AIFontAdditions.h; path = "Frameworks/AIUtilities Framework/Source/AIFontAdditions.h"; sourceTree = "<group>"; };
6334FFF40F9C14C1003C77A9 /* OWAddressBookAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OWAddressBookAdditions.h; path = "Frameworks/AIUtilities Framework/Source/OWAddressBookAdditions.h"; sourceTree = "<group>"; };
6334FFF50F9C14C1003C77A9 /* OWAddressBookAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OWAddressBookAdditions.m; path = "Frameworks/AIUtilities Framework/Source/OWAddressBookAdditions.m"; sourceTree = "<group>"; };
- 6334FFF60F9C14C1003C77A9 /* NSCalendarDate+ISO8601Parsing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSCalendarDate+ISO8601Parsing.h"; path = "Frameworks/AIUtilities Framework/Source/NSCalendarDate+ISO8601Parsing.h"; sourceTree = "<group>"; };
- 6334FFF70F9C14C1003C77A9 /* NSCalendarDate+ISO8601Parsing.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSCalendarDate+ISO8601Parsing.m"; path = "Frameworks/AIUtilities Framework/Source/NSCalendarDate+ISO8601Parsing.m"; sourceTree = "<group>"; };
- 6334FFF80F9C14C1003C77A9 /* NSCalendarDate+ISO8601Unparsing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSCalendarDate+ISO8601Unparsing.h"; path = "Frameworks/AIUtilities Framework/Source/NSCalendarDate+ISO8601Unparsing.h"; sourceTree = "<group>"; };
- 6334FFF90F9C14C1003C77A9 /* NSCalendarDate+ISO8601Unparsing.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSCalendarDate+ISO8601Unparsing.m"; path = "Frameworks/AIUtilities Framework/Source/NSCalendarDate+ISO8601Unparsing.m"; sourceTree = "<group>"; };
6334FFFA0F9C14C1003C77A9 /* AIWindowControllerAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AIWindowControllerAdditions.h; path = "Frameworks/AIUtilities Framework/Source/AIWindowControllerAdditions.h"; sourceTree = "<group>"; };
6334FFFB0F9C14C1003C77A9 /* AIWindowControllerAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AIWindowControllerAdditions.m; path = "Frameworks/AIUtilities Framework/Source/AIWindowControllerAdditions.m"; sourceTree = "<group>"; };
6334FFFC0F9C14C1003C77A9 /* AIPasteboardAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AIPasteboardAdditions.h; path = "Frameworks/AIUtilities Framework/Source/AIPasteboardAdditions.h"; sourceTree = "<group>"; };
@@ -4224,8 +4209,6 @@
633D4FB30F9D30E3004F491E /* GetMetadataForHTMLLog.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = GetMetadataForHTMLLog.m; path = "Other/Adium Spotlight Importer/GetMetadataForHTMLLog.m"; sourceTree = "<group>"; };
633D4FB40F9D30E3004F491E /* main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = main.c; path = "Other/Adium Spotlight Importer/main.c"; sourceTree = "<group>"; };
633D4FB50F9D30E3004F491E /* maintest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = maintest.m; path = "Other/Adium Spotlight Importer/maintest.m"; sourceTree = "<group>"; };
- 633D4FBC0F9D30FA004F491E /* NSCalendarDate+ISO8601Parsing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSCalendarDate+ISO8601Parsing.h"; path = "Frameworks/AIUtilities Framework/Source/NSCalendarDate+ISO8601Parsing.h"; sourceTree = "<group>"; };
- 633D4FBD0F9D30FA004F491E /* NSCalendarDate+ISO8601Parsing.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSCalendarDate+ISO8601Parsing.m"; path = "Frameworks/AIUtilities Framework/Source/NSCalendarDate+ISO8601Parsing.m"; sourceTree = "<group>"; };
633D4FC00F9D3116004F491E /* schema.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; name = schema.xml; path = "Other/Adium Spotlight Importer/schema.xml"; sourceTree = "<group>"; };
633D4FC10F9D3116004F491E /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = "Other/Adium Spotlight Importer/Info.plist"; sourceTree = "<group>"; };
633D50550F9D31B8004F491E /* AdiumSpotlightImporter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AdiumSpotlightImporter.h; path = "Other/Adium Spotlight Importer/AdiumSpotlightImporter.h"; sourceTree = "<group>"; };
@@ -4287,7 +4270,6 @@
638392F609D4D67A0067B9B7 /* Sparkle.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Sparkle.framework; path = Frameworks/Sparkle.framework; sourceTree = "<group>"; };
638BC1FA0FC932E000CE7600 /* AIObjectDebug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AIObjectDebug.h; path = Source/AIObjectDebug.h; sourceTree = "<group>"; };
638BC1FB0FC932E000CE7600 /* AIObjectDebug.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AIObjectDebug.m; path = Source/AIObjectDebug.m; sourceTree = "<group>"; };
- 639DFB440F981C7C003C9A32 /* NSCalendarDate+ISO8601Parsing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSCalendarDate+ISO8601Parsing.h"; path = "Frameworks/AIUtilities Framework/Source/NSCalendarDate+ISO8601Parsing.h"; sourceTree = "<group>"; };
63A3A9670F9C35D3006C9CB0 /* AIUtilities_Framework.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = AIUtilities_Framework.plist; sourceTree = "<group>"; };
63A3A9690F9C35D3006C9CB0 /* ca */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = ca; path = ca.lproj/Localizable.strings; sourceTree = "<group>"; };
63A3A96A0F9C35D3006C9CB0 /* cs */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = cs; path = cs.lproj/Localizable.strings; sourceTree = "<group>"; };
@@ -5167,8 +5149,6 @@
31FA7F100D4A75D000ABE634 /* TestRichTextCoercion.m */,
634BCD1D0DDC1542005AF1C2 /* TestMutableStringAdditions.h */,
634BCD1E0DDC1542005AF1C2 /* TestMutableStringAdditions.m */,
- 31DDDA7812BDD6E90048F6C0 /* TestScandate.h */,
- 31DDDA7912BDD6E90048F6C0 /* TestScandate.m */,
31034EFD0C8142680003F5AA /* TestStringAdditions.h */,
31034EFE0C8142680003F5AA /* TestStringAdditions.m */,
31034F0B0C8142720003F5AA /* UTF8Snowman.txt */,
@@ -5595,7 +5575,6 @@
3459CBE00A25FFA100ECC256 /* Log Indexing */ = {
isa = PBXGroup;
children = (
- 639DFB440F981C7C003C9A32 /* NSCalendarDate+ISO8601Parsing.h */,
3459CBEA0A25FFBE00ECC256 /* GetMetadataForHTMLLog.h */,
3459CBE90A25FFBE00ECC256 /* GetMetadataForHTMLLog.m */,
3459CBEC0A25FFBF00ECC256 /* AdiumSpotlightImporter.h */,
@@ -7202,8 +7181,6 @@
349B359E0A5F2231008BE092 /* Views and Cells */,
3456231F0A3771E100E7FC97 /* AIChatLog.h */,
3456231E0A3771E100E7FC97 /* AIChatLog.m */,
- 31DDDA6E12BDD5CE0048F6C0 /* scandate.h */,
- 31DDDA6F12BDD5CE0048F6C0 /* scandate.m */,
345623250A3771F400E7FC97 /* AILogToGroup.h */,
345623240A3771F300E7FC97 /* AILogToGroup.m */,
345623270A3771F400E7FC97 /* AILogFromGroup.h */,
@@ -7216,8 +7193,6 @@
34F849570A4AF04D0002A017 /* AILogFileUpgradeWindowController.m */,
34B5E25D0A7C94D3005186E6 /* AILogDateFormatter.h */,
34B5E25E0A7C94D3005186E6 /* AILogDateFormatter.m */,
- 340D09FF0A7DD1F40059A3AF /* AICalendarDate.h */,
- 340D0A000A7DD1F40059A3AF /* AICalendarDate.m */,
);
name = "Log Viewer";
sourceTree = "<group>";
@@ -7901,6 +7876,8 @@
6334FFA90F9C14C1003C77A9 /* Additions */ = {
isa = PBXGroup;
children = (
+ 5A914165175BD960002139D5 /* ISO8601DateFormatter.h */,
+ 5A914164175BD960002139D5 /* ISO8601DateFormatter.m */,
6334FFAC0F9C14C1003C77A9 /* AIApplicationAdditions.h */,
6334FFAD0F9C14C1003C77A9 /* AIApplicationAdditions.m */,
6334FFAE0F9C14C1003C77A9 /* AIArrayAdditions.h */,
@@ -7973,10 +7950,6 @@
6334FFF30F9C14C1003C77A9 /* AIFontAdditions.h */,
6334FFF40F9C14C1003C77A9 /* OWAddressBookAdditions.h */,
6334FFF50F9C14C1003C77A9 /* OWAddressBookAdditions.m */,
- 6334FFF60F9C14C1003C77A9 /* NSCalendarDate+ISO8601Parsing.h */,
- 6334FFF70F9C14C1003C77A9 /* NSCalendarDate+ISO8601Parsing.m */,
- 6334FFF80F9C14C1003C77A9 /* NSCalendarDate+ISO8601Unparsing.h */,
- 6334FFF90F9C14C1003C77A9 /* NSCalendarDate+ISO8601Unparsing.m */,
6334FFFA0F9C14C1003C77A9 /* AIWindowControllerAdditions.h */,
6334FFFB0F9C14C1003C77A9 /* AIWindowControllerAdditions.m */,
6334FFFC0F9C14C1003C77A9 /* AIPasteboardAdditions.h */,
@@ -8035,8 +8008,6 @@
633D4FBB0F9D30FA004F491E /* External Sources */ = {
isa = PBXGroup;
children = (
- 633D4FBC0F9D30FA004F491E /* NSCalendarDate+ISO8601Parsing.h */,
- 633D4FBD0F9D30FA004F491E /* NSCalendarDate+ISO8601Parsing.m */,
);
name = "External Sources";
sourceTree = "<group>";
@@ -9284,8 +9255,6 @@
633400B90F9C14C2003C77A9 /* AIViewAdditions.h in Headers */,
633400BB0F9C14C2003C77A9 /* AIWindowAdditions.h in Headers */,
633400BF0F9C14C2003C77A9 /* OWAddressBookAdditions.h in Headers */,
- 633400C10F9C14C2003C77A9 /* NSCalendarDate+ISO8601Parsing.h in Headers */,
- 633400C30F9C14C2003C77A9 /* NSCalendarDate+ISO8601Unparsing.h in Headers */,
633400C50F9C14C2003C77A9 /* AIWindowControllerAdditions.h in Headers */,
633400C70F9C14C2003C77A9 /* AIPasteboardAdditions.h in Headers */,
633400D00F9C14E0003C77A9 /* AIUtilities.framework_Prefix.pch in Headers */,
@@ -9298,6 +9267,7 @@
5ACF27391392C74A004B6AEF /* AIHighlightingTextField.h in Headers */,
5ACF273B1392C74A004B6AEF /* AIPreferenceCollectionView.h in Headers */,
5AA2A0EE14B3EFF500B4DB65 /* AIOSCompatibility.h in Headers */,
+ 5A914167175BD960002139D5 /* ISO8601DateFormatter.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -10139,8 +10109,6 @@
318EA69C0D7A659900EDB105 /* TestColorAdditions.m in Sources */,
634BCD1F0DDC1542005AF1C2 /* TestMutableStringAdditions.m in Sources */,
3107D5250F63134F0051DDD5 /* TestAttributedStringAdditions.m in Sources */,
- 31DDDA7112BDD5CE0048F6C0 /* scandate.m in Sources */,
- 31DDDA7A12BDD6E90048F6C0 /* TestScandate.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -10508,7 +10476,6 @@
34DC88810A7EEE2F003E1636 /* AdiumSpeech.m in Sources */,
34DC88840A7EEE2F003E1636 /* AdiumIdleManager.m in Sources */,
34DC88880A7EEE2F003E1636 /* XtrasInstaller.m in Sources */,
- 3419DF3B0A8119BF00C3FC68 /* AICalendarDate.m in Sources */,
34DC12FC0A81415D00D710F3 /* ESApplescriptabilityController.m in Sources */,
34DC13040A81417600D710F3 /* AILoginWindowController.m in Sources */,
C44BA7830AAB696400C7504F /* SetupAssistantBoxBackgroundView.m in Sources */,
@@ -10580,7 +10547,6 @@
76C1AF9C125A906A00D269A9 /* AIAdiumURLProtocol.m in Sources */,
5A94397B1279ECB800FDD81D /* AIImgurImageUploader.m in Sources */,
349062A2127F7E6900FC313F /* AITemporaryIRCAccountWindowController.m in Sources */,
- 5A80508512BE9F00007CDC1B /* scandate.m in Sources */,
1154F50B12E1476900B8CA27 /* AILogByAccountWindowController.m in Sources */,
766ABAB61306D1020049FFB7 /* AIUnreadMessagesTooltip.m in Sources */,
5A5F8BBD12D560E400019727 /* AIDockNameOverlay.m in Sources */,
@@ -10800,8 +10766,6 @@
633400BA0F9C14C2003C77A9 /* AIViewAdditions.m in Sources */,
633400BC0F9C14C2003C77A9 /* AIWindowAdditions.m in Sources */,
633400C00F9C14C2003C77A9 /* OWAddressBookAdditions.m in Sources */,
- 633400C20F9C14C2003C77A9 /* NSCalendarDate+ISO8601Parsing.m in Sources */,
- 633400C40F9C14C2003C77A9 /* NSCalendarDate+ISO8601Unparsing.m in Sources */,
633400C60F9C14C2003C77A9 /* AIWindowControllerAdditions.m in Sources */,
633400C80F9C14C2003C77A9 /* AIPasteboardAdditions.m in Sources */,
63BB1CC90F9EDDB600424B80 /* AISharedWriterQueue.m in Sources */,
@@ -10810,6 +10774,7 @@
9718DF46136A2C5200013760 /* AIImageCollectionView.m in Sources */,
5ACF273A1392C74A004B6AEF /* AIHighlightingTextField.m in Sources */,
5ACF273C1392C74A004B6AEF /* AIPreferenceCollectionView.m in Sources */,
+ 5A914166175BD960002139D5 /* ISO8601DateFormatter.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -10821,8 +10786,7 @@
633D4FB70F9D30E3004F491E /* GetMetadataForFile.m in Sources */,
633D4FB80F9D30E3004F491E /* GetMetadataForHTMLLog.m in Sources */,
633D4FB90F9D30E3004F491E /* main.c in Sources */,
- 633D4FBE0F9D30FA004F491E /* NSCalendarDate+ISO8601Parsing.m in Sources */,
- 5A804FEA12BE9E84007CDC1B /* scandate.m in Sources */,
+ 5A914168175BD97F002139D5 /* ISO8601DateFormatter.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff -r f180ef3eb520 -r a7ca86f2f35c Frameworks/AIUtilities Framework/Source/AIDateAdditions.h
--- a/Frameworks/AIUtilities Framework/Source/AIDateAdditions.h Fri May 24 00:13:49 2013 +0200
+++ b/Frameworks/AIUtilities Framework/Source/AIDateAdditions.h Mon Jun 03 17:17:12 2013 -0400
@@ -35,5 +35,6 @@
hours:(out NSInteger *)outHours
minutes:(out NSInteger *)outMinutes
seconds:(out NSTimeInterval *)outSeconds;
++ (BOOL)isDate:(NSDate *)date1 sameDayAsDate:(NSDate *)date2;
@end
diff -r f180ef3eb520 -r a7ca86f2f35c Frameworks/AIUtilities Framework/Source/AIDateAdditions.m
--- a/Frameworks/AIUtilities Framework/Source/AIDateAdditions.m Fri May 24 00:13:49 2013 +0200
+++ b/Frameworks/AIUtilities Framework/Source/AIDateAdditions.m Mon Jun 03 17:17:12 2013 -0400
@@ -42,4 +42,15 @@
if (outWeeks) *outWeeks = workInterval;
}
++ (BOOL)isDate:(NSDate *)date1 sameDayAsDate:(NSDate *)date2
+{
+ NSCalendar *calendar = [NSCalendar currentCalendar];
+
+ unsigned unitFlags = NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit;
+ NSDateComponents *comp1 = [calendar components:unitFlags fromDate:date1];
+ NSDateComponents *comp2 = [calendar components:unitFlags fromDate:date2];
+
+ return (comp1.day == comp2.day && comp1.month == comp2.month && comp1.year == comp2.year);
+}
+
@end
diff -r f180ef3eb520 -r a7ca86f2f35c Frameworks/AIUtilities Framework/Source/AIStringAdditions.m
--- a/Frameworks/AIUtilities Framework/Source/AIStringAdditions.m Fri May 24 00:13:49 2013 +0200
+++ b/Frameworks/AIUtilities Framework/Source/AIStringAdditions.m Mon Jun 03 17:17:12 2013 -0400
@@ -500,7 +500,7 @@
#define SBEFS_BOUNDARY_GUARD \
do { \
if (i == buflen) { \
- buf = realloc(buf, sizeof(unichar) * (buflen += buflenIncrement)); \
+ buf = reallocf(buf, sizeof(unichar) * (buflen += buflenIncrement)); \
if (buf == NULL) { \
NSLog(@"in stringByEscapingForShell: could not allocate %lu bytes", (unsigned long)(sizeof(unichar) * buflen)); \
free(myBuf); \
@@ -583,7 +583,7 @@
#define SBEFR_BOUNDARY_GUARD \
do { \
if (i == buflen) { \
-buf = realloc(buf, sizeof(unichar) * (buflen += buflenIncrement)); \
+buf = reallocf(buf, sizeof(unichar) * (buflen += buflenIncrement)); \
if (!buf) { \
NSLog(@"in stringByEscapingForRegexp: could not allocate %lu bytes", (unsigned long)(sizeof(unichar) * buflen)); \
free(myBuf); \
diff -r f180ef3eb520 -r a7ca86f2f35c Frameworks/AIUtilities Framework/Source/AISystemNetworkDefaults.m
--- a/Frameworks/AIUtilities Framework/Source/AISystemNetworkDefaults.m Fri May 24 00:13:49 2013 +0200
+++ b/Frameworks/AIUtilities Framework/Source/AISystemNetworkDefaults.m Mon Jun 03 17:17:12 2013 -0400
@@ -76,7 +76,6 @@
}
default: {
return nil;
- break;
}
}
@@ -121,9 +120,9 @@
} else {
//Check for a PAC configuration
- enable = [[proxyDict objectForKey:(NSString *)kSCPropNetProxiesProxyAutoConfigEnable] boolValue];
+ enable = [[proxyDict objectForKey:kSCPropNetProxiesProxyAutoConfigEnable] boolValue];
if (enable) {
- NSString *pacFile = [proxyDict objectForKey:(NSString *)kSCPropNetProxiesProxyAutoConfigURLString];
+ NSString *pacFile = [proxyDict objectForKey:kSCPropNetProxiesProxyAutoConfigURLString];
if (pacFile) {
CFURLRef url = (__bridge CFURLRef)[NSURL URLWithString:[NSString stringWithFormat:@"http://%@", hostName ?: @"google.com"]];
diff -r f180ef3eb520 -r a7ca86f2f35c Frameworks/AIUtilities Framework/Source/ISO8601DateFormatter.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Frameworks/AIUtilities Framework/Source/ISO8601DateFormatter.h Mon Jun 03 17:17:12 2013 -0400
@@ -0,0 +1,79 @@
+/*ISO8601DateFormatter.h
+ *
+ *Created by Peter Hosey on 2009-04-11.
+ *Copyright 2009 Peter Hosey. All rights reserved.
+ */
+
+#import <Foundation/Foundation.h>
+
+/*This class converts dates to and from ISO 8601 strings. A good introduction to ISO 8601: <http://www.cl.cam.ac.uk/~mgk25/iso-time.html>
+ *
+ *Parsing can be done strictly, or not. When you parse loosely, leading whitespace is ignored, as is anything after the date.
+ *The loose parser will return an NSDate for this string: @" \t\r\n\f\t 2006-03-02!!!"
+ *Leading non-whitespace will not be ignored; the string will be rejected, and nil returned. See the README that came with this addition.
+ *
+ *The strict parser will only accept a string if the date is the entire string. The above string would be rejected immediately, solely on these grounds.
+ *Also, the loose parser provides some extensions that the strict parser doesn't.
+ *For example, the standard says for "-DDD" (an ordinal date in the implied year) that the logical representation (meaning, hierarchically) would be "--DDD", but because that extra hyphen is "superfluous", it was omitted.
+ *The loose parser will accept the extra hyphen; the strict parser will not.
+ *A full list of these extensions is in the README file.
+ */
+
+/*The format to either expect or produce.
+ *Calendar format is YYYY-MM-DD.
+ *Ordinal format is YYYY-DDD, where DDD ranges from 1 to 366; for example, 2009-32 is 2009-02-01.
+ *Week format is YYYY-Www-D, where ww ranges from 1 to 53 (the 'W' is literal) and D ranges from 1 to 7; for example, 2009-W05-07.
+ */
+enum {
+ ISO8601DateFormatCalendar,
+ ISO8601DateFormatOrdinal,
+ ISO8601DateFormatWeek,
+};
+typedef NSUInteger ISO8601DateFormat;
+
+//The default separator for time values. Currently, this is ':'.
+extern unichar ISO8601DefaultTimeSeparatorCharacter;
+
+ at interface ISO8601DateFormatter: NSFormatter
+{
+ NSString *lastUsedFormatString;
+ NSDateFormatter *unparsingFormatter;
+
+ NSCalendar *parsingCalendar, *unparsingCalendar;
+
+ NSTimeZone *defaultTimeZone;
+ ISO8601DateFormat format;
+ unichar timeSeparator;
+ BOOL includeTime;
+ BOOL parsesStrictly;
+}
+
+//Call this if you get a memory warning.
++ (void) purgeGlobalCaches;
+
+ at property(nonatomic, retain) NSTimeZone *defaultTimeZone;
+
+#pragma mark Parsing
+
+//As a formatter, this object converts strings to dates.
+
+ at property BOOL parsesStrictly;
+
+- (NSDateComponents *) dateComponentsFromString:(NSString *)string;
+- (NSDateComponents *) dateComponentsFromString:(NSString *)string timeZone:(out NSTimeZone **)outTimeZone;
+- (NSDateComponents *) dateComponentsFromString:(NSString *)string timeZone:(out NSTimeZone **)outTimeZone range:(out NSRange *)outRange;
+
+- (NSDate *) dateFromString:(NSString *)string;
+- (NSDate *) dateFromString:(NSString *)string timeZone:(out NSTimeZone **)outTimeZone;
+- (NSDate *) dateFromString:(NSString *)string timeZone:(out NSTimeZone **)outTimeZone range:(out NSRange *)outRange;
+
+#pragma mark Unparsing
+
+ at property ISO8601DateFormat format;
+ at property BOOL includeTime;
+ at property unichar timeSeparator;
+
+- (NSString *) stringFromDate:(NSDate *)date;
+- (NSString *) stringFromDate:(NSDate *)date timeZone:(NSTimeZone *)timeZone;
+
+ at end
diff -r f180ef3eb520 -r a7ca86f2f35c Frameworks/AIUtilities Framework/Source/ISO8601DateFormatter.m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Frameworks/AIUtilities Framework/Source/ISO8601DateFormatter.m Mon Jun 03 17:17:12 2013 -0400
@@ -0,0 +1,895 @@
+/*ISO8601DateFormatter.m
+ *
+ *Created by Peter Hosey on 2009-04-11.
+ *Copyright 2009 Peter Hosey. All rights reserved.
+ */
+
+#import <Foundation/Foundation.h>
+#import "ISO8601DateFormatter.h"
+
+#ifndef DEFAULT_TIME_SEPARATOR
+# define DEFAULT_TIME_SEPARATOR ':'
+#endif
+unichar ISO8601DefaultTimeSeparatorCharacter = DEFAULT_TIME_SEPARATOR;
+
+//Unicode date formats.
+#define ISO_CALENDAR_DATE_FORMAT @"yyyy-MM-dd"
+//#define ISO_WEEK_DATE_FORMAT @"YYYY-'W'ww-ee" //Doesn't actually work because NSDateComponents counts the weekday starting at 1.
+#define ISO_ORDINAL_DATE_FORMAT @"yyyy-DDD"
+#define ISO_TIME_FORMAT @"HH:mm:ss"
+#define ISO_TIME_WITH_TIMEZONE_FORMAT ISO_TIME_FORMAT @"Z"
+//printf formats.
+#define ISO_TIMEZONE_UTC_FORMAT @"Z"
+#define ISO_TIMEZONE_OFFSET_FORMAT @"%+.2d%.2d"
+
+ at interface ISO8601DateFormatter(UnparsingPrivate)
+
+- (NSString *) replaceColonsInString:(NSString *)timeFormat withTimeSeparator:(unichar)timeSep;
+
+- (NSString *) stringFromDate:(NSDate *)date formatString:(NSString *)dateFormat timeZone:(NSTimeZone *)timeZone;
+- (NSString *) weekDateStringForDate:(NSDate *)date timeZone:(NSTimeZone *)timeZone;
+
+ at end
+
+static NSMutableDictionary *timeZonesByOffset;
+
+ at implementation ISO8601DateFormatter
+
++ (void) initialize {
+ if (!timeZonesByOffset) {
+ timeZonesByOffset = [[NSMutableDictionary alloc] init];
+ }
+}
+
++ (void) purgeGlobalCaches {
+ NSMutableDictionary *oldCache = timeZonesByOffset;
+ timeZonesByOffset = nil;
+ [oldCache release];
+}
+
+- (NSCalendar *) makeCalendarWithDesiredConfiguration {
+ NSCalendar *calendar = [[[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar] autorelease];
+ calendar.firstWeekday = 2; //Monday
+ calendar.timeZone = [NSTimeZone defaultTimeZone];
+ return calendar;
+}
+
+- (id) init {
+ if ((self = [super init])) {
+ parsingCalendar = [[self makeCalendarWithDesiredConfiguration] retain];
+ unparsingCalendar = [[self makeCalendarWithDesiredConfiguration] retain];
+
+ format = ISO8601DateFormatCalendar;
+ timeSeparator = ISO8601DefaultTimeSeparatorCharacter;
+ includeTime = NO;
+ parsesStrictly = NO;
+ }
+ return self;
+}
+- (void) dealloc {
+ [defaultTimeZone release];
+
+ [unparsingFormatter release];
+ [lastUsedFormatString release];
+ [parsingCalendar release];
+ [unparsingCalendar release];
+
+ [super dealloc];
+}
+
+ at synthesize defaultTimeZone;
+- (void) setDefaultTimeZone:(NSTimeZone *)tz {
+ if (defaultTimeZone != tz) {
+ [defaultTimeZone release];
+ defaultTimeZone = [tz retain];
+
+ unparsingCalendar.timeZone = defaultTimeZone;
+ }
+}
+
+//The following properties are only here because GCC doesn't like @synthesize in category implementations.
+
+#pragma mark Parsing
+
+ at synthesize parsesStrictly;
+
+static NSUInteger read_segment(const unsigned char *str, const unsigned char **next, NSUInteger *out_num_digits);
+static NSUInteger read_segment_4digits(const unsigned char *str, const unsigned char **next, NSUInteger *out_num_digits);
+static NSUInteger read_segment_2digits(const unsigned char *str, const unsigned char **next);
+static double read_double(const unsigned char *str, const unsigned char **next);
+static BOOL is_leap_year(NSUInteger year);
+
+/*Valid ISO 8601 date formats:
+ *
+ *YYYYMMDD
+ *YYYY-MM-DD
+ *YYYY-MM
+ *YYYY
+ *YY //century
+ * //Implied century: YY is 00-99
+ * YYMMDD
+ * YY-MM-DD
+ * -YYMM
+ * -YY-MM
+ * -YY
+ * //Implied year
+ * --MMDD
+ * --MM-DD
+ * --MM
+ * //Implied year and month
+ * ---DD
+ * //Ordinal dates: DDD is the number of the day in the year (1-366)
+ *YYYYDDD
+ *YYYY-DDD
+ * YYDDD
+ * YY-DDD
+ * -DDD
+ * //Week-based dates: ww is the number of the week, and d is the number (1-7) of the day in the week
+ *yyyyWwwd
+ *yyyy-Www-d
+ *yyyyWww
+ *yyyy-Www
+ *yyWwwd
+ *yy-Www-d
+ *yyWww
+ *yy-Www
+ * //Year of the implied decade
+ *-yWwwd
+ *-y-Www-d
+ *-yWww
+ *-y-Www
+ * //Week and day of implied year
+ * -Wwwd
+ * -Www-d
+ * //Week only of implied year
+ * -Www
+ * //Day only of implied week
+ * -W-d
+ */
+
+- (NSDateComponents *) dateComponentsFromString:(NSString *)string {
+ return [self dateComponentsFromString:string timeZone:NULL];
+}
+- (NSDateComponents *) dateComponentsFromString:(NSString *)string timeZone:(out NSTimeZone **)outTimeZone {
+ return [self dateComponentsFromString:string timeZone:outTimeZone range:NULL];
+}
+- (NSDateComponents *) dateComponentsFromString:(NSString *)string timeZone:(out NSTimeZone **)outTimeZone range:(out NSRange *)outRange {
+ NSDate *now = [NSDate date];
+
+ NSDateComponents *components = [[[NSDateComponents alloc] init] autorelease];
+ NSDateComponents *nowComponents = [parsingCalendar components:(NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit) fromDate:now];
+
+ NSUInteger
+ //Date
+ year,
+ month_or_week = 0U,
+ day = 0U,
+ //Time
+ hour = 0U;
+ NSTimeInterval
+ minute = 0.0,
+ second = 0.0;
+ //Time zone
+ NSInteger tz_hour = 0;
+ NSInteger tz_minute = 0;
+
+ enum {
+ monthAndDate,
+ week,
+ dateOnly
+ } dateSpecification = monthAndDate;
+
+ BOOL strict = self.parsesStrictly;
+ unichar timeSep = self.timeSeparator;
+
+ if (strict) timeSep = ISO8601DefaultTimeSeparatorCharacter;
+ NSAssert(timeSep != '\0', @"Time separator must not be NUL.");
+
+ BOOL isValidDate = ([string length] > 0U);
+ NSTimeZone *timeZone = nil;
+
+ const unsigned char *ch = (const unsigned char *)[string UTF8String];
+
+ NSRange range = { 0U, 0U };
+ const unsigned char *start_of_date = NULL;
+ if (strict && isspace(*ch)) {
+ range.location = NSNotFound;
+ isValidDate = NO;
+ } else {
+ //Skip leading whitespace.
+ NSUInteger i = 0U;
+ for(NSUInteger len = strlen((const char *)ch); i < len; ++i) {
+ if (!isspace(ch[i]))
+ break;
+ }
+
+ range.location = i;
+ ch += i;
+ start_of_date = ch;
+
+ NSUInteger segment;
+ NSUInteger num_leading_hyphens = 0U, num_digits = 0U;
+
+ if (*ch == 'T') {
+ //There is no date here, only a time. Set the date to now; then we'll parse the time.
+ isValidDate = isdigit(*++ch);
+
+ year = nowComponents.year;
+ month_or_week = nowComponents.month;
+ day = nowComponents.day;
+ } else {
+ while(*ch == '-') {
+ ++num_leading_hyphens;
+ ++ch;
+ }
+
+ segment = read_segment(ch, &ch, &num_digits);
+ switch(num_digits) {
+ case 0:
+ if (*ch == 'W') {
+ if ((ch[1] == '-') && isdigit(ch[2]) && ((num_leading_hyphens == 1U) || ((num_leading_hyphens == 2U) && !strict))) {
+ year = nowComponents.year;
+ month_or_week = 1U;
+ ch += 2;
+ goto parseDayAfterWeek;
+ } else if (num_leading_hyphens == 1U) {
+ year = nowComponents.year;
+ goto parseWeekAndDay;
+ } else
+ isValidDate = NO;
+ } else
+ isValidDate = NO;
+ break;
+
+ case 8: //YYYY MM DD
+ if (num_leading_hyphens > 0U)
+ isValidDate = NO;
+ else {
+ day = segment % 100U;
+ segment /= 100U;
+ month_or_week = segment % 100U;
+ year = segment / 100U;
+ }
+ break;
+
+ case 6: //YYMMDD (implicit century)
+ if (num_leading_hyphens > 0U)
+ isValidDate = NO;
+ else {
+ day = segment % 100U;
+ segment /= 100U;
+ month_or_week = segment % 100U;
+ year = nowComponents.year;
+ year -= (year % 100U);
+ year += segment / 100U;
+ }
+ break;
+
+ case 4:
+ switch(num_leading_hyphens) {
+ case 0: //YYYY
+ year = segment;
+
+ if (*ch == '-') ++ch;
+
+ if (!isdigit(*ch)) {
+ if (*ch == 'W')
+ goto parseWeekAndDay;
+ else
+ month_or_week = day = 1U;
+ } else {
+ segment = read_segment(ch, &ch, &num_digits);
+ switch(num_digits) {
+ case 4: //MMDD
+ day = segment % 100U;
+ month_or_week = segment / 100U;
+ break;
+
+ case 2: //MM
+ month_or_week = segment;
+
+ if (*ch == '-') ++ch;
+ if (!isdigit(*ch))
+ day = 1U;
+ else
+ day = read_segment(ch, &ch, NULL);
+ break;
+
+ case 3: //DDD
+ day = segment % 1000U;
+ dateSpecification = dateOnly;
+ if (strict && (day > (365U + is_leap_year(year))))
+ isValidDate = NO;
+ break;
+
+ default:
+ isValidDate = NO;
+ }
+ }
+ break;
+
+ case 1: //YYMM
+ month_or_week = segment % 100U;
+ year = segment / 100U;
+
+ if (*ch == '-') ++ch;
+ if (!isdigit(*ch))
+ day = 1U;
+ else
+ day = read_segment(ch, &ch, NULL);
+
+ break;
+
+ case 2: //MMDD
+ day = segment % 100U;
+ month_or_week = segment / 100U;
+ year = nowComponents.year;
+
+ break;
+
+ default:
+ isValidDate = NO;
+ } //switch(num_leading_hyphens) (4 digits)
+ break;
+
+ case 1:
+ if (strict) {
+ //Two digits only - never just one.
+ if (num_leading_hyphens == 1U) {
+ if (*ch == '-') ++ch;
+ if (*++ch == 'W') {
+ year = nowComponents.year;
+ year -= (year % 10U);
+ year += segment;
+ goto parseWeekAndDay;
+ } else
+ isValidDate = NO;
+ } else
+ isValidDate = NO;
+ break;
+ }
+ case 2:
+ switch(num_leading_hyphens) {
+ case 0:
+ if (*ch == '-') {
+ //Implicit century
+ year = nowComponents.year;
+ year -= (year % 100U);
+ year += segment;
+
+ if (*++ch == 'W')
+ goto parseWeekAndDay;
+ else if (!isdigit(*ch)) {
+ goto centuryOnly;
+ } else {
+ //Get month and/or date.
+ segment = read_segment_4digits(ch, &ch, &num_digits);
+ NSLog(@"(%@) parsing month; segment is %lu and ch is %s", string, (unsigned long)segment, ch);
+ switch(num_digits) {
+ case 4: //YY-MMDD
+ day = segment % 100U;
+ month_or_week = segment / 100U;
+ break;
+
+ case 1: //YY-M; YY-M-DD (extension)
+ if (strict) {
+ isValidDate = NO;
+ break;
+ }
+ case 2: //YY-MM; YY-MM-DD
+ month_or_week = segment;
+ if (*ch == '-') {
+ if (isdigit(*++ch))
+ day = read_segment_2digits(ch, &ch);
+ else
+ day = 1U;
+ } else
+ day = 1U;
+ break;
+
+ case 3: //Ordinal date.
+ day = segment;
+ dateSpecification = dateOnly;
+ break;
+ }
+ }
+ } else if (*ch == 'W') {
+ year = nowComponents.year;
+ year -= (year % 100U);
+ year += segment;
+
+ parseWeekAndDay: //*ch should be 'W' here.
+ if (!isdigit(*++ch)) {
+ //Not really a week-based date; just a year followed by '-W'.
+ if (strict)
+ isValidDate = NO;
+ else
+ month_or_week = day = 1U;
+ } else {
+ month_or_week = read_segment_2digits(ch, &ch);
+ if (*ch == '-') ++ch;
+ parseDayAfterWeek:
+ day = isdigit(*ch) ? read_segment_2digits(ch, &ch) : 1U;
+ dateSpecification = week;
+ }
+ } else {
+ //Century only. Assume current year.
+ centuryOnly:
+ year = segment * 100U + nowComponents.year % 100U;
+ month_or_week = day = 1U;
+ }
+ break;
+
+ case 1:; //-YY; -YY-MM (implicit century)
+ NSLog(@"(%@) found %lu digits and one hyphen, so this is either -YY or -YY-MM; segment (year) is %lu", string, (unsigned long)num_digits, (unsigned long)segment);
+ NSUInteger current_year = nowComponents.year;
+ NSUInteger current_century = (current_year % 100U);
+ year = segment + (current_year - current_century);
+ if (num_digits == 1U) //implied decade
+ year += current_century - (current_year % 10U);
+
+ if (*ch == '-') {
+ ++ch;
+ month_or_week = read_segment_2digits(ch, &ch);
+ NSLog(@"(%@) month is %lu", string, (unsigned long)month_or_week);
+ }
+
+ day = 1U;
+ break;
+
+ case 2: //--MM; --MM-DD
+ year = nowComponents.year;
+ month_or_week = segment;
+ if (*ch == '-') {
+ ++ch;
+ day = read_segment_2digits(ch, &ch);
+ }
+ break;
+
+ case 3: //---DD
+ year = nowComponents.year;
+ month_or_week = nowComponents.month;
+ day = segment;
+ break;
+
+ default:
+ isValidDate = NO;
+ } //switch(num_leading_hyphens) (2 digits)
+ break;
+
+ case 7: //YYYY DDD (ordinal date)
+ if (num_leading_hyphens > 0U)
+ isValidDate = NO;
+ else {
+ day = segment % 1000U;
+ year = segment / 1000U;
+ dateSpecification = dateOnly;
+ if (strict && (day > (365U + is_leap_year(year))))
+ isValidDate = NO;
+ }
+ break;
+
+ case 3: //--DDD (ordinal date, implicit year)
+ //Technically, the standard only allows one hyphen. But it says that two hyphens is the logical implementation, and one was dropped for brevity. So I have chosen to allow the missing hyphen.
+ if ((num_leading_hyphens < 1U) || ((num_leading_hyphens > 2U) && !strict))
+ isValidDate = NO;
+ else {
+ day = segment;
+ year = nowComponents.year;
+ dateSpecification = dateOnly;
+ if (strict && (day > (365U + is_leap_year(year))))
+ isValidDate = NO;
+ }
+ break;
+
+ default:
+ isValidDate = NO;
+ }
+ }
+
+ if (isValidDate) {
+ if (isspace(*ch) || (*ch == 'T')) ++ch;
+
+ if (isdigit(*ch)) {
+ hour = read_segment_2digits(ch, &ch);
+ if (*ch == timeSep) {
+ ++ch;
+ if ((timeSep == ',') || (timeSep == '.')) {
+ //We can't do fractional minutes when '.' is the segment separator.
+ //Only allow whole minutes and whole seconds.
+ minute = read_segment_2digits(ch, &ch);
+ if (*ch == timeSep) {
+ ++ch;
+ second = read_segment_2digits(ch, &ch);
+ }
+ } else {
+ //Allow a fractional minute.
+ //If we don't get a fraction, look for a seconds segment.
+ //Otherwise, the fraction of a minute is the seconds.
+ minute = read_double(ch, &ch);
+ second = modf(minute, &minute);
+ if (second > DBL_EPSILON)
+ second *= 60.0; //Convert fraction (e.g. .5) into seconds (e.g. 30).
+ else if (*ch == timeSep) {
+ ++ch;
+ second = read_double(ch, &ch);
+ }
+ }
+ }
+
+ if (!strict) {
+ if (isspace(*ch)) ++ch;
+ }
+
+ switch(*ch) {
+ case 'Z':
+ timeZone = [NSTimeZone timeZoneWithAbbreviation:@"UTC"];
+ break;
+
+ case '+':
+ case '-':;
+ BOOL negative = (*ch == '-');
+ if (isdigit(*++ch)) {
+ //Read hour offset.
+ segment = *ch - '0';
+ if (isdigit(*++ch)) {
+ segment *= 10U;
+ segment += *(ch++) - '0';
+ }
+ tz_hour = (NSInteger)segment;
+ if (negative) tz_hour = -tz_hour;
+
+ //Optional separator.
+ if (*ch == timeSep) ++ch;
+
+ if (isdigit(*ch)) {
+ //Read minute offset.
+ segment = *ch - '0';
+ if (isdigit(*++ch)) {
+ segment *= 10U;
+ segment += *ch - '0';
+ }
+ tz_minute = segment;
+ if (negative) tz_minute = -tz_minute;
+ }
+
+ NSInteger timeZoneOffset = (tz_hour * 3600) + (tz_minute * 60);
+ NSNumber *offsetNum = [NSNumber numberWithInteger:timeZoneOffset];
+ timeZone = [timeZonesByOffset objectForKey:offsetNum];
+ if (!timeZone) {
+ timeZone = [NSTimeZone timeZoneForSecondsFromGMT:timeZoneOffset];
+ if (timeZone)
+ [timeZonesByOffset setObject:timeZone forKey:offsetNum];
+ }
+ }
+ }
+ }
+ }
+
+ if (isValidDate) {
+ components.year = year;
+ components.day = day;
+ components.hour = hour;
+ components.minute = (NSInteger)minute;
+ components.second = (NSInteger)second;
+
+ switch(dateSpecification) {
+ case monthAndDate:
+ components.month = month_or_week;
+ break;
+
+ case week:;
+ //Adapted from <http://personal.ecu.edu/mccartyr/ISOwdALG.txt>.
+ //This works by converting the week date into an ordinal date, then letting the next case handle it.
+ NSUInteger prevYear = year - 1U;
+ NSUInteger YY = prevYear % 100U;
+ NSUInteger C = prevYear - YY;
+ NSUInteger G = YY + YY / 4U;
+ NSUInteger isLeapYear = (((C / 100U) % 4U) * 5U);
+ NSUInteger Jan1Weekday = (isLeapYear + G) % 7U;
+ enum { monday, tuesday, wednesday, thursday/*, friday, saturday, sunday*/ };
+ components.day = ((8U - Jan1Weekday) + (7U * (Jan1Weekday > thursday))) + (day - 1U) + (7U * (month_or_week - 2));
+
+ case dateOnly: //An "ordinal date".
+ break;
+ }
+ }
+ } //if (!(strict && isdigit(ch[0])))
+
More information about the commits
mailing list