From c41c3cb9d67d938aa1ffc37ecd926497b1f6e7fc Mon Sep 17 00:00:00 2001
From: Rose <gfunni234@gmail.com>
Date: Wed, 11 Dec 2024 01:09:49 -0500
Subject: [PATCH 1/2] int i should match count, which is a CFIndex

---
 Sources/CoreFoundation/CFBigNumber.c        | 2 +-
 Sources/CoreFoundation/CFBundle_Resources.c | 4 ++--
 Sources/CoreFoundation/CFFileUtilities.c    | 2 +-
 Sources/CoreFoundation/CFListFormatter.c    | 4 ++--
 Sources/_CFXMLInterface/CFXMLInterface.c    | 2 +-
 5 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/Sources/CoreFoundation/CFBigNumber.c b/Sources/CoreFoundation/CFBigNumber.c
index c3a045a92e..db419153a4 100644
--- a/Sources/CoreFoundation/CFBigNumber.c
+++ b/Sources/CoreFoundation/CFBigNumber.c
@@ -464,7 +464,7 @@ uint8_t _CFBigNumAdd(_CFBigNum *r, const _CFBigNum *a, const _CFBigNum *b) {
             bigNum = a;
             smallNum = b;
         }
-        for (int i = 0; i < sizeof(a->digits) / sizeof(a->digits[0]); i++) {
+        for (CFIndex i = 0; i < sizeof(a->digits) / sizeof(a->digits[0]); i++) {
             int64_t result = (int64_t)bigNum->digits[i] - (int64_t)smallNum->digits[i] - carry;
             if (result < 0) {
                 carry = 1;
diff --git a/Sources/CoreFoundation/CFBundle_Resources.c b/Sources/CoreFoundation/CFBundle_Resources.c
index f32ce6df65..4008de6016 100644
--- a/Sources/CoreFoundation/CFBundle_Resources.c
+++ b/Sources/CoreFoundation/CFBundle_Resources.c
@@ -1122,11 +1122,11 @@ CF_EXPORT CFTypeRef _Nullable _CFBundleCopyFindResources(CFBundleRef _Nullable b
 
     if (
         subPath) {
-        int depthLevel = 0;
+        CFIndex depthLevel = 0;
         CFArrayRef subPathComponents = CFStringCreateArrayBySeparatingStrings(kCFAllocatorSystemDefault, subPath, CFSTR("/"));
         CFIndex subPathComponentsCount = CFArrayGetCount(subPathComponents);
 
-        for (int i = 0; i < subPathComponentsCount; i++) {
+        for (CFIndex i = 0; i < subPathComponentsCount; i++) {
             CFStringRef comp = CFArrayGetValueAtIndex(subPathComponents, i);
 
             if (i == 0 && (CFStringCompare(comp, CFSTR(""), 0) == kCFCompareEqualTo)) {
diff --git a/Sources/CoreFoundation/CFFileUtilities.c b/Sources/CoreFoundation/CFFileUtilities.c
index c2ab0b9f1d..0607013be7 100644
--- a/Sources/CoreFoundation/CFFileUtilities.c
+++ b/Sources/CoreFoundation/CFFileUtilities.c
@@ -1414,7 +1414,7 @@ CF_PRIVATE CFArrayRef _CFCreateCFArrayByTokenizingString(const char *values, cha
         }
         free(copyDirPath);
         CFArrayRef pathArray = CFArrayCreate(kCFAllocatorSystemDefault, (const void **)pathList  , validPathCount, &kCFTypeArrayCallBacks);
-        for(int i = 0; i < validPathCount; i ++) {
+        for(size_t i = 0; i < validPathCount; i ++) {
             CFRelease(pathList[i]);
         }
         return pathArray;
diff --git a/Sources/CoreFoundation/CFListFormatter.c b/Sources/CoreFoundation/CFListFormatter.c
index 83366dda96..e555bb4941 100644
--- a/Sources/CoreFoundation/CFListFormatter.c
+++ b/Sources/CoreFoundation/CFListFormatter.c
@@ -87,7 +87,7 @@ CFStringRef _CFListFormatterCreateStringByJoiningStrings(CFAllocatorRef allocato
     bool *needsFree = calloc(count, sizeof(bool));
 
     CFStringRef string;
-    for (int i = 0; i < count; ++i) {
+    for (CFIndex i = 0; i < count; ++i) {
         string = CFArrayGetValueAtIndex(strings, i);
         CFIndex const len = CFStringGetLength(string);
         UChar const *ucharString = CFStringGetCharactersPtr(string);
@@ -115,7 +115,7 @@ CFStringRef _CFListFormatterCreateStringByJoiningStrings(CFAllocatorRef allocato
         if (fmt) {
             __cficu_ulistfmt_close(fmt);
         }
-        for (int i = 0; i < count; ++i) {
+        for (CFIndex i = 0; i < count; ++i) {
             UChar *ucharString = ucharStrings[i];
             if (ucharString && needsFree[i]) {
                 free(ucharString);
diff --git a/Sources/_CFXMLInterface/CFXMLInterface.c b/Sources/_CFXMLInterface/CFXMLInterface.c
index 1c54de3ec9..30a627f8a5 100644
--- a/Sources/_CFXMLInterface/CFXMLInterface.c
+++ b/Sources/_CFXMLInterface/CFXMLInterface.c
@@ -1392,7 +1392,7 @@ _CFXMLNodePtr _Nonnull * _Nullable _CFXMLNamespaces(_CFXMLNodePtr node, CFIndex*
     
     _CFXMLNodePtr* result = calloc(*count, sizeof(_CFXMLNodePtr));
     ns = ((xmlNode*)node)->nsDef;
-    for (int i = 0; i < *count; i++) {
+    for (CFIndex i = 0; i < *count; i++) {
         xmlNode* temp = xmlNewNode(ns, (unsigned char *)"");
         
         temp->type = _kCFXMLTypeNamespace;

From 670cbe6d8c0a4302ca5042834d8e28e5ec6e47c0 Mon Sep 17 00:00:00 2001
From: Rose <gfunni234@gmail.com>
Date: Wed, 11 Dec 2024 14:18:51 -0500
Subject: [PATCH 2/2] Update CFBigNumber.c

---
 Sources/CoreFoundation/CFBigNumber.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Sources/CoreFoundation/CFBigNumber.c b/Sources/CoreFoundation/CFBigNumber.c
index db419153a4..60aa2af7cf 100644
--- a/Sources/CoreFoundation/CFBigNumber.c
+++ b/Sources/CoreFoundation/CFBigNumber.c
@@ -464,7 +464,7 @@ uint8_t _CFBigNumAdd(_CFBigNum *r, const _CFBigNum *a, const _CFBigNum *b) {
             bigNum = a;
             smallNum = b;
         }
-        for (CFIndex i = 0; i < sizeof(a->digits) / sizeof(a->digits[0]); i++) {
+        for (size_t i = 0; i < sizeof(a->digits) / sizeof(a->digits[0]); i++) {
             int64_t result = (int64_t)bigNum->digits[i] - (int64_t)smallNum->digits[i] - carry;
             if (result < 0) {
                 carry = 1;