Reference: http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20130325/077133.html
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@178581 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/fstream b/include/fstream
index 0a5cf92..e3f8306 100644
--- a/include/fstream
+++ b/include/fstream
@@ -807,9 +807,15 @@
default:
return pos_type(off_type(-1));
}
+#if _WIN32
+ if (fseek(__file_, __width > 0 ? __width * __off : 0, __whence))
+ return pos_type(off_type(-1));
+ pos_type __r = ftell(__file_);
+#else
if (fseeko(__file_, __width > 0 ? __width * __off : 0, __whence))
return pos_type(off_type(-1));
pos_type __r = ftello(__file_);
+#endif
__r.state(__st_);
return __r;
}
@@ -820,8 +826,13 @@
{
if (__file_ == 0 || sync())
return pos_type(off_type(-1));
+#if _WIN32
+ if (fseek(__file_, __sp, SEEK_SET))
+ return pos_type(off_type(-1));
+#else
if (fseeko(__file_, __sp, SEEK_SET))
return pos_type(off_type(-1));
+#endif
__st_ = __sp.state();
return __sp;
}
@@ -880,8 +891,13 @@
}
}
}
+#if _WIN32
+ if (fseek(__file_, -__c, SEEK_CUR))
+ return -1;
+#else
if (fseeko(__file_, -__c, SEEK_CUR))
return -1;
+#endif
if (__update_st)
__st_ = __state;
__extbufnext_ = __extbufend_ = __extbuf_;