diff --git a/code/cfile/cfile.cpp b/code/cfile/cfile.cpp index 615cb60199..a6e7d2db31 100644 --- a/code/cfile/cfile.cpp +++ b/code/cfile/cfile.cpp @@ -1038,7 +1038,8 @@ CFILE *cfopen(char *file_path, char *mode, int type, int dir_type, bool localize //Copies all 'mode' characters over, except for t, and adds b if needed. unsigned int max = sizeof(happy_mode) - 2; //space for null and 'b' bool need_b = true; - for(unsigned int i = 0; i < strlen(mode); i++) + unsigned int i; + for( i = 0; i < strlen(mode); i++) { if(i > max) break; diff --git a/code/parse/lua.cpp b/code/parse/lua.cpp index fcdc15801b..1c6dbcd848 100644 --- a/code/parse/lua.cpp +++ b/code/parse/lua.cpp @@ -1829,6 +1829,8 @@ ADE_INDEXER(l_ShipOrders, "number Index/string TextureFilename", "Array of ship object_h *objh = NULL; char *s = NULL; order_h *oh = NULL; + int i; + if (!ade_get_args(L, "os|o", l_ShipOrders.GetPtr(&objh), &s, l_Order.GetPtr(&oh))) return ade_set_error(L, "o", l_Order.Set(order_h())); @@ -1845,7 +1847,7 @@ ADE_INDEXER(l_ShipOrders, "number Index/string TextureFilename", "Array of ship return ade_set_error(L, "o", l_Order.Set(order_h())); int num = 0; - for(int i = 0; i < MAX_AI_GOALS; i++) + for(i = 0; i < MAX_AI_GOALS; i++) { if(aip->goals[i].ai_mode != AI_GOAL_NONE) {