ecere/File: fix for handling a null pointer from File::Printf; ide/CodeEditor: Fixes...
authorJerome St-Louis <jerome@ecere.com>
Tue, 31 Jul 2012 03:29:07 +0000 (23:29 -0400)
committerJerome St-Louis <jerome@ecere.com>
Tue, 31 Jul 2012 03:29:07 +0000 (23:29 -0400)
ecere/src/sys/File.ec
ide/src/designer/CodeEditor.ec

index 0fa009d..149a356 100644 (file)
@@ -565,13 +565,16 @@ public:
    int Printf(char * format, ...)
    {
       int result = 0;
-      char text[MAX_F_STRING];
-      va_list args;
-      va_start(args, format);
-      vsprintf(text, format, args);
-      if(Puts(text))
-         result = strlen(text);
-      va_end(args);
+      if(format)
+      {
+         char text[MAX_F_STRING];
+         va_list args;
+         va_start(args, format);
+         vsprintf(text, format, args);
+         if(Puts(text))
+            result = strlen(text);
+         va_end(args);
+      }
       return result;
    }
 
index fca3fd6..b07d2c3 100644 (file)
@@ -4182,7 +4182,8 @@ class CodeEditor : Window
                      for(param = dataType.params.first; param; param = param.next)
                      {
                         if(param.prev) f.Printf(", ");
-                        f.Printf(param.name);
+                        if(param.kind != voidType)
+                           f.Printf(param.name);
                      }
                      f.Printf(");\n");
                   }
@@ -4771,7 +4772,7 @@ class CodeEditor : Window
                      for(param = dataType.params.first; param; param = param.next)
                      {
                         if(param.prev) f.Printf(", ");
-                        if(param.kind != voidType) 
+                        if(param.kind != voidType)
                            f.Printf(param.name);
                      }
                      f.Printf(");\n");
@@ -6157,7 +6158,7 @@ class CodeEditor : Window
 
          f.Printf("\n");
 
-         //if(test._class._vTbl[method.vid] == moduleClass._vTbl[__ecereVMethodID___ecereNameSpace__ecere__com__Module_OnLoad]) // Temp Check for DefaultFunction
+         if(!_class || (isInstance ? _class : _class.base)._vTbl[method.vid] == moduleClass._vTbl[__ecereVMethodID___ecereNameSpace__ecere__com__Module_OnLoad]) // Temp Check for DefaultFunction
          {
             if(returnType && returnType.kind == classType && !strcmp(returnType._class.string, "bool"))
             {
@@ -6170,20 +6171,21 @@ class CodeEditor : Window
                f.Printf("      return 0;\n");
             }
          }
-         /*else
+         else
          {
+            if(extraIndent) f.Printf("   ");
             f.Printf("      ");
             if(returnType.kind != voidType)
                f.Printf("return ");
-            f.Printf("%s::%s(this", classDef.base.name, method.name);
+            f.Printf("%s::%s(", isInstance ? _class.name : _class.base.name, method.name);
             for(param = dataType.params.first; param; param = param.next)
             {
-               f.Printf(", ");
-               f.Printf(param.name);
+               if(param.prev) f.Printf(", ");
+               if(param.kind != voidType)
+                  f.Printf(param.name);
             }
             f.Printf(");\n");
-         }*/
-         
+         }
       }
 
       if(extraIndent) f.Printf("   ");