Comment: | Add OF_NONNULL / OF_NULLABLE and use that instead
Using __nonnull directly doesn't work on systems using glibc, as glibc |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
b7097a67b6b03aa2f55dc820a01f8bee |
User & Date: | js on 2015-06-14 10:45:10 |
Other Links: | manifest | tags |
2015-06-14
| ||
12:37 | utils/objfw-config.in: Use -n instead of ! -z check-in: 7bb4a942fb user: js tags: trunk | |
10:45 | Add OF_NONNULL / OF_NULLABLE and use that instead check-in: b7097a67b6 user: js tags: trunk | |
2015-06-13
| ||
22:26 | Add support for and use the new nullability check-in: 9e76144ef8 user: js tags: trunk | |
Modified src/OFApplication.h from [efd0ac2883] to [e950676ac5].
︙ | ︙ | |||
180 181 182 183 184 185 186 | /*! * @brief Gets args and argv. * * @param argc A pointer where a pointer to argc should be stored * @param argv A pointer where a pointer to argv should be stored */ | | | | 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | /*! * @brief Gets args and argv. * * @param argc A pointer where a pointer to argc should be stored * @param argv A pointer where a pointer to argv should be stored */ - (void)getArgumentCount: (int *OF_NONNULL *OF_NONNULL)argc andArgumentValues: (char *OF_NONNULL *OF_NONNULL *OF_NONNULL[])argv; /*! * @brief Returns the name of the program (argv[0]). * * @return The name of the program (argv[0]) */ - (OFString*)programName; |
︙ | ︙ | |||
237 238 239 240 241 242 243 | @interface OFObject (OFApplicationDelegate) <OFApplicationDelegate> @end #ifdef __cplusplus extern "C" { #endif | | | 237 238 239 240 241 242 243 244 245 246 247 248 249 250 | @interface OFObject (OFApplicationDelegate) <OFApplicationDelegate> @end #ifdef __cplusplus extern "C" { #endif extern int of_application_main(int *OF_NONNULL, char *OF_NONNULL *OF_NONNULL[], Class); #ifdef __cplusplus } #endif OF_ASSUME_NONNULL_END |
Modified src/OFArray.h from [f02c7b62f7] to [4267d7d56d].
︙ | ︙ | |||
65 66 67 68 69 70 71 | /*! * @brief A block for mapping objects to objects in an OFArray. * * @param object The object to map * @param index The index of the object to map * @return The object to map to */ | | | | 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | /*! * @brief A block for mapping objects to objects in an OFArray. * * @param object The object to map * @param index The index of the object to map * @return The object to map to */ typedef id OF_NONNULL (^of_array_map_block_t)(id object, size_t index); /*! * @brief A block for folding an OFArray. * * @param left The object to which the object has been folded so far * @param right The object that should be added to the left object * @return The left and right side folded into one object */ typedef id OF_NULLABLE (^of_array_fold_block_t)(id OF_NULLABLE left, id right); #endif /*! * @class OFArray OFArray.h ObjFW/OFArray.h * * @brief An abstract class for storing objects in an array. */ |
︙ | ︙ | |||
135 136 137 138 139 140 141 | * @brief Creates a new OFArray with the objects from the specified C array of * the specified length. * * @param objects A C array of objects * @param count The length of the C array * @return A new autoreleased OFArray */ | | > | | 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | * @brief Creates a new OFArray with the objects from the specified C array of * the specified length. * * @param objects A C array of objects * @param count The length of the C array * @return A new autoreleased OFArray */ + (instancetype) arrayWithObjects: (ObjectType const OF_NONNULL *OF_NONNULL)objects count: (size_t)count; /*! * @brief Initializes an OFArray with the specified object. * * @param object An object * @return An initialized OFArray */ |
︙ | ︙ | |||
180 181 182 183 184 185 186 | * @brief Initializes an OFArray with the objects from the specified C array of * the specified length. * * @param objects A C array of objects * @param count The length of the C array * @return An initialized OFArray */ | | | > | | 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 | * @brief Initializes an OFArray with the objects from the specified C array of * the specified length. * * @param objects A C array of objects * @param count The length of the C array * @return An initialized OFArray */ - initWithObjects: (ObjectType const OF_NONNULL *OF_NONNULL)objects count: (size_t)count; /*! * @brief Returns the object at the specified index in the array. * * @warning The returned object is *not* retained and autoreleased for * performance reasons! * * @param index The index of the object to return * @return The object at the specified index in the array */ - (ObjectType)objectAtIndex: (size_t)index; - (ObjectType)objectAtIndexedSubscript: (size_t)index; /*! * @brief Copies the objects at the specified range to the specified buffer. * * @param buffer The buffer to copy the objects to * @param range The range to copy */ - (void)getObjects: (ObjectType __unsafe_unretained OF_NONNULL *OF_NONNULL) buffer inRange: (of_range_t)range; /*! * @brief Returns the objects of the array as a C array. * * @return The objects of the array as a C array */ - (ObjectType const __unsafe_unretained OF_NONNULL *OF_NONNULL)objects; /*! * @brief Returns the index of the first object that is equivalent to the * specified object or `OF_NOT_FOUND` if it was not found. * * @param object The object whose index is returned * @return The index of the first object equivalent to the specified object |
︙ | ︙ | |||
465 466 467 468 469 470 471 | size_t _count; unsigned long _mutations; unsigned long *_mutationsPtr; size_t _position; } - initWithArray: (OFArray*)data | | | 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 | size_t _count; unsigned long _mutations; unsigned long *_mutationsPtr; size_t _position; } - initWithArray: (OFArray*)data mutationsPtr: (unsigned long *OF_NULLABLE)mutationsPtr; @end OF_ASSUME_NONNULL_END #import "OFMutableArray.h" #ifndef NSINTEGER_DEFINED /* Required for array literals to work */ @compatibility_alias NSArray OFArray; #endif |
Modified src/OFDictionary.h from [85eedadac8] to [66a93812a2].
︙ | ︙ | |||
34 35 36 37 38 39 40 | @class OFArray OF_GENERIC(ObjectType); #ifdef OF_HAVE_BLOCKS typedef void (^of_dictionary_enumeration_block_t)(id key, id object, bool *stop); typedef bool (^of_dictionary_filter_block_t)(id key, id object); | | | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | @class OFArray OF_GENERIC(ObjectType); #ifdef OF_HAVE_BLOCKS typedef void (^of_dictionary_enumeration_block_t)(id key, id object, bool *stop); typedef bool (^of_dictionary_filter_block_t)(id key, id object); typedef id OF_NONNULL (^of_dictionary_map_block_t)(id key, id object); #endif /*! * @class OFDictionary OFDictionary.h ObjFW/OFDictionary.h * * @brief An abstract class for storing objects in a dictionary. * |
︙ | ︙ | |||
104 105 106 107 108 109 110 | * * @param keys An array of keys * @param objects An array of objects * @param count The number of objects in the arrays * @return A new autoreleased OFDictionary */ + (instancetype) | | | | 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | * * @param keys An array of keys * @param objects An array of objects * @param count The number of objects in the arrays * @return A new autoreleased OFDictionary */ + (instancetype) dictionaryWithObjects: (ObjectType const OF_NONNULL *OF_NONNULL)objects forKeys: (KeyType const OF_NONNULL *OF_NONNULL)keys count: (size_t)count; /*! * @brief Creates a new OFDictionary with the specified keys objects. * * @param firstKey The first key * @return A new autoreleased OFDictionary |
︙ | ︙ | |||
157 158 159 160 161 162 163 | * and objects. * * @param keys An array of keys * @param objects An array of objects * @param count The number of objects in the arrays * @return An initialized OFDictionary */ | | | | 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | * and objects. * * @param keys An array of keys * @param objects An array of objects * @param count The number of objects in the arrays * @return An initialized OFDictionary */ - initWithObjects: (ObjectType const OF_NONNULL *OF_NONNULL)objects forKeys: (KeyType const OF_NONNULL *OF_NONNULL)keys count: (size_t)count; /*! * @brief Initializes an already allocated OFDictionary with the specified keys * and objects. * * @param firstKey The first key |
︙ | ︙ |
Modified src/OFEnumerator.h from [00a9d26e5f] to [30b2100737].
︙ | ︙ | |||
88 89 90 91 92 93 94 | */ #define of_fast_enumeration_state_t NSFastEnumerationState #ifndef NSINTEGER_DEFINED typedef struct { /// Arbitrary state information for the enumeration unsigned long state; /// Pointer to a C array of objects to return | | | | 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | */ #define of_fast_enumeration_state_t NSFastEnumerationState #ifndef NSINTEGER_DEFINED typedef struct { /// Arbitrary state information for the enumeration unsigned long state; /// Pointer to a C array of objects to return id __unsafe_unretained OF_NULLABLE *OF_NULLABLE itemsPtr; /// Arbitrary state information to detect mutations unsigned long *OF_NULLABLE mutationsPtr; /// Additional arbitrary state information unsigned long extra[5]; } of_fast_enumeration_state_t; #endif /*! * @protocol OFFastEnumeration OFEnumerator.h ObjFW/OFEnumerator.h |
︙ | ︙ | |||
116 117 118 119 120 121 122 | * @param state Context information for the enumeration * @param objects A pointer to an array where to put the objects * @param count The number of objects that can be stored at objects * @return The number of objects returned in objects or 0 when the enumeration * finished. */ - (int)countByEnumeratingWithState: (of_fast_enumeration_state_t*)state | | | | 116 117 118 119 120 121 122 123 124 125 126 127 128 | * @param state Context information for the enumeration * @param objects A pointer to an array where to put the objects * @param count The number of objects that can be stored at objects * @return The number of objects returned in objects or 0 when the enumeration * finished. */ - (int)countByEnumeratingWithState: (of_fast_enumeration_state_t*)state objects: (id __unsafe_unretained OF_NONNULL *OF_NONNULL)objects count: (int)count; @end OF_ASSUME_NONNULL_END |
Modified src/OFHTTPRequest.h from [523bcf67ad] to [a0120e2911].
︙ | ︙ | |||
237 238 239 240 241 242 243 | #endif /*! * @brief Returns a C string describing the specified request method. * * @param method The request method which should be described as a C string * @return A C string describing the specified request method */ | | | 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 | #endif /*! * @brief Returns a C string describing the specified request method. * * @param method The request method which should be described as a C string * @return A C string describing the specified request method */ extern const char *OF_NULLABLE of_http_request_method_to_string( of_http_request_method_t method); /*! * @brief Returns the request method for the specified string. * * @param string The string for which the request method should be returned * @return The request method for the specified string |
︙ | ︙ |
Modified src/OFKernelEventObserver_poll.h from [8cd049f795] to [2642239f58].
︙ | ︙ | |||
20 21 22 23 24 25 26 | @class OFDataArray; @interface OFKernelEventObserver_poll: OFKernelEventObserver { OFDataArray *_FDs; size_t _maxFD; | | | 20 21 22 23 24 25 26 27 28 29 30 31 | @class OFDataArray; @interface OFKernelEventObserver_poll: OFKernelEventObserver { OFDataArray *_FDs; size_t _maxFD; id __unsafe_unretained *_FDToObject; } @end OF_ASSUME_NONNULL_END |
Modified src/OFList.h from [badebf99e1] to [5074e7258e].
︙ | ︙ | |||
32 33 34 35 36 37 38 | */ struct of_list_object_t { /// A pointer to the next list object in the list of_list_object_t *next; /// A pointer to the previous list object in the list of_list_object_t *previous; /// The object for the list object | | | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | */ struct of_list_object_t { /// A pointer to the next list object in the list of_list_object_t *next; /// A pointer to the previous list object in the list of_list_object_t *previous; /// The object for the list object id __unsafe_unretained object; }; /*! * @class OFList OFList.h ObjFW/OFList.h * * @brief A class which provides easy to use double-linked lists. */ |
︙ | ︙ |
Modified src/OFMapTable.h from [03ba48a726] to [a855386419].
︙ | ︙ | |||
24 25 26 27 28 29 30 | /*! * @struct of_map_table_functions_t OFMapTable.h ObjFW/OFMapTable.h * * @brief A struct describing the functions to be used by the map table. */ typedef struct { /// The function to retain keys / values | | | | < | | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | /*! * @struct of_map_table_functions_t OFMapTable.h ObjFW/OFMapTable.h * * @brief A struct describing the functions to be used by the map table. */ typedef struct { /// The function to retain keys / values void *OF_NONNULL (*OF_NULLABLE retain)(void *value); /// The function to release keys / values void (*OF_NULLABLE release)(void *value); /// The function to hash keys uint32_t (*OF_NULLABLE hash)(void *value); /// The function to compare keys / values bool (*OF_NULLABLE equal)(void *value1, void *value2); } of_map_table_functions_t; #ifdef OF_HAVE_BLOCKS /*! * @brief A block for enumerating an OFMapTable. * * @param key The current key |
︙ | ︙ | |||
53 54 55 56 57 58 59 | /*! * @brief A block for replacing values in an OFMapTable. * * @param key The key of the value to replace * @param value The value to replace * @return The value to replace the value with */ | | > | 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | /*! * @brief A block for replacing values in an OFMapTable. * * @param key The key of the value to replace * @param value The value to replace * @return The value to replace the value with */ typedef void *OF_NONNULL (^of_map_table_replace_block_t)( void *key, void *value); #endif @class OFMapTableEnumerator; /*! * @class OFMapTable OFMapTable.h ObjFW/OFMapTable.h * |
︙ | ︙ |
Modified src/OFMutableArray.h from [73428ea9d3] to [665e799b10].
︙ | ︙ | |||
24 25 26 27 28 29 30 | /*! * @brief A block for replacing values in an OFMutableArray. * * @param object The object to replace * @param index The index of the object to replace * @return The object to replace the object with */ | | | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | /*! * @brief A block for replacing values in an OFMutableArray. * * @param object The object to replace * @param index The index of the object to replace * @return The object to replace the object with */ typedef id OF_NONNULL (^of_array_replace_block_t)(id object, size_t index); #endif /*! * @class OFMutableArray OFArray.h ObjFW/OFArray.h * * @brief An abstract class for storing, adding and removing objects in an * array. |
︙ | ︙ |
Modified src/OFMutableDictionary.h from [d3e27d1158] to [20d6c7fa26].
︙ | ︙ | |||
24 25 26 27 28 29 30 | /*! * @brief A block for replacing objects in an OFMutableDictionary. * * @param key The key of the object to replace * @param object The object to replace * @return The object to replace the object with */ | | | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | /*! * @brief A block for replacing objects in an OFMutableDictionary. * * @param key The key of the object to replace * @param object The object to replace * @return The object to replace the object with */ typedef id OF_NONNULL (^of_dictionary_replace_block_t)(id key, id object); #endif /*! * @class OFMutableDictionary OFDictionary.h ObjFW/OFDictionary.h * * @brief An abstract class for storing and changing objects in a dictionary. */ |
︙ | ︙ |
Modified src/OFObject.h from [c9ef03c38f] to [43c8c1be65].
︙ | ︙ | |||
939 940 941 942 943 944 945 | - (of_comparison_result_t)compare: (id <OFComparing>)object; @end #ifdef __cplusplus extern "C" { #endif extern id of_alloc_object(Class class_, size_t extraSize, | | | 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 | - (of_comparison_result_t)compare: (id <OFComparing>)object; @end #ifdef __cplusplus extern "C" { #endif extern id of_alloc_object(Class class_, size_t extraSize, size_t extraAlignment, void *OF_NULLABLE *OF_NULLABLE extra); extern void OF_NO_RETURN_FUNC of_method_not_found(id self, SEL _cmd); extern uint32_t of_hash_seed; #ifdef __cplusplus } #endif OF_ASSUME_NONNULL_END #import "OFObject+Serialization.h" |
Modified src/OFSet.h from [4f3cbb67f1] to [cac22c2803].
︙ | ︙ | |||
103 104 105 106 107 108 109 | /*! * @brief Creates a new set with the specified objects. * * @param objects An array of objects for the set * @param count The number of objects in the specified array * @return A new, autoreleased set with the specified objects */ | | | 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | /*! * @brief Creates a new set with the specified objects. * * @param objects An array of objects for the set * @param count The number of objects in the specified array * @return A new, autoreleased set with the specified objects */ + (instancetype)setWithObjects: (ObjectType const OF_NONNULL *OF_NONNULL)objects count: (size_t)count; /*! * @brief Initializes an already allocated set with the specified set. * * @param set The set to initialize the set with * @return An initialized set with the specified set |
︙ | ︙ | |||
137 138 139 140 141 142 143 | /*! * @brief Initializes an already allocated set with the specified objects. * * @param objects An array of objects for the set * @param count The number of objects in the specified array * @return An initialized set with the specified objects */ | | | 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | /*! * @brief Initializes an already allocated set with the specified objects. * * @param objects An array of objects for the set * @param count The number of objects in the specified array * @return An initialized set with the specified objects */ - initWithObjects: (ObjectType const OF_NONNULL *OF_NONNULL)objects count: (size_t)count; /*! * @brief Initializes an already allocated set with the specified object and * va_list. * * @param firstObject The first object for the set |
︙ | ︙ |
Modified src/OFStdIOStream.h from [1b4f95e1e9] to [75654b8c7a].
︙ | ︙ | |||
37 38 39 40 41 42 43 | extern "C" { #endif /*! @file */ /*! * @brief The standard input as an OFStream. */ | | | | | 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | extern "C" { #endif /*! @file */ /*! * @brief The standard input as an OFStream. */ extern OFStdIOStream *OF_NULLABLE of_stdin; /*! * @brief The standard output as an OFStream. */ extern OFStdIOStream *OF_NULLABLE of_stdout; /*! * @brief The standard error as an OFStream. */ extern OFStdIOStream *OF_NULLABLE of_stderr; extern void of_log(OFConstantString*, ...); #ifdef __cplusplus } #endif OF_ASSUME_NONNULL_END |
Modified src/OFStream.h from [af476e35d4] to [66ebb7f50c].
︙ | ︙ | |||
44 45 46 47 48 49 50 | * @param stream The stream on which data was read * @param buffer A buffer with the data that has been read * @param length The length of the data that has been read * @param exception An exception which occurred while reading or nil on success * @return A bool whether the same block should be used for the next read */ typedef bool (^of_stream_async_read_block_t)(OFStream *stream, void *buffer, | | | | 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | * @param stream The stream on which data was read * @param buffer A buffer with the data that has been read * @param length The length of the data that has been read * @param exception An exception which occurred while reading or nil on success * @return A bool whether the same block should be used for the next read */ typedef bool (^of_stream_async_read_block_t)(OFStream *stream, void *buffer, size_t length, OFException *OF_NULLABLE exception); /*! * @brief A block which is called when a line was read from the stream. * * @param stream The stream on which a line was read * @param line The line which has been read or nil when the end of stream * occurred * @param exception An exception which occurred while reading or nil on success * @return A bool whether the same block should be used for the next read */ typedef bool (^of_stream_async_read_line_block_t)(OFStream *stream, OFString *OF_NULLABLE line, OFException *OF_NULLABLE exception); #endif /*! * @class OFStream OFStream.h ObjFW/OFStream.h * * @brief A base class for different types of streams. * |
︙ | ︙ |
Modified src/OFString+XMLUnescaping.h from [faa405a093] to [8e9c5825f8].
︙ | ︙ | |||
33 34 35 36 37 38 39 | * @brief A block which is called to replace unknown XML entities in an XML * string. * * @param string The XML string which contains an unknown entity * @param entity The XML entity which is unknown * @return A replacement string for the unknown entity */ | | | 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | * @brief A block which is called to replace unknown XML entities in an XML * string. * * @param string The XML string which contains an unknown entity * @param entity The XML entity which is unknown * @return A replacement string for the unknown entity */ typedef OFString *OF_NULLABLE (^of_string_xml_unescaping_block_t)( OFString *string, OFString *entity); #endif /*! * @protocol OFStringXMLUnescapingDelegate OFString.h ObjFW/OFString.h * * @brief A protocol that needs to be implemented by delegates for |
︙ | ︙ |
Modified src/OFTCPSocket.h from [433e48e1ac] to [5654a78b4e].
︙ | ︙ | |||
30 31 32 33 34 35 36 | * @brief A block which is called when the socket connected. * * @param socket The socket which connected * @param exception An exception which occurred while connecting the socket or * nil on success */ typedef void (^of_tcp_socket_async_connect_block_t)(OFTCPSocket *socket, | | | | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | * @brief A block which is called when the socket connected. * * @param socket The socket which connected * @param exception An exception which occurred while connecting the socket or * nil on success */ typedef void (^of_tcp_socket_async_connect_block_t)(OFTCPSocket *socket, OFException *OF_NULLABLE exception); /*! * @brief A block which is called when the socket accepted a connection. * * @param socket The socket which accepted the connection * @param acceptedSocket The socket which has been accepted * @param exception An exception which occurred while accepting the socket or * nil on success * @return A bool whether the same block should be used for the next incoming * connection */ typedef bool (^of_tcp_socket_async_accept_block_t)(OFTCPSocket *socket, OFTCPSocket *acceptedSocket, OFException *OF_NULLABLE exception); #endif /*! * @class OFTCPSocket OFTCPSocket.h ObjFW/OFTCPSocket.h * * @brief A class which provides functions to create and use TCP sockets. * |
︙ | ︙ | |||
273 274 275 276 277 278 279 | */ - (bool)isTCPNoDelayEnabled; @end #ifdef __cplusplus extern "C" { #endif | | | 273 274 275 276 277 278 279 280 281 282 283 284 285 | */ - (bool)isTCPNoDelayEnabled; @end #ifdef __cplusplus extern "C" { #endif extern Class OF_NULLABLE of_tls_socket_class; #ifdef __cplusplus } #endif OF_ASSUME_NONNULL_END |
Modified src/OFThread.h from [5030168140] to [81d5aa4cdd].
︙ | ︙ | |||
30 31 32 33 34 35 36 | #if defined(OF_HAVE_THREADS) && defined(OF_HAVE_BLOCKS) /*! * @brief A block to be executed in a new thread. * * @return The object which should be returned when the thread is joined */ | | | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | #if defined(OF_HAVE_THREADS) && defined(OF_HAVE_BLOCKS) /*! * @brief A block to be executed in a new thread. * * @return The object which should be returned when the thread is joined */ typedef id OF_NULLABLE (^of_thread_block_t)(void); #endif /*! * @class OFThread OFThread.h ObjFW/OFThread.h * * @brief A class which provides portable threads. * |
︙ | ︙ |
Modified src/OFUDPSocket.h from [47b461dbfd] to [fa09b98560].
︙ | ︙ | |||
45 46 47 48 49 50 51 | * @param port The port of the host / port pair * @param address The address of the resolved host / port pair * @param exception An exception which occurred while resolving or nil on * success */ typedef void (^of_udp_socket_async_resolve_block_t)(OFString *host, uint16_t port, of_udp_socket_address_t address, | | | | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | * @param port The port of the host / port pair * @param address The address of the resolved host / port pair * @param exception An exception which occurred while resolving or nil on * success */ typedef void (^of_udp_socket_async_resolve_block_t)(OFString *host, uint16_t port, of_udp_socket_address_t address, OFException *OF_NULLABLE exception); /*! * @brief A block which is called when a packet has been received. * * @param socket The UDP which received a packet * @param buffer The buffer the packet has been written to * @param length The length of the packet * @param sender The address of the sender of the packet * @param exception An exception which occurred while receiving or nil on * success * @return A bool whether the same block should be used for the next receive */ typedef bool (^of_udp_socket_async_receive_block_t)(OFUDPSocket *socket, void *buffer, size_t length, of_udp_socket_address_t sender, OFException *OF_NULLABLE exception); #endif /*! * @class OFUDPSocket OFUDPSocket.h ObjFW/OFUDPSocket.h * * @brief A class which provides functions to create and use UDP sockets. * |
︙ | ︙ | |||
150 151 152 153 154 155 156 | * * @param host A pointer to an OFString*. If it is not NULL, it will be set to * the host of the host / port pair. * @param port A pointer to an uint16_t. If it is not NULL, the port of the * host / port pair will be written to it. * @param address The address for which the host and port should be retrieved */ | | | | 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | * * @param host A pointer to an OFString*. If it is not NULL, it will be set to * the host of the host / port pair. * @param port A pointer to an uint16_t. If it is not NULL, the port of the * host / port pair will be written to it. * @param address The address for which the host and port should be retrieved */ + (void)getHost: (OFString *__autoreleasing OF_NONNULL *OF_NULLABLE)host andPort: (uint16_t *OF_NULLABLE)port forAddress: (of_udp_socket_address_t*)address; /*! * @brief Binds the socket to the specified host and port. * * @param host The host to bind to. Use `@"0.0.0.0"` for IPv4 or `@"::"` for * IPv6 to bind to all. |
︙ | ︙ |
Modified src/OFZIPArchiveEntry.h from [247677c877] to [c1f79ae163].
︙ | ︙ | |||
231 232 233 234 235 236 237 | * the specified tag * @param tag The tag to look for * @param data A pointer to a pointer that should be set to the start of the * extra field with the specified tag * @param size A pointer to an uint16_t that should be set to the size */ extern void of_zip_archive_entry_extra_field_find(OFDataArray *extraField, | | | 231 232 233 234 235 236 237 238 239 240 241 242 243 | * the specified tag * @param tag The tag to look for * @param data A pointer to a pointer that should be set to the start of the * extra field with the specified tag * @param size A pointer to an uint16_t that should be set to the size */ extern void of_zip_archive_entry_extra_field_find(OFDataArray *extraField, uint16_t tag, uint8_t *OF_NONNULL *OF_NONNULL data, uint16_t *size); #ifdef __cplusplus } #endif OF_ASSUME_NONNULL_END |
Modified src/atomic.h from [907e2f3914] to [cc8d24b757].
︙ | ︙ | |||
27 28 29 30 31 32 33 | #ifdef OF_HAVE_OSATOMIC # include <libkern/OSAtomic.h> #endif OF_ASSUME_NONNULL_BEGIN static OF_INLINE int | | | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | #ifdef OF_HAVE_OSATOMIC # include <libkern/OSAtomic.h> #endif OF_ASSUME_NONNULL_BEGIN static OF_INLINE int of_atomic_int_add(volatile int *OF_NONNULL p, int i) { #if !defined(OF_HAVE_THREADS) return (*p += i); #elif defined(OF_HAVE_GCC_ATOMIC_OPS) return __sync_add_and_fetch(p, i); #elif defined(OF_X86_64_ASM) || defined(OF_X86_ASM) if (sizeof(int) == 4) |
︙ | ︙ | |||
76 77 78 79 80 81 82 | return OSAtomicAdd32Barrier(i, p); #else # error of_atomic_int_add not implemented! #endif } static OF_INLINE int32_t | | | 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | return OSAtomicAdd32Barrier(i, p); #else # error of_atomic_int_add not implemented! #endif } static OF_INLINE int32_t of_atomic_int32_add(volatile int32_t *OF_NONNULL p, int32_t i) { #if !defined(OF_HAVE_THREADS) return (*p += i); #elif defined(OF_HAVE_GCC_ATOMIC_OPS) return __sync_add_and_fetch(p, i); #elif defined(OF_X86_64_ASM) || defined(OF_X86_ASM) __asm__ __volatile__ ( |
︙ | ︙ | |||
112 113 114 115 116 117 118 | return OSAtomicAdd32Barrier(i, p); #else # error of_atomic_int32_add not implemented! #endif } static OF_INLINE void* | | | 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | return OSAtomicAdd32Barrier(i, p); #else # error of_atomic_int32_add not implemented! #endif } static OF_INLINE void* of_atomic_ptr_add(void *volatile OF_NULLABLE *OF_NONNULL p, intptr_t i) { #if !defined(OF_HAVE_THREADS) return (*(char* volatile*)p += i); #elif defined(OF_HAVE_GCC_ATOMIC_OPS) return __sync_add_and_fetch(p, (void*)i); #elif defined(OF_X86_64_ASM) __asm__ __volatile__ ( |
︙ | ︙ | |||
162 163 164 165 166 167 168 | # endif #else # error of_atomic_ptr_add not implemented! #endif } static OF_INLINE int | | | 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | # endif #else # error of_atomic_ptr_add not implemented! #endif } static OF_INLINE int of_atomic_int_sub(volatile int *OF_NONNULL p, int i) { #if !defined(OF_HAVE_THREADS) return (*p -= i); #elif defined(OF_HAVE_GCC_ATOMIC_OPS) return __sync_sub_and_fetch(p, i); #elif defined(OF_X86_64_ASM) || defined(OF_X86_ASM) if (sizeof(int) == 4) |
︙ | ︙ | |||
213 214 215 216 217 218 219 | return OSAtomicAdd32Barrier(-i, p); #else # error of_atomic_int_sub not implemented! #endif } static OF_INLINE int32_t | | | 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | return OSAtomicAdd32Barrier(-i, p); #else # error of_atomic_int_sub not implemented! #endif } static OF_INLINE int32_t of_atomic_int32_sub(volatile int32_t *OF_NONNULL p, int32_t i) { #if !defined(OF_HAVE_THREADS) return (*p -= i); #elif defined(OF_HAVE_GCC_ATOMIC_OPS) return __sync_sub_and_fetch(p, i); #elif defined(OF_X86_64_ASM) || defined(OF_X86_ASM) __asm__ __volatile__ ( |
︙ | ︙ | |||
250 251 252 253 254 255 256 | return OSAtomicAdd32Barrier(-i, p); #else # error of_atomic_int32_sub not implemented! #endif } static OF_INLINE void* | | | 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | return OSAtomicAdd32Barrier(-i, p); #else # error of_atomic_int32_sub not implemented! #endif } static OF_INLINE void* of_atomic_ptr_sub(void *volatile OF_NULLABLE *OF_NONNULL p, intptr_t i) { #if !defined(OF_HAVE_THREADS) return (*(char* volatile*)p -= i); #elif defined(OF_HAVE_GCC_ATOMIC_OPS) return __sync_sub_and_fetch(p, (void*)i); #elif defined(OF_X86_64_ASM) __asm__ __volatile__ ( |
︙ | ︙ | |||
302 303 304 305 306 307 308 | # endif #else # error of_atomic_ptr_sub not implemented! #endif } static OF_INLINE int | | | 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 | # endif #else # error of_atomic_ptr_sub not implemented! #endif } static OF_INLINE int of_atomic_int_inc(volatile int *OF_NONNULL p) { #if !defined(OF_HAVE_THREADS) return ++*p; #elif defined(OF_HAVE_GCC_ATOMIC_OPS) return __sync_add_and_fetch(p, 1); #elif defined(OF_X86_64_ASM) || defined(OF_X86_ASM) int i; |
︙ | ︙ | |||
359 360 361 362 363 364 365 | return OSAtomicIncrement32Barrier(p); #else # error of_atomic_int_inc not implemented! #endif } static OF_INLINE int32_t | | | 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 | return OSAtomicIncrement32Barrier(p); #else # error of_atomic_int_inc not implemented! #endif } static OF_INLINE int32_t of_atomic_int32_inc(volatile int32_t *OF_NONNULL p) { #if !defined(OF_HAVE_THREADS) return ++*p; #elif defined(OF_HAVE_GCC_ATOMIC_OPS) return __sync_add_and_fetch(p, 1); #elif defined(OF_X86_64_ASM) || defined(OF_X86_ASM) int32_t i; |
︙ | ︙ | |||
401 402 403 404 405 406 407 | return OSAtomicIncrement32Barrier(p); #else # error of_atomic_int32_inc not implemented! #endif } static OF_INLINE int | | | 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 | return OSAtomicIncrement32Barrier(p); #else # error of_atomic_int32_inc not implemented! #endif } static OF_INLINE int of_atomic_int_dec(volatile int *OF_NONNULL p) { #if !defined(OF_HAVE_THREADS) return --*p; #elif defined(OF_HAVE_GCC_ATOMIC_OPS) return __sync_sub_and_fetch(p, 1); #elif defined(OF_X86_64_ASM) || defined(OF_X86_ASM) int i; |
︙ | ︙ | |||
458 459 460 461 462 463 464 | return OSAtomicDecrement32Barrier(p); #else # error of_atomic_int_dec not implemented! #endif } static OF_INLINE int32_t | | | 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 | return OSAtomicDecrement32Barrier(p); #else # error of_atomic_int_dec not implemented! #endif } static OF_INLINE int32_t of_atomic_int32_dec(volatile int32_t *OF_NONNULL p) { #if !defined(OF_HAVE_THREADS) return --*p; #elif defined(OF_HAVE_GCC_ATOMIC_OPS) return __sync_sub_and_fetch(p, 1); #elif defined(OF_X86_64_ASM) || defined(OF_X86_ASM) int32_t i; |
︙ | ︙ | |||
500 501 502 503 504 505 506 | return OSAtomicDecrement32Barrier(p); #else # error of_atomic_int32_dec not implemented! #endif } static OF_INLINE unsigned int | | | 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 | return OSAtomicDecrement32Barrier(p); #else # error of_atomic_int32_dec not implemented! #endif } static OF_INLINE unsigned int of_atomic_int_or(volatile unsigned int *OF_NONNULL p, unsigned int i) { #if !defined(OF_HAVE_THREADS) return (*p |= i); #elif defined(OF_HAVE_GCC_ATOMIC_OPS) return __sync_or_and_fetch(p, i); #elif defined(OF_X86_64_ASM) || defined(OF_X86_ASM) if (sizeof(int) == 4) |
︙ | ︙ | |||
559 560 561 562 563 564 565 | return OSAtomicOr32Barrier(i, p); #else # error of_atomic_int_or not implemented! #endif } static OF_INLINE uint32_t | | | 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 | return OSAtomicOr32Barrier(i, p); #else # error of_atomic_int_or not implemented! #endif } static OF_INLINE uint32_t of_atomic_int32_or(volatile uint32_t *OF_NONNULL p, uint32_t i) { #if !defined(OF_HAVE_THREADS) return (*p |= i); #elif defined(OF_HAVE_GCC_ATOMIC_OPS) return __sync_or_and_fetch(p, i); #elif defined(OF_X86_64_ASM) || defined(OF_X86_ASM) __asm__ __volatile__ ( |
︙ | ︙ | |||
600 601 602 603 604 605 606 | return OSAtomicOr32Barrier(i, p); #else # error of_atomic_int32_or not implemented! #endif } static OF_INLINE unsigned int | | | 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 | return OSAtomicOr32Barrier(i, p); #else # error of_atomic_int32_or not implemented! #endif } static OF_INLINE unsigned int of_atomic_int_and(volatile unsigned int *OF_NONNULL p, unsigned int i) { #if !defined(OF_HAVE_THREADS) return (*p &= i); #elif defined(OF_HAVE_GCC_ATOMIC_OPS) return __sync_and_and_fetch(p, i); #elif defined(OF_X86_64_ASM) || defined(OF_X86_ASM) if (sizeof(int) == 4) |
︙ | ︙ | |||
659 660 661 662 663 664 665 | return OSAtomicAnd32Barrier(i, p); #else # error of_atomic_int_and not implemented! #endif } static OF_INLINE uint32_t | | | 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 | return OSAtomicAnd32Barrier(i, p); #else # error of_atomic_int_and not implemented! #endif } static OF_INLINE uint32_t of_atomic_int32_and(volatile uint32_t *OF_NONNULL p, uint32_t i) { #if !defined(OF_HAVE_THREADS) return (*p &= i); #elif defined(OF_HAVE_GCC_ATOMIC_OPS) return __sync_and_and_fetch(p, i); #elif defined(OF_X86_64_ASM) || defined(OF_X86_ASM) __asm__ __volatile__ ( |
︙ | ︙ | |||
700 701 702 703 704 705 706 | return OSAtomicAnd32Barrier(i, p); #else # error of_atomic_int32_and not implemented! #endif } static OF_INLINE unsigned int | | | 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 | return OSAtomicAnd32Barrier(i, p); #else # error of_atomic_int32_and not implemented! #endif } static OF_INLINE unsigned int of_atomic_int_xor(volatile unsigned int *OF_NONNULL p, unsigned int i) { #if !defined(OF_HAVE_THREADS) return (*p ^= i); #elif defined(OF_HAVE_GCC_ATOMIC_OPS) return __sync_xor_and_fetch(p, i); #elif defined(OF_X86_64_ASM) || defined(OF_X86_ASM) if (sizeof(int) == 4) |
︙ | ︙ | |||
759 760 761 762 763 764 765 | return OSAtomicXor32Barrier(i, p); #else # error of_atomic_int_xor not implemented! #endif } static OF_INLINE uint32_t | | | 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 | return OSAtomicXor32Barrier(i, p); #else # error of_atomic_int_xor not implemented! #endif } static OF_INLINE uint32_t of_atomic_int32_xor(volatile uint32_t *OF_NONNULL p, uint32_t i) { #if !defined(OF_HAVE_THREADS) return (*p ^= i); #elif defined(OF_HAVE_GCC_ATOMIC_OPS) return __sync_xor_and_fetch(p, i); #elif defined(OF_X86_64_ASM) || defined(OF_X86_ASM) __asm__ __volatile__ ( |
︙ | ︙ | |||
800 801 802 803 804 805 806 | return OSAtomicXor32Barrier(i, p); #else # error of_atomic_int32_xor not implemented! #endif } static OF_INLINE bool | | | 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 | return OSAtomicXor32Barrier(i, p); #else # error of_atomic_int32_xor not implemented! #endif } static OF_INLINE bool of_atomic_int_cmpswap(volatile int *OF_NONNULL p, int o, int n) { #if !defined(OF_HAVE_THREADS) if (*p == o) { *p = n; return true; } |
︙ | ︙ | |||
855 856 857 858 859 860 861 | return OSAtomicCompareAndSwapIntBarrier(o, n, p); #else # error of_atomic_int_cmpswap not implemented! #endif } static OF_INLINE bool | | | 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 | return OSAtomicCompareAndSwapIntBarrier(o, n, p); #else # error of_atomic_int_cmpswap not implemented! #endif } static OF_INLINE bool of_atomic_int32_cmpswap(volatile int32_t *OF_NONNULL p, int32_t o, int32_t n) { #if !defined(OF_HAVE_THREADS) if (*p == o) { *p = n; return true; } |
︙ | ︙ | |||
910 911 912 913 914 915 916 | return OSAtomicCompareAndSwap32Barrier(o, n, p); #else # error of_atomic_int32_cmpswap not implemented! #endif } static OF_INLINE bool | | | | 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 | return OSAtomicCompareAndSwap32Barrier(o, n, p); #else # error of_atomic_int32_cmpswap not implemented! #endif } static OF_INLINE bool of_atomic_ptr_cmpswap(void *volatile OF_NULLABLE *OF_NONNULL p, void *OF_NULLABLE o, void *OF_NULLABLE n) { #if !defined(OF_HAVE_THREADS) if (*p == o) { *p = n; return true; } |
︙ | ︙ |
Modified src/instance.h from [a5b3481f06] to [8f8be6243f].
︙ | ︙ | |||
17 18 19 20 21 22 23 | #import "macros.h" OF_ASSUME_NONNULL_BEGIN #ifdef __cplusplus extern "C" { #endif | | | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | #import "macros.h" OF_ASSUME_NONNULL_BEGIN #ifdef __cplusplus extern "C" { #endif extern id objc_constructInstance(Class OF_NULLABLE, void *OF_NULLABLE); extern void* objc_destructInstance(id); #ifdef __cplusplus } #endif OF_ASSUME_NONNULL_END |
Modified src/macros.h from [6ce9a1b05b] to [6f2726fb11].
︙ | ︙ | |||
173 174 175 176 177 178 179 180 181 182 | #else # define OF_GENERIC(...) #endif #if __has_feature(nullability) # define OF_ASSUME_NONNULL_BEGIN _Pragma("clang assume_nonnull begin") # define OF_ASSUME_NONNULL_END _Pragma("clang assume_nonnull end") #else # define OF_ASSUME_NONNULL_BEGIN # define OF_ASSUME_NONNULL_END | > > | | | 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | #else # define OF_GENERIC(...) #endif #if __has_feature(nullability) # define OF_ASSUME_NONNULL_BEGIN _Pragma("clang assume_nonnull begin") # define OF_ASSUME_NONNULL_END _Pragma("clang assume_nonnull end") # define OF_NONNULL __nonnull # define OF_NULLABLE __nullable #else # define OF_ASSUME_NONNULL_BEGIN # define OF_ASSUME_NONNULL_END # define OF_NONNULL # define OF_NULLABLE # define nonnull # define nullable #endif #if __has_feature(objc_kindof) # define OF_KINDOF(cls) __kindof cls #else |
︙ | ︙ |
Modified src/of_asprintf.h from [f79cba2d8d] to [7fb013ccb5].
︙ | ︙ | |||
26 27 28 29 30 31 32 | #import "macros.h" OF_ASSUME_NONNULL_BEGIN #ifdef __cplusplus extern "C" { #endif | | > | | | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | #import "macros.h" OF_ASSUME_NONNULL_BEGIN #ifdef __cplusplus extern "C" { #endif extern int of_asprintf( char *OF_NULLABLE *OF_NONNULL, const char *OF_NONNULL, ...); extern int of_vasprintf( char *OF_NULLABLE *OF_NONNULL, const char *OF_NONNULL, va_list); #ifdef __cplusplus } #endif OF_ASSUME_NONNULL_END |
Modified src/resolver.h from [453d9528f7] to [f92afcb5a7].
︙ | ︙ | |||
45 46 47 48 49 50 51 | * struct * @param protocol The protocol that should be inserted into the resulting * address struct * * @return An array of results. The list is terminated by NULL and should be * free'd after use. */ | | | | | | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | * struct * @param protocol The protocol that should be inserted into the resulting * address struct * * @return An array of results. The list is terminated by NULL and should be * free'd after use. */ extern of_resolver_result_t *OF_NULLABLE *OF_NONNULL of_resolve_host(OFString *host, uint16_t port, int protocol); /*! * @brief Converts the specified address to a string and port pair. * * @param address The address to convert to a string * @param addressLength The length of the address to convert to a string * @param host A pointer to an OFString* which should be set to the host of the * address or NULL if the host is not needed * @param port A pointer to an uint16_t which should be set to the port of the * address or NULL if the port is not needed */ extern void of_address_to_string_and_port(struct sockaddr *address, socklen_t addressLength, OFString *__autoreleasing OF_NONNULL *OF_NULLABLE host, uint16_t *OF_NULLABLE port); /*! * @brief Frees the results returned by @ref of_resolve_host. * * @param results The results returned by @ref of_resolve_host */ extern void of_resolver_free( of_resolver_result_t *OF_NULLABLE *OF_NONNULL results); #ifdef __cplusplus } #endif OF_ASSUME_NONNULL_END |
Modified src/runtime/runtime.h from [d6e7a5e1d6] to [abe66d7e40].
︙ | ︙ | |||
87 88 89 90 91 92 93 | struct objc_selector { uintptr_t uid; const char *types; }; struct objc_super { | | | 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | struct objc_selector { uintptr_t uid; const char *types; }; struct objc_super { id OBJC_UNSAFE_UNRETAINED self; Class cls; }; struct objc_method { struct objc_selector sel; IMP imp; }; |
︙ | ︙ | |||
180 181 182 183 184 185 186 | #else } Protocol; #endif struct objc_protocol_list { struct objc_protocol_list *next; long count; | | | 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | #else } Protocol; #endif struct objc_protocol_list { struct objc_protocol_list *next; long count; Protocol *OBJC_UNSAFE_UNRETAINED list[1]; }; #ifdef __cplusplus extern "C" { #endif extern SEL sel_registerName(const char*); extern const char* sel_getName(SEL); |
︙ | ︙ |