From 5174d9cbd6acf116349a976430f1f3ae84bb7c82 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Mon, 21 Oct 2013 13:22:47 +0200 Subject: [PATCH] Fixed GetHTMLEscapedString() binding, removed obsolete memory function from API. --- source/Bindings.cpp | 39 +++------------------------------------ source/Bindings.h | 2 +- source/WebAdmin.cpp | 12 +----------- source/WebAdmin.h | 17 ++++++++--------- 4 files changed, 13 insertions(+), 57 deletions(-) diff --git a/source/Bindings.cpp b/source/Bindings.cpp index f12894298..69b70c9f4 100644 --- a/source/Bindings.cpp +++ b/source/Bindings.cpp @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 10/20/13 13:59:04. +** Generated automatically by tolua++-1.0.92 on 10/21/13 13:17:19. */ #ifndef __cplusplus @@ -19164,34 +19164,6 @@ static int tolua_set_sWebAdminPage_TabName(lua_State* tolua_S) } #endif //#ifndef TOLUA_DISABLE -/* method: GetMemoryUsage of class cWebAdmin */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWebAdmin_GetMemoryUsage00 -static int tolua_AllToLua_cWebAdmin_GetMemoryUsage00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cWebAdmin",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - { - int tolua_ret = (int) cWebAdmin::GetMemoryUsage(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetMemoryUsage'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - /* method: GetPage of class cWebAdmin */ #ifndef TOLUA_DISABLE_tolua_AllToLua_cWebAdmin_GetPage00 static int tolua_AllToLua_cWebAdmin_GetPage00(lua_State* tolua_S) @@ -19310,7 +19282,7 @@ static int tolua_AllToLua_cWebAdmin_GetHTMLEscapedString00(lua_State* tolua_S) #ifndef TOLUA_RELEASE tolua_Error tolua_err; if ( - !tolua_isusertype(tolua_S,1,"cWebAdmin",0,&tolua_err) || + !tolua_isusertable(tolua_S,1,"cWebAdmin",0,&tolua_err) || !tolua_iscppstring(tolua_S,2,0,&tolua_err) || !tolua_isnoobj(tolua_S,3,&tolua_err) ) @@ -19318,13 +19290,9 @@ static int tolua_AllToLua_cWebAdmin_GetHTMLEscapedString00(lua_State* tolua_S) else #endif { - cWebAdmin* self = (cWebAdmin*) tolua_tousertype(tolua_S,1,0); const AString a_Input = ((const AString) tolua_tocppstring(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetHTMLEscapedString'", NULL); -#endif { - AString tolua_ret = (AString) self->GetHTMLEscapedString(a_Input); + AString tolua_ret = (AString) cWebAdmin::GetHTMLEscapedString(a_Input); tolua_pushcppstring(tolua_S,(const char*)tolua_ret); tolua_pushcppstring(tolua_S,(const char*)a_Input); } @@ -31010,7 +30978,6 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S) tolua_endmodule(tolua_S); tolua_cclass(tolua_S,"cWebAdmin","cWebAdmin","cHTTPServer::cCallbacks",NULL); tolua_beginmodule(tolua_S,"cWebAdmin"); - tolua_function(tolua_S,"GetMemoryUsage",tolua_AllToLua_cWebAdmin_GetMemoryUsage00); tolua_function(tolua_S,"GetPage",tolua_AllToLua_cWebAdmin_GetPage00); tolua_function(tolua_S,"GetDefaultPage",tolua_AllToLua_cWebAdmin_GetDefaultPage00); tolua_function(tolua_S,"GetBaseURL",tolua_AllToLua_cWebAdmin_GetBaseURL00); diff --git a/source/Bindings.h b/source/Bindings.h index 1917ff10c..510091198 100644 --- a/source/Bindings.h +++ b/source/Bindings.h @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 10/20/13 13:59:05. +** Generated automatically by tolua++-1.0.92 on 10/21/13 13:17:20. */ /* Exported function */ diff --git a/source/WebAdmin.cpp b/source/WebAdmin.cpp index 3f9bc6c98..882969746 100644 --- a/source/WebAdmin.cpp +++ b/source/WebAdmin.cpp @@ -270,7 +270,7 @@ void cWebAdmin::HandleWebadminRequest(cHTTPConnection & a_Connection, cHTTPReque Content += "\n

Go back

"; } - int MemUsageKiB = GetMemoryUsage(); + int MemUsageKiB = cRoot::GetPhysicalRAMUsage(); if (MemUsageKiB > 0) { ReplaceString(Template, "{MEM}", Printf("%.02f", (double)MemUsageKiB / 1024)); @@ -446,16 +446,6 @@ AString cWebAdmin::GetBaseURL(const AStringVector & a_URLSplit) -int cWebAdmin::GetMemoryUsage(void) -{ - LOGWARNING("%s: This function is obsolete, use cRoot::GetPhysicalRAMUsage() or cRoot::GetVirtualRAMUsage() instead", __FUNCTION__); - return cRoot::GetPhysicalRAMUsage(); -} - - - - - void cWebAdmin::OnRequestBegun(cHTTPConnection & a_Connection, cHTTPRequest & a_Request) { const AString & URL = a_Request.GetURL(); diff --git a/source/WebAdmin.h b/source/WebAdmin.h index fbe6a6b4a..acd81ebfa 100644 --- a/source/WebAdmin.h +++ b/source/WebAdmin.h @@ -118,26 +118,25 @@ public: void RemovePlugin( cWebPlugin* a_Plugin ); // TODO: Convert this to the auto-locking callback mechanism used for looping players in worlds and such - PluginList GetPlugins() const { return m_Plugins; } // >> EXPORTED IN MANUALBINDINGS << + PluginList GetPlugins() const { return m_Plugins; } // >> EXPORTED IN MANUALBINDINGS << // tolua_begin - /// Returns the amount of currently used memory, in KiB, or -1 if it cannot be queried - static int GetMemoryUsage(void); - - sWebAdminPage GetPage(const HTTPRequest& a_Request); + sWebAdminPage GetPage(const HTTPRequest & a_Request); /// Returns the contents of the default page - the list of plugins and players AString GetDefaultPage(void); - AString GetBaseURL(const AString& a_URL); + /// Returns the prefix needed for making a link point to the webadmin root from the given URL ("../../../webadmin"-style) + AString GetBaseURL(const AString & a_URL); - // Escapes text passed into it, so it can be embedded into html. - AString GetHTMLEscapedString( const AString& a_Input ); + /// Escapes text passed into it, so it can be embedded into html. + static AString GetHTMLEscapedString(const AString & a_Input); // tolua_end - AString GetBaseURL(const AStringVector& a_URLSplit); + /// Returns the prefix needed for making a link point to the webadmin root from the given URL ("../../../webadmin"-style) + AString GetBaseURL(const AStringVector& a_URLSplit); protected: /// Common base class for request body data handlers