Bladeren bron

Fixes for pre c99.

Brucey 3 jaren geleden
bovenliggende
commit
7481d41606
4 gewijzigde bestanden met toevoegingen van 15 en 10 verwijderingen
  1. 4 2
      blitz.mod/blitz_debug.c
  2. 4 3
      blitz.mod/blitz_enum.c
  3. 1 0
      blitz.mod/tree/tree.h
  4. 6 5
      stringbuilder.mod/glue.c

+ 4 - 2
blitz.mod/blitz_debug.c

@@ -36,7 +36,8 @@ static void swap(BBSource* a, BBSource* b) {
 static int partition (BBSource arr[], int low, int high) {
 static int partition (BBSource arr[], int low, int high) {
 	BBULONG pivot = arr[high].id;
 	BBULONG pivot = arr[high].id;
 	int i = (low - 1);
 	int i = (low - 1);
-	for (int j = low; j <= high- 1; j++) {
+	int j;
+	for (j = low; j <= high- 1; j++) {
 		if (arr[j].id < pivot) {
 		if (arr[j].id < pivot) {
 			i++;
 			i++;
 			swap(&arr[i], &arr[j]);
 			swap(&arr[i], &arr[j]);
@@ -111,7 +112,8 @@ BBSource * bbSourceForName(BBString * filename) {
 		bbStringToUTF8StringBuffer(filename, path, &len);
 		bbStringToUTF8StringBuffer(filename, path, &len);
 		path[len] = 0;
 		path[len] = 0;
 		
 		
-		for (int i = 0; i < bpCount; i++) {
+		int i;
+		for (i = 0; i < bpCount; i++) {
 			if (strcmp(path, sources[i].file) == 0) {
 			if (strcmp(path, sources[i].file) == 0) {
 				return &sources[i];
 				return &sources[i];
 			}
 			}

+ 4 - 3
blitz.mod/blitz_enum.c

@@ -68,9 +68,10 @@ ENUM_TO_STRING(BBSIZET,t)
 #define TRY_ENUM_CONVERT(type,chr)\
 #define TRY_ENUM_CONVERT(type,chr)\
 int bbEnumTryConvert_##chr(BBEnum * bbEnum, type ordinalValue, type * ordinalResult) {\
 int bbEnumTryConvert_##chr(BBEnum * bbEnum, type ordinalValue, type * ordinalResult) {\
 	type * value = (type*)bbEnum->values;\
 	type * value = (type*)bbEnum->values;\
+	int i;\
 	if (bbEnum->flags) {\
 	if (bbEnum->flags) {\
 		if (ordinalValue == 0) {\
 		if (ordinalValue == 0) {\
-			for (int i = 0; i < bbEnum->length; i++) {\
+			for (i = 0; i < bbEnum->length; i++) {\
 				if (*value++ == 0) {\
 				if (*value++ == 0) {\
 					return 1;\
 					return 1;\
 				}\
 				}\
@@ -78,7 +79,7 @@ int bbEnumTryConvert_##chr(BBEnum * bbEnum, type ordinalValue, type * ordinalRes
 			return 0;\
 			return 0;\
 		}\
 		}\
 		type val = ordinalValue;\
 		type val = ordinalValue;\
-		for (int i = 0; i < bbEnum->length; i++) {\
+		for (i = 0; i < bbEnum->length; i++) {\
 			val ^= *value++;\
 			val ^= *value++;\
 		}\
 		}\
 		if (val == 0) {\
 		if (val == 0) {\
@@ -89,7 +90,7 @@ int bbEnumTryConvert_##chr(BBEnum * bbEnum, type ordinalValue, type * ordinalRes
 		if (ordinalValue < *value || ordinalValue > ((type*)bbEnum->values)[bbEnum->length - 1]) {\
 		if (ordinalValue < *value || ordinalValue > ((type*)bbEnum->values)[bbEnum->length - 1]) {\
 			return 0;\
 			return 0;\
 		}\
 		}\
-		for (int i = 0; i < bbEnum->length; i++) {\
+		for (i = 0; i < bbEnum->length; i++) {\
 			if (*value++ == ordinalValue) {\
 			if (*value++ == ordinalValue) {\
 				*ordinalResult = ordinalValue;\
 				*ordinalResult = ordinalValue;\
 				return 1;\
 				return 1;\

+ 1 - 0
blitz.mod/tree/tree.h

@@ -27,6 +27,7 @@
 #define _ULIB_TREE_H
 #define _ULIB_TREE_H
 
 
 #include <stddef.h>
 #include <stddef.h>
+#include <stdint.h>
 
 
 #ifdef __cplusplus
 #ifdef __cplusplus
 #define new _new_
 #define new _new_

+ 6 - 5
stringbuilder.mod/glue.c

@@ -627,7 +627,8 @@ int bmx_stringbuilder_compare(struct MaxStringBuilder * buf1, struct MaxStringBu
 	
 	
 	int c = buf1->count < buf2->count ? buf1->count : buf2->count;
 	int c = buf1->count < buf2->count ? buf1->count : buf2->count;
 	int n = 0;
 	int n = 0;
-	for (int i=0; i < c; ++i) {
+	int i;
+	for (i=0; i < c; ++i) {
 		if ((n = buf1->buffer[i] - buf2->buffer[i])) {
 		if ((n = buf1->buffer[i] - buf2->buffer[i])) {
 			return n;
 			return n;
 		}
 		}
@@ -653,8 +654,8 @@ void bmx_stringbuilder_leftalign(struct MaxStringBuilder * buf, int length) {
 		int c = length - buf->count;
 		int c = length - buf->count;
 
 
 		BBChar * p = buf->buffer + buf->count;
 		BBChar * p = buf->buffer + buf->count;
-
-		for (int i=0; i < c; ++i) {
+		int i;
+		for (i=0; i < c; ++i) {
 			*p++ = (BBChar)' ';
 			*p++ = (BBChar)' ';
 		}
 		}
 	}
 	}
@@ -681,8 +682,8 @@ void bmx_stringbuilder_rightalign(struct MaxStringBuilder * buf, int length) {
 		memmove(buf->buffer + offset, buf->buffer, buf->count * sizeof(BBChar));
 		memmove(buf->buffer + offset, buf->buffer, buf->count * sizeof(BBChar));
 
 
 		BBChar * p = buf->buffer;
 		BBChar * p = buf->buffer;
-
-		for (int i=0; i < offset; ++i) {
+		int i;
+		for (i=0; i < offset; ++i) {
 			*p++ = (BBChar)' ';
 			*p++ = (BBChar)' ';
 		}
 		}
 	}
 	}