Foundation: Declare variables used before declaration and remove dead IE code

References to undeclared variables created implicit globals, and an Internet Explorer code path referenced the now unsupported ActiveXObject.

* CPDecimal: Declare adderror in CPDecimalAdd and error1 in _SimpleDivide and _SimpleMultiply.
* CPFunctionOperation: Declare functionOp in +functionOperationWithFunction:.
* CPRunLoop: Declare CPMainRunLoop at file level instead of creating it as an implicit global in +initialize.
* CPWebDAVManager: Remove the ActiveXObject path from XMLDocumentFromString.
This commit is contained in:
David Richardson committed 2026-10-20 17:13:38 -06:00
1 parent 850c348cca
commit 53692b1b71
4 files changed
+8 -14

No files matched your search

+5 -2
View File
@@ -577,7 +577,8 @@ function CPDecimalAdd(result, leftOperand, rightOperand, roundingMode, longMode)
// below is equiv. of simple compare
var comp = 0,
ll = n1._mantissa.length,
lr = n2._mantissa.length;
lr = n2._mantissa.length,
adderror;
if (ll == lr)
comp = CPOrderedSame;
@@ -790,6 +791,7 @@ function _SimpleDivide(result, leftOperand, rightOperand, roundingMode)
k = 0,
firsttime = YES,
stopk = CPDecimalMaxDigits + 1,
error1,
used = 0; // How many digits of l have been used?
_CPDecimalSetZero(result);
@@ -957,7 +959,8 @@ function _SimpleMultiply(result, leftOperand, rightOperand, roundingMode, powerM
var error = CPCalculationNoError,
carry = 0,
exp = 0,
n = CPDecimalMakeZero();
n = CPDecimalMakeZero(),
error1;
_CPDecimalSetZero(result);
+1 -1
View File
@@ -79,7 +79,7 @@
*/
+ (id)functionOperationWithFunction:(JSObject)jsFunction
{
functionOp = [[CPFunctionOperation alloc] init];
var functionOp = [[CPFunctionOperation alloc] init];
[functionOp addExecutionFunction:jsFunction];
return functionOp;
+2 -1
View File
@@ -177,7 +177,8 @@ var _CPRunLoopPerformPool = [],
@end
var CPRunLoopLastNativeRunLoop = 0;
var CPRunLoopLastNativeRunLoop = 0,
CPMainRunLoop = nil;
/*!
@class CPRunLoop
-10
View File
@@ -179,16 +179,6 @@ WebDAVPropertiesForURLKeys[CPURLIsDirectoryKey] = @"resourcetype";
var XMLDocumentFromString = function(anXMLString)
{
if (typeof window["ActiveXObject"] !== "undefined")
{
var XMLDocument = new ActiveXObject("Microsoft.XMLDOM");
XMLDocument.async = false;
XMLDocument.loadXML(anXMLString);
return XMLDocument;
}
return new DOMParser().parseFromString(anXMLString,"text/xml");
};