︙ | | |
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
|
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
|
-
-
+
+
-
-
-
+
+
+
-
+
-
+
|
allowsSwappableMemory: (bool)allowsSwappableMemory
{
return [[[self alloc] initWithCount: count
allowsSwappableMemory: allowsSwappableMemory]
autorelease];
}
+ (instancetype)dataWithItemSize: (size_t)itemSize
count: (size_t)count
+ (instancetype)dataWithCount: (size_t)count
itemSize: (size_t)itemSize
allowsSwappableMemory: (bool)allowsSwappableMemory
{
return [[[self alloc] initWithItemSize: itemSize
count: count
allowsSwappableMemory: allowsSwappableMemory]
return [[[self alloc] initWithCount: count
itemSize: itemSize
allowsSwappableMemory: allowsSwappableMemory]
autorelease];
}
+ (instancetype)dataWithItems: (const void *)items
count: (size_t)count
{
OF_UNRECOGNIZED_SELECTOR
}
+ (instancetype)dataWithItems: (const void *)items
itemSize: (size_t)itemSize
count: (size_t)count
itemSize: (size_t)itemSize
{
OF_UNRECOGNIZED_SELECTOR
}
+ (instancetype)dataWithItemsNoCopy: (void *)items
count: (size_t)count
freeWhenDone: (bool)freeWhenDone
{
OF_UNRECOGNIZED_SELECTOR
}
+ (instancetype)dataWithItemsNoCopy: (void *)items
itemSize: (size_t)itemSize
count: (size_t)count
itemSize: (size_t)itemSize
freeWhenDone: (bool)freeWhenDone
{
OF_UNRECOGNIZED_SELECTOR
}
#ifdef OF_HAVE_FILES
+ (instancetype)dataWithContentsOfFile: (OFString *)path
|
︙ | | |
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
|
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
|
-
-
-
+
+
+
-
-
-
+
+
+
|
OF_UNRECOGNIZED_SELECTOR
}
- (instancetype)initWithCount: (size_t)count
allowsSwappableMemory: (bool)allowsSwappableMemory
{
return [self initWithItemSize: 1
count: count
allowsSwappableMemory: allowsSwappableMemory];
return [self initWithCount: count
itemSize: 1
allowsSwappableMemory: allowsSwappableMemory];
}
- (instancetype)initWithItemSize: (size_t)itemSize
count: (size_t)count
allowsSwappableMemory: (bool)allowsSwappableMemory
- (instancetype)initWithCount: (size_t)count
itemSize: (size_t)itemSize
allowsSwappableMemory: (bool)allowsSwappableMemory
{
self = [super init];
@try {
#if defined(HAVE_MMAP) && defined(HAVE_MLOCK) && defined(MAP_ANON)
size_t pageSize = [OFSystemInfo pageSize];
#endif
|
︙ | | |
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
|
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
|
-
+
-
+
-
+
|
#else
} else
@throw [OFNotImplementedException
exceptionWithSelector: _cmd
object: nil];
#endif
_itemSize = itemSize;
_count = count;
_itemSize = itemSize;
_allowsSwappableMemory = allowsSwappableMemory;
} @catch (id e) {
[self release];
@throw e;
}
return self;
}
- (instancetype)initWithItems: (const void *)items
count: (size_t)count
{
OF_INVALID_INIT_METHOD
}
- (instancetype)initWithItems: (const void *)items
itemSize: (size_t)itemSize
count: (size_t)count
itemSize: (size_t)itemSize
{
OF_INVALID_INIT_METHOD
}
- (instancetype)initWithItemsNoCopy: (void *)items
count: (size_t)count
freeWhenDone: (bool)freeWhenDone
{
OF_INVALID_INIT_METHOD
}
- (instancetype)initWithItemsNoCopy: (void *)items
itemSize: (size_t)itemSize
count: (size_t)count
itemSize: (size_t)itemSize
freeWhenDone: (bool)freeWhenDone
{
OF_INVALID_INIT_METHOD
}
#ifdef OF_HAVE_FILES
- (instancetype)initWithContentsOfFile: (OFString *)path
|
︙ | | |
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
|
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
|
+
-
+
-
+
-
+
-
|
{
of_explicit_memset(_items, 0, _count * _itemSize);
}
- (id)copy
{
OFSecureData *copy = [[OFSecureData alloc]
initWithCount: _count
initWithItemSize: _itemSize
itemSize: _itemSize
count: _count
allowsSwappableMemory: _allowsSwappableMemory];
memcpy(copy.mutableItems, _items, _count * _itemSize);
return copy;
}
- (id)mutableCopy
{
OFSecureData *copy = [[OFSecureData alloc]
initWithCount: _count
initWithItemSize: _itemSize
itemSize: _itemSize
count: _count
allowsSwappableMemory: _allowsSwappableMemory];
memcpy(copy.mutableItems, _items, _count * _itemSize);
return copy;
}
|
︙ | | |