Files
swift-mirror/stdlib/public/SwiftShims/NSDataShims.h
Philippe Hausler c8bbce6ef1 Data slice mutation support (#11939)
* Mutations of slices of data should preserve relative indexing as well as cow semantics of slices

* Ensure hashes of ranges are uniform to the expected hash for Data

* Correct a few mistakes in the slice mutation tests

* Update sequence initializations to avoid directly calling mutableCopy which prevents slice offset mismatches

* Avoid invalid index slices in creating mirrors

* Restore the original Data description

* Resetting a slice region should expand the slice to the maximum of the region (not a out of bounds index of the backing buffer)

* Remove stray comment and use a stack buffer for sequence appending

* Return false when allocations fail in _resizeConditionalAllocationBuffer (not yet in use)

* Enumeration of regions of a slice should be limited to the slice range in the case of custom backing (e.g. dispatch_data_t)

* adjust assertion warnings for data indexes that are negative
2017-09-16 13:22:01 -07:00

28 lines
959 B
Objective-C

//===--- NSDataShims.h - Foundation declarations for Data overlay ---------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
#import "FoundationShimSupport.h"
NS_BEGIN_DECLS
typedef void (^NSDataDeallocator)(void *, NSUInteger);
FOUNDATION_EXPORT const NSDataDeallocator NSDataDeallocatorVM;
FOUNDATION_EXPORT const NSDataDeallocator NSDataDeallocatorUnmap;
FOUNDATION_EXPORT const NSDataDeallocator NSDataDeallocatorFree;
FOUNDATION_EXPORT const NSDataDeallocator NSDataDeallocatorNone;
@interface NSData (FoundationSPI)
- (BOOL)_isCompact;
@end
NS_END_DECLS