Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Sources/CoreFoundation/CFArray.c
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ CF_PRIVATE CFArrayRef __CFArrayCreateTransfer(CFAllocatorRef allocator, const vo
}
__CFRuntimeSetValue(memory, 6, 0, flags);
__CFArraySetCount(memory, numValues);
memmove(__CFArrayGetBucketsPtr(memory), values, sizeof(void *) * numValues);
memcpy(__CFArrayGetBucketsPtr(memory), values, sizeof(void *) * numValues);
if (__CFOASafe) __CFSetLastAllocationEventName(memory, "CFArray (immutable)");
return (CFArrayRef)memory;
}
Expand Down Expand Up @@ -740,8 +740,8 @@ static void __CFArrayRepositionDequeRegions(CFMutableArrayRef array, CFRange ran
CFIndex newC0 = newL + A + newCount;
newDeque->_leftIdx = newL;
newDeque->_capacity = capacity;
if (0 < A) memmove(newBuckets + newL, buckets + oldL, A * sizeof(struct __CFArrayBucket));
if (0 < C) memmove(newBuckets + newC0, buckets + oldC0, C * sizeof(struct __CFArrayBucket));
if (0 < A) memcpy(newBuckets + newL, buckets + oldL, A * sizeof(struct __CFArrayBucket));
if (0 < C) memcpy(newBuckets + newC0, buckets + oldC0, C * sizeof(struct __CFArrayBucket));
array->_store = newDeque;
if (deque) CFAllocatorDeallocate(allocator, deque);
//printf("3: array %p store is now %p (%lx)\n", array, array->_store, *(unsigned long *)(array->_store));
Expand Down
20 changes: 10 additions & 10 deletions Sources/CoreFoundation/CFCharacterSet.c
Original file line number Diff line number Diff line change
Expand Up @@ -1560,7 +1560,7 @@ CF_INLINE Boolean __CFCharacterSetInitWithBitmapRepresentation(CFAllocatorRef al

if (length < __kCFBitmapSize) {
bitmap = (uint8_t *)CFAllocatorAllocate(allocator, __kCFBitmapSize, 0);
memmove(bitmap, CFDataGetBytePtr(theData), length);
memcpy(bitmap, CFDataGetBytePtr(theData), length);
memset(bitmap + length, 0, __kCFBitmapSize - length);

cBitmap = __CFCreateCompactBitmap(allocator, bitmap);
Expand All @@ -1577,7 +1577,7 @@ CF_INLINE Boolean __CFCharacterSetInitWithBitmapRepresentation(CFAllocatorRef al

if (cBitmap == NULL) {
bitmap = (uint8_t *)CFAllocatorAllocate(allocator, __kCFBitmapSize, 0);
memmove(bitmap, CFDataGetBytePtr(theData), __kCFBitmapSize);
memcpy(bitmap, CFDataGetBytePtr(theData), __kCFBitmapSize);

__CFCSetPutBitmapBits(cset, bitmap);
} else {
Expand All @@ -1597,7 +1597,7 @@ CF_INLINE Boolean __CFCharacterSetInitWithBitmapRepresentation(CFAllocatorRef al

if (length < __kCFBitmapSize) {
bitmap = (uint8_t *)CFAllocatorAllocate(allocator, __kCFBitmapSize, 0);
memmove(bitmap, bytes, length);
memcpy(bitmap, bytes, length);
memset(bitmap + length, 0, __kCFBitmapSize - length);

cBitmap = __CFCreateCompactBitmap(allocator, bitmap);
Expand All @@ -1614,7 +1614,7 @@ CF_INLINE Boolean __CFCharacterSetInitWithBitmapRepresentation(CFAllocatorRef al

if (cBitmap == NULL) {
bitmap = (uint8_t *)CFAllocatorAllocate(allocator, __kCFBitmapSize, 0);
memmove(bitmap, bytes, __kCFBitmapSize);
memcpy(bitmap, bytes, __kCFBitmapSize);

__CFCSetPutBitmapBits(annexSet, bitmap);
} else {
Expand Down Expand Up @@ -1725,7 +1725,7 @@ CF_CROSS_PLATFORM_EXPORT void _CFCharacterSetInitCopyingSet(CFAllocatorRef alloc
__CFCSetPutStringBuffer(cset, (UniChar *)CFAllocatorAllocate(alloc, __kCFStringCharSetMax * sizeof(UniChar), 0));

__CFCSetPutStringLength(cset, __CFCSetStringLength(theSet));
memmove(__CFCSetStringBuffer(cset), __CFCSetStringBuffer(theSet), __CFCSetStringLength(theSet) * sizeof(UniChar));
memcpy(__CFCSetStringBuffer(cset), __CFCSetStringBuffer(theSet), __CFCSetStringLength(theSet) * sizeof(UniChar));
break;

case __kCFCharSetClassBitmap:
Expand All @@ -1734,7 +1734,7 @@ CF_CROSS_PLATFORM_EXPORT void _CFCharacterSetInitCopyingSet(CFAllocatorRef alloc

if (bitmap == NULL) {
bitmap = (uint8_t *)CFAllocatorAllocate(alloc, sizeof(uint8_t) * __kCFBitmapSize, 0);
memmove(bitmap, __CFCSetBitmapBits(theSet), __kCFBitmapSize);
memcpy(bitmap, __CFCSetBitmapBits(theSet), __kCFBitmapSize);
__CFCSetPutBitmapBits(cset, bitmap);
} else {
__CFCSetPutCompactBitmapBits(cset, bitmap);
Expand All @@ -1752,7 +1752,7 @@ CF_CROSS_PLATFORM_EXPORT void _CFCharacterSetInitCopyingSet(CFAllocatorRef alloc
uint32_t size = __CFCSetGetCompactBitmapSize(compactBitmap);
uint8_t *newBitmap = (uint8_t *)CFAllocatorAllocate(alloc, size, 0);

memmove(newBitmap, compactBitmap, size);
memcpy(newBitmap, compactBitmap, size);
__CFCSetPutCompactBitmapBits(cset, newBitmap);
}
}
Expand Down Expand Up @@ -2823,12 +2823,12 @@ void CFCharacterSetIntersect(CFMutableCharacterSetRef theSet, CFCharacterSetRef
case __kCFCharSetClassString:
__CFCSetPutStringLength(theSet, __CFCSetStringLength(theOtherSet));
if (!__CFCSetStringBuffer(theSet)) __CFCSetPutStringBuffer(theSet, (UniChar *)CFAllocatorAllocate(CFGetAllocator(theSet), __kCFStringCharSetMax * sizeof(UniChar), 0));
memmove(__CFCSetStringBuffer(theSet), __CFCSetStringBuffer(theOtherSet), __CFCSetStringLength(theSet) * sizeof(UniChar));
memcpy(__CFCSetStringBuffer(theSet), __CFCSetStringBuffer(theOtherSet), __CFCSetStringLength(theSet) * sizeof(UniChar));
break;

case __kCFCharSetClassBitmap:
__CFCSetPutBitmapBits(theSet, (uint8_t *)CFAllocatorAllocate(CFGetAllocator(theSet), sizeof(uint8_t) * __kCFBitmapSize, 0));
memmove(__CFCSetBitmapBits(theSet), __CFCSetBitmapBits(theOtherSet), __kCFBitmapSize);
memcpy(__CFCSetBitmapBits(theSet), __CFCSetBitmapBits(theOtherSet), __kCFBitmapSize);
break;

case __kCFCharSetClassCompactBitmap: {
Expand All @@ -2837,7 +2837,7 @@ void CFCharacterSetIntersect(CFMutableCharacterSetRef theSet, CFCharacterSetRef
uint32_t size = __CFCSetGetCompactBitmapSize(cBitmap);
newBitmap = (uint8_t *)CFAllocatorAllocate(CFGetAllocator(theSet), sizeof(uint8_t) * size, 0);
__CFCSetPutBitmapBits(theSet, newBitmap);
memmove(newBitmap, cBitmap, size);
memcpy(newBitmap, cBitmap, size);
}
break;

Expand Down
6 changes: 3 additions & 3 deletions Sources/CoreFoundation/CFData.c
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ static void __CFDataGrow(CFMutableDataRef data, CFIndex numNewValues, Boolean cl
// If the length that needs to be zeroed is significantly greater than the length of the data, then calloc/memmove is probably more efficient than realloc/memset.
bytes = __CFDataAllocate(data, capacity * sizeof(uint8_t), true);
if (NULL != bytes) {
memmove(bytes, oldBytes, oldLength);
memcpy(bytes, oldBytes, oldLength);
__CFDataDeallocate(data);
}
}
Expand Down Expand Up @@ -653,7 +653,7 @@ void CFDataReplaceBytes(CFMutableDataRef data, CFRange range, const uint8_t *new
if (srcBuf == NULL) {
__CFDataHandleOutOfMemory(data, allocationSize);
}
memmove(srcBuf, newBytes, allocationSize);
memcpy(srcBuf, newBytes, allocationSize);
}

__CFDataGrow(data, newLength - originalLength, false);
Expand Down Expand Up @@ -769,7 +769,7 @@ static const uint8_t * __CFDataSearchBoyerMoore(const CFDataRef data, const uint
if (!needleCopy) {
__CFDataHandleOutOfMemory(data, needleLength * sizeof(uint8_t));
}
memmove(needleCopy, needle, needleLength);
memcpy(needleCopy, needle, needleLength);
REVERSE_BUFFER(uint8_t, needleCopy, needleLength);
_computeGoodSubstringShift(needleCopy, needleLength, goodSubstringShift, suffixLengths);
REVERSE_BUFFER(unsigned long, goodSubstringShift, needleLength);
Expand Down
4 changes: 3 additions & 1 deletion Sources/CoreFoundation/CFRuntime.c
Original file line number Diff line number Diff line change
Expand Up @@ -1243,7 +1243,9 @@ void __CFInitialize(void) {
if (0 == strcmp(args[idx], "-AppleLanguages") && args[idx + 1]) {
CFIndex length = strlen(args[idx + 1]);
__CFAppleLanguages = malloc(length + 1);
memmove(__CFAppleLanguages, args[idx + 1], length + 1);
if (__CFAppleLanguages) {
memcpy(__CFAppleLanguages, args[idx + 1], length + 1);
}
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/CoreFoundation/CFStream.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ CF_INLINE void _CFStreamSetStreamError(struct _CFStream *stream, CFStreamError *
if (!stream->error) {
stream->error = (CFErrorRef)CFAllocatorAllocate(CFGetAllocator(stream), sizeof(CFStreamError), 0);
}
memmove((void *)stream->error, err, sizeof(CFStreamError));
memcpy((void *)stream->error, err, sizeof(CFStreamError));
}

static CFStringRef __CFStreamCopyDescription(CFTypeRef cf) {
Expand Down
2 changes: 1 addition & 1 deletion Sources/CoreFoundation/CFUUID.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ CFUUIDRef CFUUIDCreate(CFAllocatorRef alloc) {
UUID u;
long rStatus = UuidCreate(&u);
if (RPC_S_OK != rStatus && RPC_S_UUID_LOCAL_ONLY != rStatus) retval = 1;
memmove(&bytes, &u, sizeof(bytes));
memcpy(&bytes, &u, sizeof(bytes));
#elif TARGET_OS_MAC || TARGET_OS_LINUX || TARGET_OS_BSD
static int8_t useV1UUIDs = -1;
uuid_t uuid;
Expand Down