SF.net SVN: mod-aspdotnet: [201] mod_aspdotnet2/trunk/Apache.Web
Brought to you by:
wrowe
From: <wr...@us...> - 2007-08-15 09:19:51
|
Revision: 201 http://mod-aspdotnet.svn.sourceforge.net/mod-aspdotnet/?rev=201&view=rev Author: wrowe Date: 2007-08-15 02:19:49 -0700 (Wed, 15 Aug 2007) Log Message: ----------- safe_cast is preferable to dynamic_cast in this case. Modified Paths: -------------- mod_aspdotnet2/trunk/Apache.Web/Host.h mod_aspdotnet2/trunk/Apache.Web/HostFactory.h mod_aspdotnet2/trunk/Apache.Web/WorkerRequest.cpp Modified: mod_aspdotnet2/trunk/Apache.Web/Host.h =================================================================== --- mod_aspdotnet2/trunk/Apache.Web/Host.h 2007-08-15 07:18:36 UTC (rev 200) +++ mod_aspdotnet2/trunk/Apache.Web/Host.h 2007-08-15 09:19:49 UTC (rev 201) @@ -59,7 +59,7 @@ virtual Object ^ InitializeLifetimeService() override { - ILease ^lease = dynamic_cast<ILease ^> + ILease ^lease = safe_cast<ILease ^> (MarshalByRefObject::InitializeLifetimeService()); if (lease->CurrentState == System::Runtime::Remoting::Lifetime::LeaseState::Initial) { Modified: mod_aspdotnet2/trunk/Apache.Web/HostFactory.h =================================================================== --- mod_aspdotnet2/trunk/Apache.Web/HostFactory.h 2007-08-15 07:18:36 UTC (rev 200) +++ mod_aspdotnet2/trunk/Apache.Web/HostFactory.h 2007-08-15 09:19:49 UTC (rev 201) @@ -65,7 +65,7 @@ virtual Object ^ InitializeLifetimeService() override { - ILease ^lease = dynamic_cast<ILease^> + ILease ^lease = safe_cast<ILease^> (MarshalByRefObject::InitializeLifetimeService()); if (lease->CurrentState == System::Runtime::Remoting::Lifetime::LeaseState::Initial) { @@ -117,15 +117,15 @@ try { newHost = ApplicationHost::CreateApplicationHost(hostType, - dynamic_cast<String^>(hostURI[HostKey]), - dynamic_cast<String^>(hostDir[HostKey])); + safe_cast<String^>(hostURI[HostKey]), + safe_cast<String^>(hostDir[HostKey])); hostObj[HostKey] = newHost; if (newHost) { Host ^host = dynamic_cast<Host^>(newHost); host->Configure( - dynamic_cast<String^>(hostURI[HostKey]), - dynamic_cast<String^>(hostDir[HostKey]), + safe_cast<String^>(hostURI[HostKey]), + safe_cast<String^>(hostDir[HostKey]), this, HostKey); return true; } @@ -180,9 +180,9 @@ if (!ConnectHost(newHostKey)) { server_rec *s = (server_rec *)ServerRecPtr; String ^msg = String::Concat(L"Mount failure creating host ", - dynamic_cast<String^>(hostURI[newHostKey]), + safe_cast<String^>(hostURI[newHostKey]), L" mapped to ", - dynamic_cast<String^>(hostDir[newHostKey])); + safe_cast<String^>(hostDir[newHostKey])); LogServerError(msg, APLOG_ERR, 0, s); newHostKey = -1; } @@ -197,7 +197,7 @@ Object ^obj = hostObj[HostKey]; if (obj != nullptr) { try { - Host ^host = dynamic_cast<Host^>(obj); + Host ^host = safe_cast<Host^>(obj); int status = host->HandleRequest(ReqRecordPtr); return status; } @@ -223,9 +223,9 @@ } msg = String::Concat(L"Restarting host of ", - dynamic_cast<String^>(hostURI[HostKey]), + safe_cast<String^>(hostURI[HostKey]), L" mapped to ", - dynamic_cast<String^>(hostDir[HostKey])); + safe_cast<String^>(hostDir[HostKey])); LogServerError(msg, APLOG_INFO, 0, rr->server); int welocked = 0; @@ -253,9 +253,9 @@ Threading::Monitor::Exit(this); msg = String::Concat(L"Mount failed to connect ", L"to the restarting host ", - dynamic_cast<String^>(hostURI[HostKey]), + safe_cast<String^>(hostURI[HostKey]), L" mapped to ", - dynamic_cast<String^>(hostDir[HostKey])); + safe_cast<String^>(hostDir[HostKey])); LogServerError(msg, APLOG_ERR, 0, rr->server); return 500; } @@ -264,9 +264,9 @@ Threading::Monitor::Exit(this); msg = String::Concat(L"Mount failed to query ", L"the restarting host ", - dynamic_cast<String^>(hostURI[HostKey]), + safe_cast<String^>(hostURI[HostKey]), L" mapped to ", - dynamic_cast<String^>(hostDir[HostKey])); + safe_cast<String^>(hostDir[HostKey])); LogServerError(msg, APLOG_ERR, 0, rr->server); return 500; } @@ -278,9 +278,9 @@ Threading::Monitor::Exit(this); } msg = String::Concat(L"Mount failure restarting host ", - dynamic_cast<String^>(hostURI[HostKey]), + safe_cast<String^>(hostURI[HostKey]), L" mapped to ", - dynamic_cast<String^>(hostDir[HostKey])); + safe_cast<String^>(hostDir[HostKey])); LogServerError(msg, APLOG_ERR, 0, rr->server); msg = String::Concat(L"Mount failure exception restarting " L"host; ", e->ToString()); @@ -289,7 +289,7 @@ } try { - Host ^host = dynamic_cast<Host^>(obj); + Host ^host = safe_cast<Host^>(obj); int status = host->HandleRequest(ReqRecordPtr); return status; } Modified: mod_aspdotnet2/trunk/Apache.Web/WorkerRequest.cpp =================================================================== --- mod_aspdotnet2/trunk/Apache.Web/WorkerRequest.cpp 2007-08-15 07:18:36 UTC (rev 200) +++ mod_aspdotnet2/trunk/Apache.Web/WorkerRequest.cpp 2007-08-15 09:19:49 UTC (rev 201) @@ -241,8 +241,7 @@ #endif return; } - const char *buf_data - = static_cast<const char *>(data.ToPointer()); + const char *buf_data = static_cast<const char *>(data.ToPointer()); #ifdef _DEBUG String ^res = String::Concat(L"SendResponseFromMemory: passed ", This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |