From 7584dacd39e1bc43e766a21550d39f039aa849bc Mon Sep 17 00:00:00 2001 From: kcwu Date: Sat, 12 Jan 2008 17:02:05 +0000 Subject: - fix warnings, eol-style - bbslua: fix "sitename" - bbslua: fix strip_ansi if argument more than 1 git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3829 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/bbslua.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'mbbsd') diff --git a/mbbsd/bbslua.c b/mbbsd/bbslua.c index dd1e2ded..52247a44 100644 --- a/mbbsd/bbslua.c +++ b/mbbsd/bbslua.c @@ -242,6 +242,7 @@ bl_moverel(lua_State* L) BLAPI_PROTO bl_clear(lua_State* L) { + (void)L; /* to avoid warnings */ clear(); return 0; } @@ -249,6 +250,7 @@ bl_clear(lua_State* L) BLAPI_PROTO bl_clrtoeol(lua_State* L) { + (void)L; /* to avoid warnings */ clrtoeol(); return 0; } @@ -256,6 +258,7 @@ bl_clrtoeol(lua_State* L) BLAPI_PROTO bl_clrtobot(lua_State* L) { + (void)L; /* to avoid warnings */ clrtobot(); return 0; } @@ -263,6 +266,7 @@ bl_clrtobot(lua_State* L) BLAPI_PROTO bl_refresh(lua_State* L) { + (void)L; /* to avoid warnings */ // refresh(); // Seems like that most people don't understand the relationship // between refresh() and input queue, so let's force update here. @@ -293,9 +297,9 @@ bl_rect(lua_State *L) const char *title = NULL; if (n > 0) - rows = lua_tonumber(L, 1); + rows = lua_tointeger(L, 1); if (n > 1) - cols = lua_tonumber(L, 2); + cols = lua_tointeger(L, 2); if (n > 2) title = lua_tostring(L, 3); if (rows <= 0 || cols <= 0) @@ -431,10 +435,8 @@ bl_sleep(lua_State *L) #else // !_WIN32 { struct timeval tp, tdest; - struct timezone tz; - memset(&tz, 0, sizeof(tz)); - gettimeofday(&tp, &tz); + gettimeofday(&tp, NULL); // nus is the destination time nus = bl_tv2double(&tp) + us; @@ -456,7 +458,7 @@ bl_sleep(lua_State *L) } // check time - gettimeofday(&tp, &tz); + gettimeofday(&tp, NULL); } } #endif // !_WIN32 @@ -538,7 +540,7 @@ bl_strip_ansi(lua_State *L) s2 = (char*) lua_newuserdata(L, os2); strip_ansi(s2, s, STRIP_ALL); lua_pushstring(L, s2); - lua_remove(L, 2); + lua_remove(L, -2); return 1; } @@ -580,24 +582,22 @@ bl_clock(lua_State *L) { double d = 0; -#ifdef _WIN32 - +#ifdef _WIN32 + // XXX this is a fast hack because we don't want to do 64bit calculation. SYSTEMTIME st; - GetSystemTime(&st); - syncnow(); - // XXX the may be some latency between our GetSystemTime and syncnow. - // So build again the "second" part. - d = (int)((now / 60) * 60); - d += st.wSecond; - d += (st.wMilliseconds / 1000.0f); - + GetSystemTime(&st); + syncnow(); + // XXX the may be some latency between our GetSystemTime and syncnow. + // So build again the "second" part. + d = (int)((now / 60) * 60); + d += st.wSecond; + d += (st.wMilliseconds / 1000.0f); + #else // !_WIN32 struct timeval tp; - struct timezone tz; - memset(&tz, 0, sizeof(tz)); - gettimeofday(&tp, &tz); + gettimeofday(&tp, NULL); d = bl_tv2double(&tp); #endif // !_WIN32 @@ -703,7 +703,7 @@ typedef struct bbsluaL_RegNum { static const bbsluaL_RegStr bbsluaStrs[] = { {"ESC", ESC_STR}, {"ANSI_RESET", ANSI_RESET}, - {"sitename" BBSNAME}, + {"sitename", BBSNAME}, {NULL, NULL}, }; -- cgit v1.2.3