Przeglądaj źródła

Code refactoring and remove unused variables

mingodad 9 lat temu
rodzic
commit
4f29d94a68

+ 2 - 2
SquiLu-ext/sq_libclang.cpp

@@ -221,7 +221,7 @@ static SQRESULT sq_libclang_releasehook(SQUserPointer p, SQInteger size, HSQUIRR
 
 static SQRESULT sq_libclang_constructor(HSQUIRRELVM v)
 {
-    SQ_FUNC_VARS_NO_TOP(v);
+    //SQ_FUNC_VARS_NO_TOP(v);
     if(!load_dynamicLib()) return sq_throwerror(v, _SC("Failed to load libclang !"));
 
     MyLibClang *self = (MyLibClang *)sq_malloc(sizeof(MyLibClang));
@@ -253,7 +253,7 @@ static void call_visitor_cb(MyLibClang *self, const SQChar *sig, ...)
     //sq_pushobject(v, self->busy_udata);
     va_list vl;
     va_start(vl, sig);
-    SQRESULT rc = sq_call_va_vl(v, SQFalse, -1, NULL, 0, sig, vl);
+    /*SQRESULT rc =*/ sq_call_va_vl(v, SQFalse, -1, NULL, 0, sig, vl);
     va_end(vl);
 
     sq_settop(v, top);

+ 2 - 2
SquiLu-ext/sq_postgresql.cpp

@@ -955,9 +955,9 @@ static SQRESULT sq_pgsql_version(HSQUIRRELVM v){
 static int
  inv_read =  0x40000,
  inv_write = 0x20000,
- invalidoid = 0,
+ //invalidoid = 0,
  inv_seek_set = 0,
- inv_seek_curr = 1,
+ //inv_seek_curr = 1,
  inv_seek_end = 2;
 
 static SQRESULT sq_pgsql_get_blob_field(HSQUIRRELVM v){

+ 1 - 1
SquiLu-ext/sq_sqlite3.cpp

@@ -1261,7 +1261,7 @@ static SQRESULT sq_sqlite3_stmt_asSleArray(HSQUIRRELVM v)
 
 static SQRESULT sq_sqlite3_stmt_all_blobs_size(HSQUIRRELVM v)
 {
-    SQ_FUNC_VARS(v);
+    SQ_FUNC_VARS_NO_TOP(v);
     GET_sqlite3_stmt_INSTANCE();
     int total_size = 0, col_count = sqlite3_column_count(self);
     for(int i=0; i < col_count; ++i)

+ 12 - 0
SquiLu/include/sqconfig.h

@@ -64,9 +64,15 @@ typedef unsigned wchar_t SQUChar;
 #ifdef _WIN32
 #define scsprintf   _snwprintf
 #define scvfprintf	_vfwprintf
+#define scfprintf fwprintf
+#define scvprintf vfwprintf
+#define scfopen	_wfopen
 #else
 #define scsprintf   swprintf
 #define scvfprintf	vfwprintf
+#define scfprintf fwprintf
+#define scvprintf vfwprintf
+#define scfopen	wfopen
 #endif
 #define scstrlen    wcslen
 #define scstrtod    wcstod
@@ -115,9 +121,15 @@ typedef unsigned char SQUChar;
 #ifdef _MSC_VER
 #define scsprintf   _snprintf
 #define scvfprintf	_vfprintf
+#define scfprintf fprintf
+#define scvprintf vfprintf
+#define scfopen	fopen
 #else
 #define scsprintf   snprintf
 #define scvfprintf	vfprintf
+#define scfprintf fprintf
+#define scvprintf vfprintf
+#define scfopen	fopen
 #endif
 #define scstrlen    strlen
 #define scstrtod    strtod

+ 3 - 12
SquiLu/sq/sq.c

@@ -17,15 +17,6 @@
 #include <sqstdstring.h>
 #include <sqstdaux.h>
 
-#ifdef SQUNICODE
-#define scfprintf fwprintf
-#define scfopen	_wfopen
-#define scvprintf vfwprintf
-#else
-#define scfprintf fprintf
-#define scfopen	fopen
-#define scvprintf vfprintf
-#endif
 
 #define MAXINPUT 1024
 
@@ -110,7 +101,7 @@ void PrintUsage()
 
 void loadDefaultScript(HSQUIRRELVM v, const char *script)
 {
-    FILE *fb = fopen(script, "rb");
+    FILE *fb = scfopen(script, "rb");
     if (!fb) return;
     fclose(fb);
 
@@ -371,7 +362,7 @@ static SQInteger LoadFrozenScript0(HSQUIRRELVM v, const SQChar* filename, int on
     SQInteger retval;
     // lots of debugging to make sure that everything is ok
     //printf("%s\n", filename);
-    FILE *f = fopen(filename, "rb");
+    FILE *f = scfopen(filename, "rb");
 
     if (!f) return -1;
 
@@ -467,7 +458,7 @@ static SQInteger LoadFrozenScript(HSQUIRRELVM v, const SQChar* filename, int onl
 #ifndef SQUILU_ALONE
     // lots of debugging to make sure that everything is ok
     //printf("%s\n", filename);
-    FILE *f = fopen(filename, "rb");
+    FILE *f = scfopen(filename, "rb");
 
     if (!f) return -1;
 

+ 1 - 5
SquiLu/sqstdlib/sqstdio.cpp

@@ -11,11 +11,7 @@ static const SQChar  SQSTD_FILE_TYPE_TAG[] = _SC("std_stream_file");
 //basic API
 SQFILE sqstd_fopen(const SQChar *filename ,const SQChar *mode)
 {
-#ifndef SQUNICODE
-	return (SQFILE)fopen(filename,mode);
-#else
-	return (SQFILE)_wfopen(filename,mode);
-#endif
+	return (SQFILE)scfopen(filename,mode);
 }
 
 SQInteger sqstd_fread(void* buffer, SQInteger size, SQInteger count, SQFILE file)

+ 3 - 57
SquiLu/squilu.cbp

@@ -942,44 +942,8 @@
 			<Option target="Debug 64bits static Library" />
 			<Option target="Temp Code FLTK 64bits" />
 		</Unit>
-		<Unit filename="../SquiLu-ext/fpdf.cpp">
-			<Option target="Debug" />
-			<Option target="Release" />
-			<Option target="Release clang" />
-			<Option target="Release win32" />
-			<Option target="Release FLTK" />
-			<Option target="Debug FLTK" />
-			<Option target="Release FLTK win32" />
-			<Option target="Release FLTK win32 no console" />
-			<Option target="Release wince" />
-			<Option target="Release 64bits" />
-			<Option target="Release FLTK 64bits" />
-			<Option target="Debug 64bits" />
-			<Option target="Release FLTK 64bits Lib" />
-			<Option target="Release FLTK 64bits Computed Gotos" />
-			<Option target="Release 64bits static Library" />
-			<Option target="Debug FLTK 64bits" />
-			<Option target="Debug FLTK 64bits asan" />
-		</Unit>
-		<Unit filename="../SquiLu-ext/fpdf.h">
-			<Option target="Debug" />
-			<Option target="Release" />
-			<Option target="Release clang" />
-			<Option target="Release win32" />
-			<Option target="Release FLTK" />
-			<Option target="Debug FLTK" />
-			<Option target="Release FLTK win32" />
-			<Option target="Release FLTK win32 no console" />
-			<Option target="Release wince" />
-			<Option target="Release 64bits" />
-			<Option target="Release FLTK 64bits" />
-			<Option target="Debug 64bits" />
-			<Option target="Release FLTK 64bits Lib" />
-			<Option target="Release FLTK 64bits Computed Gotos" />
-			<Option target="Release 64bits static Library" />
-			<Option target="Debug FLTK 64bits" />
-			<Option target="Debug FLTK 64bits asan" />
-		</Unit>
+		<Unit filename="../SquiLu-ext/fpdf.cpp" />
+		<Unit filename="../SquiLu-ext/fpdf.h" />
 		<Unit filename="../SquiLu-ext/lua_socket.cpp">
 			<Option target="Debug" />
 			<Option target="Release" />
@@ -1199,25 +1163,7 @@
 			<Option target="Debug 64bits static Library" />
 			<Option target="Temp Code FLTK 64bits" />
 		</Unit>
-		<Unit filename="../SquiLu-ext/sq_fpdf.cpp">
-			<Option target="Debug" />
-			<Option target="Release" />
-			<Option target="Release clang" />
-			<Option target="Release win32" />
-			<Option target="Release FLTK" />
-			<Option target="Debug FLTK" />
-			<Option target="Release FLTK win32" />
-			<Option target="Release FLTK win32 no console" />
-			<Option target="Release wince" />
-			<Option target="Release 64bits" />
-			<Option target="Release FLTK 64bits" />
-			<Option target="Debug 64bits" />
-			<Option target="Release FLTK 64bits Lib" />
-			<Option target="Release FLTK 64bits Computed Gotos" />
-			<Option target="Release 64bits static Library" />
-			<Option target="Debug FLTK 64bits" />
-			<Option target="Debug FLTK 64bits asan" />
-		</Unit>
+		<Unit filename="../SquiLu-ext/sq_fpdf.cpp" />
 		<Unit filename="../SquiLu-ext/sq_fs.c">
 			<Option compilerVar="CC" />
 			<Option target="Debug" />