From 79ae6f6bd47fc8fca3ed526cb5ea2685fe0af1ab Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Thu, 17 Jun 2010 01:16:34 +0000 Subject: [PATCH] Merge branches/fastlib-armadillo/fastlib/file into fastlib-stl/fastlib/file (breaks build until I merge data/, in just a moment) --- .../branches/fastlib-stl/fastlib/file/textfile.cc | 1 + .../branches/fastlib-stl/fastlib/file/textfile.h | 14 ++++---------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/fastlib/branches/fastlib-stl/fastlib/file/textfile.cc b/fastlib/branches/fastlib-stl/fastlib/file/textfile.cc index c0b6999f9f..97ef289fbd 100644 --- a/fastlib/branches/fastlib-stl/fastlib/file/textfile.cc +++ b/fastlib/branches/fastlib-stl/fastlib/file/textfile.cc @@ -108,6 +108,7 @@ void TextLineReader::Error(const char *format, ...) { success_t TextLineReader::Open(const char *fname) { f_ = fopen(fname, "r"); + fname_ = strncpy(new char[strlen(fname) + 1], fname, strlen(fname) + 1); line_num_ = 0; has_line_ = false; fname_ = fname; diff --git a/fastlib/branches/fastlib-stl/fastlib/file/textfile.h b/fastlib/branches/fastlib-stl/fastlib/file/textfile.h index 1d6bba6837..6e1605ab91 100644 --- a/fastlib/branches/fastlib-stl/fastlib/file/textfile.h +++ b/fastlib/branches/fastlib-stl/fastlib/file/textfile.h @@ -46,14 +46,10 @@ #include "../base/base.h" -#include #include #include #include -#include -#include - /** * Helper for reading text files. * @@ -100,15 +96,15 @@ class TextLineReader { (void)fclose(f_); f_ = NULL; } - - /** + + /** * Return the name of the file we are working with. * This will return NULL if no file has been opened yet. */ const char *filename() const { - return fname_.c_str(); + return fname_; } - + /** * Are there more lines left? */ @@ -251,7 +247,6 @@ class TextTokenizer { } } - /* bool MatchNoCase(const char *str) { if (next_.EqualsNoCase(str)) { Gobble(); @@ -260,7 +255,6 @@ class TextTokenizer { return false; } } - */ bool MatchInteger() { return MatchType(INTEGER);