You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-user@logging.apache.org by Iwan Tomlow <iw...@seagha.com> on 2005/08/10 15:26:56 UTC

Problem with backslashes in File

Hi,

I noticed a problem where my log4cxx-enabled apps just seemed to be hanging
infinitely on startup.
It turned out that some of the log filenames (user configurable) where being
passed with backslashes (Windows environment), and I traced it to what looks
like a bug in File::convertBackSlashes:

std::string File::convertBackSlashes(const std::string& src) {
  std::string::size_type pos = src.find('\\');
  if (pos == std::string::npos) {
    return src;
  }
  std::string mod(src);
  while(pos != std::string::npos) {
    mod[pos] = '/';
-    pos = src.find('\\');
+    pos = mod.find('\\');
  }
  return mod;
}

If it just keeps looking in the original source-string, it keeps finding the
same backslash over and over.

Kind regards,

-- Iwan Tomlow