Differences From Artifact [fcc7bff050]:
- File
src/OFValue.m
— part of check-in
[627511b032]
at
2020-11-14 12:23:55
on branch trunk
— Rename of_malloc and of_calloc
The new names should be more accurate. (user: js, size: 6172) [annotate] [blame] [check-ins using] [more...]
To Artifact [0c9f7f6c34]:
- File src/OFValue.m — part of check-in [1b82d3bf4f] at 2021-03-07 20:25:21 on branch trunk — *.m: Fold methods into one line where it fits (user: js, size: 6019) [annotate] [blame] [check-ins using] [more...]
1 | /* | < < | | 1 2 3 4 5 6 7 8 9 | /* * Copyright (c) 2008-2021 Jonathan Schleifer <js@nil.im> * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE.QPL included in * the packaging of this file. * |
︙ | ︙ | |||
188 189 190 191 192 193 194 | otherValue = of_alloc(1, size); } @catch (id e) { free(value); @throw e; } @try { | | < | < < | < | 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 | otherValue = of_alloc(1, size); } @catch (id e) { free(value); @throw e; } @try { [self getValue: value size: size]; [object getValue: otherValue size: size]; ret = (memcmp(value, otherValue, size) == 0); } @finally { free(value); free(otherValue); } return ret; } - (unsigned long)hash { size_t size = of_sizeof_type_encoding(self.objCType); unsigned char *value; uint32_t hash; value = of_alloc(1, size); @try { [self getValue: value size: size]; OF_HASH_INIT(hash); for (size_t i = 0; i < size; i++) OF_HASH_ADD(hash, value[i]); OF_HASH_FINALIZE(hash); |
︙ | ︙ | |||
236 237 238 239 240 241 242 | } - (const char *)objCType { OF_UNRECOGNIZED_SELECTOR } | | < < | < < < | < < < | < < < | < < < | < < < | < < | < | 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 | } - (const char *)objCType { OF_UNRECOGNIZED_SELECTOR } - (void)getValue: (void *)value size: (size_t)size { OF_UNRECOGNIZED_SELECTOR } - (void *)pointerValue { void *ret; [self getValue: &ret size: sizeof(ret)]; return ret; } - (id)nonretainedObjectValue { id ret; [self getValue: &ret size: sizeof(ret)]; return ret; } - (of_range_t)rangeValue { of_range_t ret; [self getValue: &ret size: sizeof(ret)]; return ret; } - (of_point_t)pointValue { of_point_t ret; [self getValue: &ret size: sizeof(ret)]; return ret; } - (of_dimension_t)dimensionValue { of_dimension_t ret; [self getValue: &ret size: sizeof(ret)]; return ret; } - (of_rectangle_t)rectangleValue { of_rectangle_t ret; [self getValue: &ret size: sizeof(ret)]; return ret; } - (OFString *)description { OFMutableString *ret = [OFMutableString stringWithString: @"<OFValue: "]; size_t size = of_sizeof_type_encoding(self.objCType); unsigned char *value; value = of_alloc(1, size); @try { [self getValue: value size: size]; for (size_t i = 0; i < size; i++) { if (i > 0) [ret appendString: @" "]; [ret appendFormat: @"%02x", value[i]]; } |
︙ | ︙ |