From 22a6e527e01d23a9f41e40afa0e4a88a8f98ca5a Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Fri, 13 Jun 2008 19:55:59 +0000 Subject: [PATCH] Monotone-Parent: a3759861ff6c685f2878fdb4bfe7ea6fe966df8b Monotone-Revision: 4a0075d77198c329e5e471528db155313b163846 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2008-06-13T19:55:59 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 6 ++++++ SoObjects/SOGo/NSArray+Utilities.h | 2 ++ SoObjects/SOGo/NSArray+Utilities.m | 13 +++++++++++++ 3 files changed, 21 insertions(+) diff --git a/ChangeLog b/ChangeLog index 7e5a34c6c..833f35d81 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-06-13 Wolfgang Sourdeau + + * SoObjects/SOGo/NSArray+Utilities.m ([NSArray + -asPointersOfObjects]): new method that transforms an NSArray into + an array of ptr**; + 2008-06-02 Wolfgang Sourdeau * UI/MailPartViewers/UIxMailPartICalViewer.m diff --git a/SoObjects/SOGo/NSArray+Utilities.h b/SoObjects/SOGo/NSArray+Utilities.h index 998cab7c8..96825c3d5 100644 --- a/SoObjects/SOGo/NSArray+Utilities.h +++ b/SoObjects/SOGo/NSArray+Utilities.h @@ -29,6 +29,8 @@ @interface NSArray (SOGoArrayUtilities) +- (id *) asPointersOfObjects; + - (NSString *) jsonRepresentation; - (NSArray *) stringsWithFormat: (NSString *) format; diff --git a/SoObjects/SOGo/NSArray+Utilities.m b/SoObjects/SOGo/NSArray+Utilities.m index 1e63756bf..389b2a363 100644 --- a/SoObjects/SOGo/NSArray+Utilities.m +++ b/SoObjects/SOGo/NSArray+Utilities.m @@ -27,6 +27,19 @@ @implementation NSArray (SOGoArrayUtilities) +- (id *) asPointersOfObjects +{ + id *pointers; + unsigned int max; + + max = [self count]; + pointers = malloc (sizeof(id) * (max + 1)); + [self getObjects: pointers]; + *(pointers + max) = nil; + + return pointers; +} + - (NSArray *) stringsWithFormat: (NSString *) format { NSMutableArray *formattedStrings;