fixed bug in jpeg2000 decoding
[swftools.git] / lib / log.c
index 151b9ea..e75148f 100644 (file)
--- a/lib/log.c
+++ b/lib/log.c
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
-#ifdef __NT__
-#include "stdafx.h"
-#include <string.h>
 #include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+#ifdef WIN32
+//#include "stdafx.h"
 #include <malloc.h>
 #if _MSC_VER > 1000
 #pragma once
 #endif // _MSC_VER > 1000
 #else
 #include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
 #include <unistd.h>
 #endif
 
@@ -96,7 +94,7 @@ static char * logimportance[]= {"Fatal","Error","Warning","Notice","Verbose","De
 static int loglevels=7;
 static char * logimportance2[]= {"       ","FATAL  ","ERROR  ","WARNING","NOTICE ","VERBOSE","DEBUG  ", "TRACE  "};
 
-static inline void log(const char* logString)
+static inline void log_str(const char* logString)
 {
    char timebuffer[32];
    char* logBuffer;
@@ -191,7 +189,7 @@ void msg_str(const char* buf)
        if(x && (x-z)>maxloglevel)
                return;
     }
-    log(buf);
+    log_str(buf);
 }
 void msg(const char* format, ...)
 {
@@ -207,9 +205,9 @@ void msg(const char* format, ...)
                return;
     }
 
-    vsprintf(buf, format, arglist);
+    vsnprintf(buf, sizeof(buf)-1, format, arglist);
        va_end(arglist);
     strcat(buf, "\n");
-    log(buf);
+    log_str(buf);
 }