Преглед на файлове

Fixed more compiler warnings.

Brucey преди 4 години
родител
ревизия
33fd7fbff0
променени са 1 файла, в които са добавени 8 реда и са изтрити 8 реда
  1. 8 8
      ctranslator.bmx

+ 8 - 8
ctranslator.bmx

@@ -531,7 +531,7 @@ Type TCTranslator Extends TTranslator
 					If isStructInit Then
 					If isStructInit Then
 						Return "&bbNullObject"
 						Return "&bbNullObject"
 					Else
 					Else
-						Return Bra("&bbNullObject")
+						Return Bra(Bra(TransType(ty, "*")) + "&bbNullObject")
 					End If
 					End If
 				End If
 				End If
 			End If
 			End If
@@ -1153,7 +1153,7 @@ t:+"NULLNULLNULL"
 							Err "TODO extern types not allowed methods"
 							Err "TODO extern types not allowed methods"
 						Else
 						Else
 							If cdecl And cdecl.IsInterface() And Not equalsBuiltInFunc(cdecl, decl) Then
 							If cdecl And cdecl.IsInterface() And Not equalsBuiltInFunc(cdecl, decl) Then
-								Local ifc:String = Bra("(struct " + cdecl.munged + "_methods*)" + Bra("bbObjectInterface(" + TransSubExpr( lhs ) + ", " + "&" + cdecl.munged + "_ifc)"))
+								Local ifc:String = Bra("(struct " + cdecl.munged + "_methods*)" + Bra("bbObjectInterface((BBObject*)" + TransSubExpr( lhs ) + ", " + "(bbObjectInterface*)&" + cdecl.munged + "_ifc)"))
 								Return ifc + "->" + TransFuncPrefix(cdecl, decl) + FuncDeclMangleIdent(decl)+TransArgs( args,decl, TransSubExpr( lhs ) )
 								Return ifc + "->" + TransFuncPrefix(cdecl, decl) + FuncDeclMangleIdent(decl)+TransArgs( args,decl, TransSubExpr( lhs ) )
 '								Local ifc:String = Bra("(struct " + cdecl.munged + "_methods*)" + Bra("bbObjectInterface(" + lvarInit + ", " + "&" + cdecl.munged + "_ifc)"))
 '								Local ifc:String = Bra("(struct " + cdecl.munged + "_methods*)" + Bra("bbObjectInterface(" + lvarInit + ", " + "&" + cdecl.munged + "_ifc)"))
 '								Return ifc + "->" + TransFuncPrefix(cdecl, decl) + FuncDeclMangleIdent(decl)+TransArgs( args,decl, lvar )
 '								Return ifc + "->" + TransFuncPrefix(cdecl, decl) + FuncDeclMangleIdent(decl)+TransArgs( args,decl, lvar )
@@ -1234,7 +1234,7 @@ t:+"NULLNULLNULL"
 							End If
 							End If
 	
 	
 							If cdecl.IsInterface() And Not equalsBuiltInFunc(cdecl, decl) Then
 							If cdecl.IsInterface() And Not equalsBuiltInFunc(cdecl, decl) Then
-								Local ifc:String = Bra("(struct " + cdecl.munged + "_methods*)" + Bra("bbObjectInterface(" + obj + lvarInit + ", " + "&" + cdecl.munged + "_ifc)"))
+								Local ifc:String = Bra("(struct " + cdecl.munged + "_methods*)" + Bra("bbObjectInterface((BBObject*)" + obj + lvarInit + ", " + "(BBInterface*)&" + cdecl.munged + "_ifc)"))
 								Return ifc + "->" + TransFuncPrefix(cdecl, decl) + FuncDeclMangleIdent(decl)+TransArgs( args,decl, lvar )
 								Return ifc + "->" + TransFuncPrefix(cdecl, decl) + FuncDeclMangleIdent(decl)+TransArgs( args,decl, lvar )
 							Else
 							Else
 								Local class:String = Bra("(" + obj + lvarInit + ")->clas" + tSuper)
 								Local class:String = Bra("(" + obj + lvarInit + ")->clas" + tSuper)
@@ -1295,7 +1295,7 @@ t:+"NULLNULLNULL"
 		
 		
 									If cdecl.IsInterface() And Not equalsBuiltInFunc(cdecl, decl) Then
 									If cdecl.IsInterface() And Not equalsBuiltInFunc(cdecl, decl) Then
 										Local obj:String = Bra(TransObject(cdecl))
 										Local obj:String = Bra(TransObject(cdecl))
-										Local ifc:String = Bra("(struct " + cdecl.munged + "_methods*)" + Bra("bbObjectInterface(" + obj + lvarInit + ", " + "&" + cdecl.munged + "_ifc)"))
+										Local ifc:String = Bra("(struct " + cdecl.munged + "_methods*)" + Bra("bbObjectInterface((BBObject*)" + obj + lvarInit + ", " + "(BBInterface*)&" + cdecl.munged + "_ifc)"))
 										Return ifc + "->" + TransFuncPrefix(cdecl, decl) + FuncDeclMangleIdent(decl)+TransArgs( args,decl, lvar )
 										Return ifc + "->" + TransFuncPrefix(cdecl, decl) + FuncDeclMangleIdent(decl)+TransArgs( args,decl, lvar )
 									Else
 									Else
 										Local class:String = Bra("(" + obj + lvarInit + ")->clas" + tSuper)
 										Local class:String = Bra("(" + obj + lvarInit + ")->clas" + tSuper)
@@ -1393,7 +1393,7 @@ t:+"NULLNULLNULL"
 							End If
 							End If
 							If cdecl.IsInterface() And Not equalsBuiltInFunc(cdecl, decl) Then
 							If cdecl.IsInterface() And Not equalsBuiltInFunc(cdecl, decl) Then
 								Local obj:String = Bra(TransObject(cdecl))
 								Local obj:String = Bra(TransObject(cdecl))
-								Local ifc:String = Bra("(struct " + cdecl.munged + "_methods*)" + Bra("bbObjectInterface(" + obj + lvarInit + ", " + "&" + cdecl.munged + "_ifc)"))
+								Local ifc:String = Bra("(struct " + cdecl.munged + "_methods*)" + Bra("bbObjectInterface((BBObject*)" + obj + lvarInit + ", " + "(BBInterface*)&" + cdecl.munged + "_ifc)"))
 								Return ifc + "->" + TransFuncPrefix(cdecl, decl) + FuncDeclMangleIdent(decl)+TransArgs( args,decl, lvar )
 								Return ifc + "->" + TransFuncPrefix(cdecl, decl) + FuncDeclMangleIdent(decl)+TransArgs( args,decl, lvar )
 							Else
 							Else
 								Local obj:String = lvarInit + "->clas" + tSuper
 								Local obj:String = lvarInit + "->clas" + tSuper
@@ -1455,7 +1455,7 @@ t:+"NULLNULLNULL"
 								'Local cdecl:TClassDecl = TClassDecl(decl.scope)
 								'Local cdecl:TClassDecl = TClassDecl(decl.scope)
 		
 		
 								If cdecl And (cdecl.IsInterface() And Not equalsBuiltInFunc(cdecl, decl)) Then
 								If cdecl And (cdecl.IsInterface() And Not equalsBuiltInFunc(cdecl, decl)) Then
-									Local ifc:String = Bra("(struct " + cdecl.munged + "_methods*)" + Bra("bbObjectInterface(" + obj + lvarInit + ", " + "&" + cdecl.munged + "_ifc)"))
+									Local ifc:String = Bra("(struct " + cdecl.munged + "_methods*)" + Bra("bbObjectInterface((BBObject*)" + obj + lvarInit + ", " + "(BBInterface*)&" + cdecl.munged + "_ifc)"))
 									Return ifc + "->" + TransFuncPrefix(cdecl, decl) + FuncDeclMangleIdent(decl)+TransArgs( args,decl, lvar )
 									Return ifc + "->" + TransFuncPrefix(cdecl, decl) + FuncDeclMangleIdent(decl)+TransArgs( args,decl, lvar )
 								Else					
 								Else					
 									Local class:String = Bra(lvarInit + "->clas" + tSuper)
 									Local class:String = Bra(lvarInit + "->clas" + tSuper)
@@ -2309,7 +2309,7 @@ t:+"NULLNULLNULL"
 				End If
 				End If
 				If TNullType( src ) Return "&bbNullObject"
 				If TNullType( src ) Return "&bbNullObject"
 				If TObjectType(dst).classDecl.IsInterface() Then
 				If TObjectType(dst).classDecl.IsInterface() Then
-					Return Bra(Bra(TransObject(TObjectType(dst).classDecl)) + "bbInterfaceDowncast" + Bra(t + ",&" + TObjectType(dst).classDecl.munged + "_ifc"))
+					Return Bra(Bra(TransObject(TObjectType(dst).classDecl)) + "bbInterfaceDowncast" + Bra("(BBObject*)" +t + ",(BBInterface*)&" + TObjectType(dst).classDecl.munged + "_ifc"))
 				Else
 				Else
 					' no need to downcast to BBObject, as all objects extend it...
 					' no need to downcast to BBObject, as all objects extend it...
 					If TObjectType( dst ).classDecl.ident = "Object" Then
 					If TObjectType( dst ).classDecl.ident = "Object" Then
@@ -2759,7 +2759,7 @@ t:+"NULLNULLNULL"
 					Emit TransType(catchStmt.init.ty, catchStmt.init.munged) + " " + catchStmt.init.munged + "=(BBARRAY)ex;" 
 					Emit TransType(catchStmt.init.ty, catchStmt.init.munged) + " " + catchStmt.init.munged + "=(BBARRAY)ex;" 
 				Else If TObjectType(catchStmt.init.ty) Then
 				Else If TObjectType(catchStmt.init.ty) Then
 					If TObjectType(catchStmt.init.ty).classDecl.IsInterface() Then
 					If TObjectType(catchStmt.init.ty).classDecl.IsInterface() Then
-						Emit s + "if (bbInterfaceDowncast(ex,&" + TObjectType(catchStmt.init.ty).classDecl.munged + "_ifc) != &bbNullObject) {"
+						Emit s + "if (bbInterfaceDowncast((BBObject*)ex,(BBInterface*)&" + TObjectType(catchStmt.init.ty).classDecl.munged + "_ifc) != &bbNullObject) {"
 					Else
 					Else
 						Emit s + "if (bbObjectDowncast((BBOBJECT)ex,(BBClass*)&" + TObjectType(catchStmt.init.ty).classDecl.munged + ") != &bbNullObject) {"
 						Emit s + "if (bbObjectDowncast((BBOBJECT)ex,(BBClass*)&" + TObjectType(catchStmt.init.ty).classDecl.munged + ") != &bbNullObject) {"
 					End If
 					End If