summaryrefslogtreecommitdiffstats
path: root/o3d/utils
diff options
context:
space:
mode:
Diffstat (limited to 'o3d/utils')
-rw-r--r--o3d/utils/cross/file_text_reader.cc7
-rw-r--r--o3d/utils/cross/file_text_reader_test.cc7
-rw-r--r--o3d/utils/cross/json_writer.cc2
3 files changed, 13 insertions, 3 deletions
diff --git a/o3d/utils/cross/file_text_reader.cc b/o3d/utils/cross/file_text_reader.cc
index 39e5057..314be5e 100644
--- a/o3d/utils/cross/file_text_reader.cc
+++ b/o3d/utils/cross/file_text_reader.cc
@@ -171,7 +171,12 @@ std::string FileTextReader::ReadToEnd() {
size_t FileTextReader::GetFileSize() const {
struct stat file_info;
- ::fstat(::fileno(input_), &file_info);
+#if defined(OS_WIN)
+ int file_number = ::_fileno(input_);
+#else
+ int file_number = ::fileno(input_);
+#endif
+ ::fstat(file_number, &file_info);
return file_info.st_size;
}
diff --git a/o3d/utils/cross/file_text_reader_test.cc b/o3d/utils/cross/file_text_reader_test.cc
index b87e61d..3bf1415 100644
--- a/o3d/utils/cross/file_text_reader_test.cc
+++ b/o3d/utils/cross/file_text_reader_test.cc
@@ -95,7 +95,12 @@ class FileTextReaderTest : public testing::Test {
if (file_pointers_[i]) {
::fclose(file_pointers_[i]);
}
- ::unlink((tmp_base + kFileInfo[i].file_name_).c_str());
+ std::string path = tmp_base + kFileInfo[i].file_name_;
+#if defined(OS_WIN)
+ ::_unlink(path.c_str());
+#else
+ ::unlink(path.c_str());
+#endif
file_pointers_[i] = NULL;
}
}
diff --git a/o3d/utils/cross/json_writer.cc b/o3d/utils/cross/json_writer.cc
index 784d728..a49700e 100644
--- a/o3d/utils/cross/json_writer.cc
+++ b/o3d/utils/cross/json_writer.cc
@@ -210,7 +210,7 @@ void JsonWriter::WritePending() {
}
void JsonWriter::WriteEscapedString(const string& unescaped) {
- for (int i = 0; i < unescaped.length(); ++i) {
+ for (string::size_type i = 0; i < unescaped.length(); ++i) {
char c = unescaped[i];
switch (c) {
case '\"':