Skip to content

Commit b8ce24e

Browse files
committed
Remove comment and error from 1999
Remove the same warning from CFUUIDGetConstantUUIDWithBytes We can do this as it's the same function as CreateWithBytes, except a different value for the third parameter is passed to __CFUUIDCreateWithBytesPrimitive
1 parent de5f7ed commit b8ce24e

File tree

1 file changed

+10
-43
lines changed

1 file changed

+10
-43
lines changed

CoreFoundation/Base.subproj/CFUUID.c

+10-43
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,16 @@ static CFUUIDRef __CFUUIDCreateWithBytesPrimitive(CFAllocatorRef allocator, CFUU
115115

116116
uuid->_bytes = bytes;
117117
__CFUUIDAddUniqueUUIDHasLock(uuid);
118-
} else if (!isConst) {
119-
CFRetain(uuid);
118+
return;
120119
}
121-
122-
if (isConst) {
120+
123121
#if !DEPLOYMENT_RUNTIME_SWIFT
122+
if (isConst) {
124123
__CFRuntimeSetRC(uuid, 0); // constant CFUUIDs should be immortal. This applies even to equivalent UUIDs created earlier that were *not* constant.
124+
else
125+
CFRetain(uuid);
125126
#else
126-
CFRetain(uuid); // Swift doesn't support meddling with the retain count. Just ensure there is one retain here.
127+
CFRetain(uuid); // Swift doesn't support meddling with the retain count. Just ensure there is one retain here.
127128
#endif
128129
}
129130
});
@@ -175,25 +176,8 @@ CFUUIDRef CFUUIDCreate(CFAllocatorRef alloc) {
175176
return (retval == 0) ? __CFUUIDCreateWithBytesPrimitive(alloc, bytes, false) : NULL;
176177
}
177178

178-
CFUUIDRef CFUUIDCreateWithBytes(CFAllocatorRef alloc, uint8_t byte0, uint8_t byte1, uint8_t byte2, uint8_t byte3, uint8_t byte4, uint8_t byte5, uint8_t byte6, uint8_t byte7, uint8_t byte8, uint8_t byte9, uint8_t byte10, uint8_t byte11, uint8_t byte12, uint8_t byte13, uint8_t byte14, uint8_t byte15) {
179-
CFUUIDBytes bytes;
180-
// CodeWarrior can't handle the structure assignment of bytes, so we must explode this - REW, 10/8/99
181-
bytes.byte0 = byte0;
182-
bytes.byte1 = byte1;
183-
bytes.byte2 = byte2;
184-
bytes.byte3 = byte3;
185-
bytes.byte4 = byte4;
186-
bytes.byte5 = byte5;
187-
bytes.byte6 = byte6;
188-
bytes.byte7 = byte7;
189-
bytes.byte8 = byte8;
190-
bytes.byte9 = byte9;
191-
bytes.byte10 = byte10;
192-
bytes.byte11 = byte11;
193-
bytes.byte12 = byte12;
194-
bytes.byte13 = byte13;
195-
bytes.byte14 = byte14;
196-
bytes.byte15 = byte15;
179+
CFUUIDRef CFUUIDCreateWithBytes(CFAllocatorRef alloc, UInt8 byte0, UInt8 byte1, UInt8 byte2, UInt8 byte3, UInt8 byte4, UInt8 byte5, UInt8 byte6, UInt8 byte7, UInt8 byte8, UInt8 byte9, UInt8 byte10, UInt8 byte11, UInt8 byte12, UInt8 byte13, UInt8 byte14, UInt8 byte15) {
180+
CFUUIDBytes bytes = {byte0, byte1, byte2, byte3, byte4, byte5, byte6, byte7, byte8, byte9, byte10, byte11, byte12, byte13, byte14, byte15};
197181

198182
return __CFUUIDCreateWithBytesPrimitive(alloc, bytes, false);
199183
}
@@ -338,25 +322,8 @@ CFStringRef CFUUIDCreateString(CFAllocatorRef alloc, CFUUIDRef uuid) {
338322
return str;
339323
}
340324

341-
CFUUIDRef CFUUIDGetConstantUUIDWithBytes(CFAllocatorRef alloc, uint8_t byte0, uint8_t byte1, uint8_t byte2, uint8_t byte3, uint8_t byte4, uint8_t byte5, uint8_t byte6, uint8_t byte7, uint8_t byte8, uint8_t byte9, uint8_t byte10, uint8_t byte11, uint8_t byte12, uint8_t byte13, uint8_t byte14, uint8_t byte15) {
342-
CFUUIDBytes bytes;
343-
// CodeWarrior can't handle the structure assignment of bytes, so we must explode this - REW, 10/8/99
344-
bytes.byte0 = byte0;
345-
bytes.byte1 = byte1;
346-
bytes.byte2 = byte2;
347-
bytes.byte3 = byte3;
348-
bytes.byte4 = byte4;
349-
bytes.byte5 = byte5;
350-
bytes.byte6 = byte6;
351-
bytes.byte7 = byte7;
352-
bytes.byte8 = byte8;
353-
bytes.byte9 = byte9;
354-
bytes.byte10 = byte10;
355-
bytes.byte11 = byte11;
356-
bytes.byte12 = byte12;
357-
bytes.byte13 = byte13;
358-
bytes.byte14 = byte14;
359-
bytes.byte15 = byte15;
325+
CFUUIDRef CFUUIDGetConstantUUIDWithBytes(CFAllocatorRef alloc, UInt8 byte0, UInt8 byte1, UInt8 byte2, UInt8 byte3, UInt8 byte4, UInt8 byte5, UInt8 byte6, UInt8 byte7, UInt8 byte8, UInt8 byte9, UInt8 byte10, UInt8 byte11, UInt8 byte12, UInt8 byte13, UInt8 byte14, UInt8 byte15) {
326+
CFUUIDBytes bytes = {byte0, byte1, byte2, byte3, byte4, byte5, byte6, byte7, byte8, byte9, byte10, byte11, byte12, byte13, byte14, byte15};
360327

361328
// The analyzer can't understand functions like __CFUUIDCreateWithBytesPrimitive which return retained objects based on a parameter.
362329
#ifdef __clang_analyzer__

0 commit comments

Comments
 (0)