You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-dev@logging.apache.org by ca...@apache.org on 2008/01/25 22:18:00 UTC
svn commit: r615344 - /logging/log4cxx/trunk/src/main/cpp/locationinfo.cpp
Author: carnold
Date: Fri Jan 25 13:17:59 2008
New Revision: 615344
URL: http://svn.apache.org/viewvc?rev=615344&view=rev
Log:
LOGCXX-142: Tweak location info for global methods
Modified:
logging/log4cxx/trunk/src/main/cpp/locationinfo.cpp
Modified: logging/log4cxx/trunk/src/main/cpp/locationinfo.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/locationinfo.cpp?rev=615344&r1=615343&r2=615344&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/cpp/locationinfo.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/locationinfo.cpp Fri Jan 25 13:17:59 2008
@@ -164,12 +164,20 @@
// construct Java-like fullInfo (replace "::" with ".")
//
std::string fullInfo(methodName);
- size_t classSep = fullInfo.find("::");
- if (classSep != std::string::npos) {
- fullInfo.replace(classSep, 2, ".");
- size_t space = fullInfo.rfind(' ', classSep);
- if (space != std::string::npos) {
+ size_t openParen = fullInfo.find('(');
+ if (openParen != std::string::npos) {
+ size_t space = fullInfo.find(' ');
+ if (space != std::string::npos && space < openParen) {
fullInfo.erase(0, space + 1);
+ }
+ }
+ openParen = fullInfo.find('(');
+ if (openParen != std::string::npos) {
+ size_t classSep = fullInfo.rfind("::", openParen);
+ if (classSep != std::string::npos) {
+ fullInfo.replace(classSep, 2, ".");
+ } else {
+ fullInfo.insert(0, ".");
}
}
fullInfo.append(1, '(');