Loading...
libkern/c++/OSUnserializeXML.cpp xnu-517.7.21 xnu-792.10.96
--- xnu/xnu-517.7.21/libkern/c++/OSUnserializeXML.cpp
+++ xnu/xnu-792.10.96/libkern/c++/OSUnserializeXML.cpp
@@ -81,7 +81,7 @@
 
 #define YYSTYPE object_t *
 #define YYPARSE_PARAM	state
-#define YYLEX_PARAM	state
+#define YYLEX_PARAM	(parser_state_t *)state
 
 // this is the internal struct used to hold objects on parser stack
 // it represents objects both before and after they have been created
@@ -147,7 +147,7 @@
 
 #define malloc(s) kern_os_malloc(s)
 #define realloc(a, s) kern_os_realloc(a, s)
-#define free(a) kern_os_free(a)
+#define free(a) kern_os_free((void *)a)
 
 #ifndef YYSTYPE
 #define YYSTYPE int
@@ -935,7 +935,7 @@
 case 17:
 #line 192 "OSUnserializeXML.y"
 { yyval = yyvsp[-1];
-				  yyval->key = yyval->object;
+				  yyval->key = (OSString *)yyval->object;
 				  yyval->object = yyvsp[0]->object;
 				  yyval->next = NULL; 
 				  yyvsp[0]->object = 0;
@@ -1410,9 +1410,8 @@
 {
 	unsigned long long n = 0;
 	int base = 10;
+	bool negate = false;
 	int c = currentChar();
-
-	if (!isDigit (c)) return 0;
 
 	if (c == '0') {
 		c = nextChar();
@@ -1422,9 +1421,16 @@
 		}
 	}
 	if (base == 10) {
+		if (c == '-') {
+			negate = true;
+			c = nextChar();
+		}
 		while(isDigit(c)) {
 			n = (n * base + c - '0');
 			c = nextChar();
+		}
+		if (negate) {
+			n = (unsigned long long)((long long)n * (long long)-1);
 		}
 	} else {
 		while(isHexDigit(c)) {