summaryrefslogtreecommitdiffstats
path: root/libcxx/include/fstream
diff options
context:
space:
mode:
authorHoward Hinnant <hhinnant@apple.com>2013-04-02 22:14:51 +0000
committerHoward Hinnant <hhinnant@apple.com>2013-04-02 22:14:51 +0000
commit459448241ad9cf507943bb7290aa773cb917f4f5 (patch)
tree2468f3c7eb840b2ec7fa29c53a1a3d65e26b0eee /libcxx/include/fstream
parent1ed58f7bafc40b9bfd4736fcb2d742f9a44a3aa7 (diff)
downloadbcm5719-llvm-459448241ad9cf507943bb7290aa773cb917f4f5.tar.gz
bcm5719-llvm-459448241ad9cf507943bb7290aa773cb917f4f5.zip
Reference: http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20130325/077133.html
llvm-svn: 178581
Diffstat (limited to 'libcxx/include/fstream')
-rw-r--r--libcxx/include/fstream16
1 files changed, 16 insertions, 0 deletions
diff --git a/libcxx/include/fstream b/libcxx/include/fstream
index 0a5cf92a870..e3f8306f4a0 100644
--- a/libcxx/include/fstream
+++ b/libcxx/include/fstream
@@ -807,9 +807,15 @@ basic_filebuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way,
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 @@ basic_filebuf<_CharT, _Traits>::seekpos(pos_type __sp, ios_base::openmode)
{
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 @@ basic_filebuf<_CharT, _Traits>::sync()
}
}
}
+#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_;
OpenPOWER on IntegriCloud