]> git.cworth.org Git - apitrace/commitdiff
Cleanup and generalize os string class.
authorJosé Fonseca <jose.r.fonseca@gmail.com>
Thu, 24 Nov 2011 20:09:41 +0000 (20:09 +0000)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Thu, 24 Nov 2011 20:09:41 +0000 (20:09 +0000)
cli/cli_diff.cpp
cli/cli_diff_images.cpp
cli/cli_diff_state.cpp
common/os_path.hpp [deleted file]
common/os_posix.cpp
common/os_string.hpp [new file with mode: 0644]
common/os_win32.cpp
common/trace_tools.hpp
common/trace_tools_trace.cpp
common/trace_writer_local.cpp
glretrace_main.cpp

index 4d249739e373fd4e6213db4a828c2fad89ccc325..d9d62576d197d2715441e8c89900b96d73b9c3ce 100644 (file)
@@ -29,7 +29,7 @@
 #include <iostream>
 
 #include "cli.hpp"
-#include "os_path.hpp"
+#include "os_string.hpp"
 #include "os_process.hpp"
 #include "trace_tools.hpp"
 
@@ -83,7 +83,7 @@ command(int argc, char *argv[])
 
 #define CLI_DIFF_TRACEDIFF_COMMAND "tracediff.sh"
 
-    os::Path command = trace::findFile("scripts/" CLI_DIFF_TRACEDIFF_COMMAND,
+    os::String command = trace::findFile("scripts/" CLI_DIFF_TRACEDIFF_COMMAND,
                  APITRACE_SCRIPTS_INSTALL_DIR "/" CLI_DIFF_TRACEDIFF_COMMAND,
                                        true);
 
@@ -98,7 +98,7 @@ command(int argc, char *argv[])
     std::cerr << "The 'apitrace diff' command is not yet supported on this O/S.\n";
     return 1;
 #else
-    os::Path apitrace = os::getProcessName();
+    os::String apitrace = os::getProcessName();
     setenv("APITRACE", apitrace.str(), 1);
 
     return os::execute(args);
index 390174c237bd5c05cd61e740dfa9cedbec3f5e3d..91f07c11871666c3a816dfd59f25ac9267c8ec06 100644 (file)
 #include <iostream>
 
 #include "cli.hpp"
-#include "os_path.hpp"
+#include "os_string.hpp"
 #include "trace_tools.hpp"
 
 static const char *synopsis = "Identify differences between two image dumps.";
 
-static os::Path
+static os::String
 find_command(void)
 {
 #define CLI_DIFF_IMAGES_COMMAND "snapdiff.py"
@@ -50,7 +50,7 @@ usage(void)
 {
     char *args[3];
 
-    os::Path command = find_command();
+    os::String command = find_command();
 
     args[0] = (char *) command.str();
     args[1] = (char *) "--help";
@@ -71,7 +71,7 @@ command(int argc, char *argv[])
     int i;
     char **args = new char* [argc+2];
 
-    os::Path command = find_command();
+    os::String command = find_command();
 
     args[0] = (char *) command.str();
 
index 5dd0fbe4897decd52b4a5f5b31989a77d3c47ad6..55d80832cf6961fee3f98012d68dc9588dd8fa7a 100644 (file)
@@ -29,7 +29,7 @@
 #include <iostream>
 
 #include "cli.hpp"
-#include "os_path.hpp"
+#include "os_string.hpp"
 #include "os_process.hpp"
 #include "trace_tools.hpp"
 
@@ -83,7 +83,7 @@ command(int argc, char *argv[])
 
 #define CLI_DIFF_STATE_COMMAND "jsondiff.py"
 
-    os::Path command = trace::findFile("scripts/" CLI_DIFF_STATE_COMMAND,
+    os::String command = trace::findFile("scripts/" CLI_DIFF_STATE_COMMAND,
                  APITRACE_SCRIPTS_INSTALL_DIR "/" CLI_DIFF_STATE_COMMAND,
                                        true);
 
diff --git a/common/os_path.hpp b/common/os_path.hpp
deleted file mode 100644 (file)
index ffb4fd2..0000000
+++ /dev/null
@@ -1,251 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2011 Jose Fonseca
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- *
- **************************************************************************/
-
-/*
- * Path manipulation.
- */
-
-#ifndef _OS_PATH_HPP_
-#define _OS_PATH_HPP_
-
-
-#include <assert.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stddef.h>
-
-#ifdef __MINGW32__
-// Some versions of MinGW are missing _vscprintf's declaration, although they
-// still provide the symbol in the import library.
-extern "C" _CRTIMP int _vscprintf(const char *format, va_list argptr);
-#endif
-
-#ifndef va_copy
-#ifdef __va_copy
-#define va_copy(dest, src) __va_copy((dest), (src))
-#else
-#define va_copy(dest, src) (dest) = (src)
-#endif
-#endif
-
-#include <vector>
-
-#include "os.hpp"
-
-
-#ifdef _WIN32
-#define OS_DIR_SEP '\\'
-#else /* !_WIN32 */
-#define OS_DIR_SEP '/'
-#endif /* !_WIN32 */
-
-
-namespace os {
-
-
-class Path {
-protected:
-    typedef std::vector<char> Buffer;
-    Buffer buffer;
-
-    Buffer::iterator find(char c) {
-        Buffer::iterator it = buffer.begin();
-        /* Why do we make these functions fail on empty paths? */
-        assert(it != buffer.end());
-        while (it != buffer.end()) {
-            if (*it == c) {
-                return it;
-            }
-            ++it;
-        }
-        return buffer.end();
-    }
-
-    Buffer::iterator rfind(char c) {
-        Buffer::iterator it = buffer.end();
-        assert(it != buffer.begin());
-        --it; // skip null
-        while (it != buffer.begin()) {
-            --it;
-            if (*it == c) {
-                return it;
-            }
-        }
-        return buffer.end();
-    }
-
-    Path(size_t size) :
-        buffer(size) {
-    }
-
-    char *buf(void) {
-        return &buffer[0];
-    }
-
-public:
-    Path() {
-        buffer.push_back(0);
-    }
-
-    Path(const char *s) :
-        buffer(s, s + strlen(s) + 1)
-    {}
-
-    template <class InputIterator>
-    Path(InputIterator first, InputIterator last) :
-        buffer(first, last)
-    {
-        buffer.push_back(0);
-    }
-
-    char *buf(size_t size) {
-        buffer.resize(size);
-        return &buffer[0];
-    }
-
-    void trimDirectory(void) {
-        Buffer::iterator sep = rfind(OS_DIR_SEP);
-        if (sep != buffer.end()) {
-            buffer.erase(buffer.begin(), sep + 1);
-        }
-    }
-
-    /* Trim filename component (leaving containing directory).
-     *
-     * This function removes everything after the final path
-     * separator, as well as that separator itself if it is not the
-     * only remaining separator.
-     *
-     * Some specific consequences of the above:
-     *
-     * 1. A path with no separator at all is unchanged.
-     * 2. A path with a trailing separator has only that separator removed
-     * 3. A path of just the root directory is unchaged.
-     */
-    void trimFilename(void) {
-        Buffer::iterator first = find(OS_DIR_SEP);
-        Buffer::iterator last = rfind(OS_DIR_SEP);
-        if (last == buffer.end()) {
-            return;
-        }
-        if (last == first) {
-            buffer.erase(first + 1, buffer.end() - 1);
-        } else {
-            buffer.erase(last, buffer.end() - 1);
-        }
-    }
-
-    void trimExtension(void) {
-        Buffer::iterator dot = rfind('.');
-        if (dot != buffer.end()) {
-            buffer.erase(dot, buffer.end() - 1);
-        }
-    }
-
-    size_t length(void) const {
-        size_t size = buffer.size();
-        assert(size > 0);
-        assert(buffer[size - 1] == 0);
-        return size - 1;
-    }
-
-    void truncate(size_t length) {
-        assert(length < buffer.size());
-        buffer[length] = 0;
-        buffer.resize(length + 1);
-    }
-
-    void truncate(void) {
-        truncate(strlen(str()));
-    }
-
-    const char *str(void) const {
-        assert(buffer[buffer.size() - 1] == 0);
-        return &buffer[0];
-    }
-
-    operator const char *(void) const {
-        return str();
-    }
-
-    void join(const Path & other) {
-        size_t len = length();
-        if (len > 0 && buffer[len - 1] != OS_DIR_SEP) {
-            buffer.insert(buffer.begin() + len++, OS_DIR_SEP);
-        }
-        buffer.insert(buffer.begin() + len, other.buffer.begin(), other.buffer.end() - 1);
-    }
-
-    /**
-     * Create a path from a printf-like format string
-     */
-    static Path
-    format(const char *format, ...)
-#ifdef __GNUC__
-    __attribute__ ((format (printf, 1, 2)))
-#endif
-    {
-
-        va_list args;
-
-        va_start(args, format);
-
-        int length;
-        va_list args_copy;
-        va_copy(args_copy, args);
-#ifdef _WIN32
-        /* We need to use _vcsprintf to calculate the length as vsnprintf returns -1
-         * if the number of characters to write is greater than count.
-         */
-        length = _vscprintf(format, args_copy);
-#else
-        char dummy;
-        length = vsnprintf(&dummy, sizeof dummy, format, args_copy);
-#endif
-        va_end(args_copy);
-
-        assert(length >= 0);
-        size_t size = length + 1;
-
-        Path path(size);
-
-        va_start(args, format);
-        vsnprintf(path.buf(), size, format, args);
-        va_end(args);
-
-        return path;
-    }
-
-    bool exists(void) const;
-};
-
-
-Path getProcessName();
-Path getCurrentDir();
-
-
-} /* namespace os */
-
-#endif /* _OS_PATH_HPP_ */
index da7878311a72f970a309fd11a3f3c5cf90fddc58..7dc2bb46a0d54400aee1a297e1064d10a01043f0 100644 (file)
@@ -52,7 +52,7 @@
 #endif
 
 #include "os.hpp"
-#include "os_path.hpp"
+#include "os_string.hpp"
 
 
 namespace os {
@@ -76,10 +76,10 @@ releaseMutex(void)
 }
 
 
-Path
+String
 getProcessName(void)
 {
-    Path path;
+    String path;
     size_t size = PATH_MAX;
     char *buf = path.buf(size);
 
@@ -113,10 +113,10 @@ getProcessName(void)
     return path;
 }
 
-Path
+String
 getCurrentDir(void)
 {
-    Path path;
+    String path;
     size_t size = PATH_MAX;
     char *buf = path.buf(size);
 
@@ -128,7 +128,7 @@ getCurrentDir(void)
 }
 
 bool
-Path::exists(void) const
+String::exists(void) const
 {
     struct stat st;
     int err;
diff --git a/common/os_string.hpp b/common/os_string.hpp
new file mode 100644 (file)
index 0000000..c92e6a8
--- /dev/null
@@ -0,0 +1,343 @@
+/**************************************************************************
+ *
+ * Copyright 2011 Jose Fonseca
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ **************************************************************************/
+
+/*
+ * String manipulation.
+ */
+
+#ifndef _OS_STRING_HPP_
+#define _OS_STRING_HPP_
+
+
+#include <assert.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#ifdef __MINGW32__
+// Some versions of MinGW are missing _vscprintf's declaration, although they
+// still provide the symbol in the import library.
+extern "C" _CRTIMP int _vscprintf(const char *format, va_list argptr);
+#endif
+
+#ifndef va_copy
+#ifdef __va_copy
+#define va_copy(dest, src) __va_copy((dest), (src))
+#else
+#define va_copy(dest, src) (dest) = (src)
+#endif
+#endif
+
+#include <vector>
+
+#include "os.hpp"
+
+
+#ifdef _WIN32
+#define OS_DIR_SEP '\\'
+#else /* !_WIN32 */
+#define OS_DIR_SEP '/'
+#endif /* !_WIN32 */
+
+
+namespace os {
+
+
+/**
+ * Vector based zero-terminate string, suitable for passing strings or paths
+ * to/from OS calls.
+ */
+class String {
+protected:
+    typedef std::vector<char> Buffer;
+
+    /**
+     * The buffer's last element is always the '\0' character, therefore the
+     * buffer must never be empty.
+     */
+    Buffer buffer;
+
+    Buffer::iterator find(char c) {
+        Buffer::iterator it = buffer.begin();
+        assert(it != buffer.end());
+        while (it != buffer.end()) {
+            if (*it == c) {
+                return it;
+            }
+            ++it;
+        }
+        return buffer.end();
+    }
+
+    Buffer::iterator rfind(char c) {
+        Buffer::iterator it = buffer.end();
+        while (it != buffer.begin()) {
+            --it;
+            if (*it == c) {
+                return it;
+            }
+        }
+        return buffer.end();
+    }
+
+    String(size_t size) :
+        buffer(size) {
+    }
+
+    char *buf(void) {
+        return &buffer[0];
+    }
+
+public:
+
+    /*
+     * Constructors
+     */
+
+    String() {
+        buffer.push_back(0);
+    }
+
+    String(const char *s) :
+        buffer(s, s + strlen(s) + 1)
+    {}
+
+    String(const String &other) :
+        buffer(other.buffer)
+    {}
+
+    template <class InputIterator>
+    String(InputIterator first, InputIterator last) :
+        buffer(first, last)
+    {
+        buffer.push_back(0);
+    }
+
+    /**
+     * From a printf-like format string
+     */
+    static String
+    format(const char *format, ...)
+#ifdef __GNUC__
+    __attribute__ ((format (printf, 1, 2)))
+#endif
+    {
+
+        va_list args;
+
+        va_start(args, format);
+
+        int length;
+        va_list args_copy;
+        va_copy(args_copy, args);
+#ifdef _WIN32
+        /* We need to use _vcsprintf to calculate the length as vsnprintf returns -1
+         * if the number of characters to write is greater than count.
+         */
+        length = _vscprintf(format, args_copy);
+#else
+        char dummy;
+        length = vsnprintf(&dummy, sizeof dummy, format, args_copy);
+#endif
+        va_end(args_copy);
+
+        assert(length >= 0);
+        size_t size = length + 1;
+
+        String path(size);
+
+        va_start(args, format);
+        vsnprintf(path.buf(), size, format, args);
+        va_end(args);
+
+        return path;
+    }
+
+    /*
+     * Conversion to ordinary C strings.
+     */
+
+    const char *str(void) const {
+        assert(buffer.back() == 0);
+        return &buffer[0];
+    }
+
+    operator const char *(void) const {
+        return str();
+    }
+
+    /*
+     * Iterators
+     */
+
+    typedef Buffer::const_iterator const_iterator;
+    typedef Buffer::iterator iterator;
+
+    const_iterator begin(void) const {
+        return buffer.begin();
+    }
+
+    iterator begin(void) {
+        return buffer.begin();
+    }
+
+    const_iterator end(void) const {
+        const_iterator it = buffer.end();
+        assert(it != buffer.begin());
+        --it; // skip null
+        return it;
+    }
+
+    iterator end(void) {
+        iterator it = buffer.end();
+        assert(it != buffer.begin());
+        --it; // skip null
+        return it;
+    }
+
+    /*
+     * Operations
+     */
+
+    void insert(iterator position, char c) {
+        buffer.insert(position, c);
+    }
+
+    template <class InputIterator>
+    void insert(iterator position, InputIterator first, InputIterator last) {
+        buffer.insert(position, first, last);
+    }
+
+    void insert(iterator position, const char *s) {
+        assert(s);
+        insert(position, s, s + strlen(s));
+    }
+
+    void insert(iterator position, const String & other) {
+        insert(position, other.begin(), other.end());
+    }
+
+    void append(char c) {
+        insert(end(), c);
+    }
+
+    template <class InputIterator>
+    void append(InputIterator first, InputIterator last) {
+        insert(end(), first, last);
+    }
+
+    void append(const char *s) {
+        insert(end(), s);
+    }
+
+    void append(const String & other) {
+        insert(end(), other);
+    }
+
+    char *buf(size_t size) {
+        buffer.resize(size);
+        return &buffer[0];
+    }
+
+    size_t length(void) const {
+        size_t size = buffer.size();
+        assert(size > 0);
+        assert(buffer[size - 1] == 0);
+        return size - 1;
+    }
+
+    void truncate(size_t length) {
+        assert(length < buffer.size());
+        buffer[length] = 0;
+        buffer.resize(length + 1);
+    }
+
+    void truncate(void) {
+        truncate(strlen(str()));
+    }
+
+
+    /*
+     * String manipulation
+     */
+
+    bool
+    exists(void) const;
+
+    void trimDirectory(void) {
+        iterator sep = rfind(OS_DIR_SEP);
+        if (sep != buffer.end()) {
+            buffer.erase(buffer.begin(), sep + 1);
+        }
+    }
+
+    /* Trim filename component (leaving containing directory).
+     *
+     * This function removes everything after the final path
+     * separator, as well as that separator itself if it is not the
+     * only remaining separator.
+     *
+     * Some specific consequences of the above:
+     *
+     * 1. A path with no separator at all is unchanged.
+     * 2. A path with a trailing separator has only that separator removed
+     * 3. A path of just the root directory is unchaged.
+     */
+    void trimFilename(void) {
+        iterator first = find(OS_DIR_SEP);
+        iterator last = rfind(OS_DIR_SEP);
+        if (last == buffer.end()) {
+            return;
+        }
+        if (last == first) {
+            buffer.erase(first + 1, end());
+        } else {
+            buffer.erase(last, end());
+        }
+    }
+
+    void trimExtension(void) {
+        iterator dot = rfind('.');
+        if (dot != buffer.end()) {
+            buffer.erase(dot, end());
+        }
+    }
+
+    void join(const String & other) {
+        if (length() && end()[-1] != OS_DIR_SEP) {
+            append(OS_DIR_SEP);
+        }
+        append(other.begin(), other.end());
+    }
+};
+
+
+String getProcessName();
+String getCurrentDir();
+
+
+} /* namespace os */
+
+#endif /* _OS_STRING_HPP_ */
index e156c77b8be8a99c32e74dcaff8d466e96d23e8b..13dd4f890a7f5b8ea2788eb4a2dc9182697ecc58 100644 (file)
@@ -32,7 +32,7 @@
 #include <string>
 
 #include "os.hpp"
-#include "os_path.hpp"
+#include "os_string.hpp"
 
 
 namespace os {
@@ -61,10 +61,10 @@ releaseMutex(void)
 }
 
 
-Path
+String
 getProcessName(void)
 {
-    Path path;
+    String path;
     size_t size = MAX_PATH;
     char *buf = path.buf(size);
 
@@ -76,10 +76,10 @@ getProcessName(void)
     return path;
 }
 
-Path
+String
 getCurrentDir(void)
 {
-    Path path;
+    String path;
     size_t size = MAX_PATH;
     char *buf = path.buf(size);
     
@@ -93,7 +93,7 @@ getCurrentDir(void)
 }
 
 bool
-Path::exists(void) const
+String::exists(void) const
 {
     DWORD attrs = GetFileAttributesA(str());
     return attrs != INVALID_FILE_ATTRIBUTES;
index ed786e92cb5cc5d6dbcd0fb6772175e6facf1132..7ca908af60c6a3f4e614bd8dc29dc00ce90bd0cf 100644 (file)
 
 #include <stdlib.h>
 
-
-namespace os {
-    class Path;
-};
+#include "os_string.hpp"
 
 
 namespace trace {
@@ -44,7 +41,7 @@ enum API {
 };
 
 
-os::Path
+os::String
 findFile(const char *relPath, // path relative to the current program
          const char *absPath, // absolute path
          bool verbose);
index 146f19f650ec159f44cfd75433a35b70ccd18868..f14617d6142d8ad1e6decbbd789f1783ebd5e711 100644 (file)
@@ -30,7 +30,7 @@
 
 #include <iostream>
 
-#include "os_path.hpp"
+#include "os_string.hpp"
 #include "os_process.hpp"
 #include "trace_tools.hpp"
 
@@ -52,17 +52,17 @@ namespace trace {
 #endif
 
 
-os::Path
+os::String
 findFile(const char *relPath,
          const char *absPath,
          bool verbose)
 {
-    os::Path complete;
+    os::String complete;
 
     /* First look in the same directory from which this process is
      * running, (to support developers running a compiled program that
      * has not been installed. */
-    os::Path process_dir = os::getProcessName();
+    os::String process_dir = os::getProcessName();
 
     process_dir.trimFilename();
 
@@ -113,7 +113,7 @@ traceProgram(API api,
         return 1;
     }
 
-    os::Path wrapper;
+    os::String wrapper;
     wrapper = findFile(relPath, absPath, verbose);
 
     if (!wrapper.length()) {
index 9d0429b4890c90eb198c8a1e37d4e6703a8f7071..0730150e0f228d5fbb0fb6d8e9d6c611d1383002 100644 (file)
@@ -31,7 +31,7 @@
 #include <string.h>
 
 #include "os.hpp"
-#include "os_path.hpp"
+#include "os_string.hpp"
 #include "trace_file.hpp"
 #include "trace_writer.hpp"
 #include "trace_format.hpp"
@@ -74,7 +74,7 @@ LocalWriter::~LocalWriter()
 
 void
 LocalWriter::open(void) {
-    os::Path szFileName;
+    os::String szFileName;
 
     const char *lpFileName;
 
@@ -82,22 +82,22 @@ LocalWriter::open(void) {
     if (!lpFileName) {
         static unsigned dwCounter = 0;
 
-        os::Path process = os::getProcessName();
+        os::String process = os::getProcessName();
 #ifdef _WIN32
         process.trimExtension();
 #endif
         process.trimDirectory();
 
-        os::Path prefix = os::getCurrentDir();
+        os::String prefix = os::getCurrentDir();
         prefix.join(process);
 
         for (;;) {
             FILE *file;
 
             if (dwCounter)
-                szFileName = os::Path::format("%s.%u.trace", prefix.str(), dwCounter);
+                szFileName = os::String::format("%s.%u.trace", prefix.str(), dwCounter);
             else
-                szFileName = os::Path::format("%s.trace", prefix.str());
+                szFileName = os::String::format("%s.trace", prefix.str());
 
             lpFileName = szFileName;
             file = fopen(lpFileName, "rb");
index dfb051c6a352b216ba47eea89c1386c48741b076..3c010d28ed7857e46d2524e82f8ac905827caed2 100644 (file)
@@ -26,7 +26,7 @@
 
 #include <string.h>
 
-#include "os_path.hpp"
+#include "os_string.hpp"
 #include "image.hpp"
 #include "retrace.hpp"
 #include "glproc.hpp"
@@ -140,7 +140,7 @@ void snapshot(unsigned call_no) {
     image::Image *ref = NULL;
 
     if (compare_prefix) {
-        os::Path filename = os::Path::format("%s%010u.png", compare_prefix, call_no);
+        os::String filename = os::String::format("%s%010u.png", compare_prefix, call_no);
         ref = image::readPNG(filename);
         if (!ref) {
             return;
@@ -161,7 +161,7 @@ void snapshot(unsigned call_no) {
             snprintf(comment, sizeof comment, "%u", call_no);
             src->writePNM(std::cout, comment);
         } else {
-            os::Path filename = os::Path::format("%s%010u.png", snapshot_prefix, call_no);
+            os::String filename = os::String::format("%s%010u.png", snapshot_prefix, call_no);
             if (src->writePNG(filename) && retrace::verbosity >= 0) {
                 std::cout << "Wrote " << filename << "\n";
             }