From: José Fonseca Date: Mon, 31 Oct 2011 13:58:32 +0000 (+0000) Subject: More os::Path fixes. X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=225e4378e1bad2f70e3187cb84e158583ede692e;p=apitrace More os::Path fixes. --- diff --git a/common/os_path.hpp b/common/os_path.hpp index 23b87d1..353a63a 100644 --- a/common/os_path.hpp +++ b/common/os_path.hpp @@ -72,6 +72,8 @@ protected: Buffer::iterator rfind(char c) { Buffer::iterator it = buffer.end(); + assert(it != buffer.begin()); + --it; // skill null while (it != buffer.begin()) { --it; if (*it == c) { @@ -120,7 +122,7 @@ public: void trimExtension(void) { Buffer::iterator dot = rfind('.'); if (dot != buffer.end()) { - buffer.erase(dot, buffer.end()); + buffer.erase(dot, buffer.end() - 1); } } diff --git a/common/trace_writer_local.cpp b/common/trace_writer_local.cpp index 350a130..2b1ef43 100644 --- a/common/trace_writer_local.cpp +++ b/common/trace_writer_local.cpp @@ -99,6 +99,7 @@ LocalWriter::open(void) { else szFileName = os::Path::format("%s.trace", prefix.str()); + lpFileName = szFileName; file = fopen(lpFileName, "rb"); if (file == NULL) break; @@ -107,8 +108,6 @@ LocalWriter::open(void) { ++dwCounter; } - - lpFileName = szFileName; } os::log("apitrace: tracing to %s\n", lpFileName);