[libcxx] r305549 - Fix potential bug by casting to the POSIX specified type

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 15 23:17:53 PDT 2017


Author: ericwf
Date: Fri Jun 16 01:17:52 2017
New Revision: 305549

URL: http://llvm.org/viewvc/llvm-project?rev=305549&view=rev
Log:
Fix potential bug by casting to the POSIX specified type

Modified:
    libcxx/trunk/src/experimental/filesystem/operations.cpp

Modified: libcxx/trunk/src/experimental/filesystem/operations.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/operations.cpp?rev=305549&r1=305548&r2=305549&view=diff
==============================================================================
--- libcxx/trunk/src/experimental/filesystem/operations.cpp (original)
+++ libcxx/trunk/src/experimental/filesystem/operations.cpp Fri Jun 16 01:17:52 2017
@@ -842,7 +842,7 @@ void __rename(const path& from, const pa
 }
 
 void __resize_file(const path& p, std::uintmax_t size, std::error_code *ec) {
-    if (::truncate(p.c_str(), static_cast<long>(size)) == -1)
+    if (::truncate(p.c_str(), static_cast<::off_t>(size)) == -1)
         set_or_throw(ec, "resize_file", p);
     else if (ec)
         ec->clear();




More information about the cfe-commits mailing list