From 61899d3915693df7dbc8c5bdaa6e8ae4ba3931d0 Mon Sep 17 00:00:00 2001 From: "maruel@chromium.org" Date: Tue, 27 Jan 2009 17:38:31 +0000 Subject: Reverting 8722,8721. Review URL: http://codereview.chromium.org/19024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8723 0039d316-1c4b-4281-b951-d872f2087c98 --- base/base.xcodeproj/project.pbxproj | 2 -- base/file_util.cc | 21 --------------------- base/file_util.h | 17 ----------------- 3 files changed, 40 deletions(-) (limited to 'base') diff --git a/base/base.xcodeproj/project.pbxproj b/base/base.xcodeproj/project.pbxproj index 5c9ab7a..e347a84 100644 --- a/base/base.xcodeproj/project.pbxproj +++ b/base/base.xcodeproj/project.pbxproj @@ -644,7 +644,6 @@ ABF68B280EB0F93100E72835 /* field_trial.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = field_trial.cc; sourceTree = ""; }; B290BFCBD30E45A63758BFC7 /* waitable_event_posix.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = waitable_event_posix.cc; sourceTree = ""; }; B52C916B0E9428F500208D01 /* clipboard_unittest.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = clipboard_unittest.cc; sourceTree = ""; }; - B57D788E0F26983200685566 /* scoped_file.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scoped_file.h; sourceTree = ""; }; B57E4D770E9C26340090055D /* idletimer_unittest.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = idletimer_unittest.cc; sourceTree = ""; }; B5A8618D0EC1257900B332C2 /* clipboard.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = clipboard.cc; sourceTree = ""; }; B5D544AA0EAFB7E000272A1C /* sys_string_conversions_unittest.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = sys_string_conversions_unittest.cc; sourceTree = ""; }; @@ -1003,7 +1002,6 @@ 7B5AD60D0D9DD8050012BCF1 /* scoped_cftyperef.h */, B5E8F6CB0EBFB38E008DD1E9 /* scoped_clipboard_writer.cc */, B5E8F6CA0EBFB38E008DD1E9 /* scoped_clipboard_writer.h */, - B57D788E0F26983200685566 /* scoped_file.h */, 7BA35DD10E8C0D5F0023C8B9 /* scoped_nsautorelease_pool.h */, 7BA35DD20E8C0D5F0023C8B9 /* scoped_nsautorelease_pool.mm */, 825403610D92D27C0006B936 /* scoped_ptr.h */, diff --git a/base/file_util.cc b/base/file_util.cc index 8ecb1cc..078e3afa 100644 --- a/base/file_util.cc +++ b/base/file_util.cc @@ -4,9 +4,6 @@ #include "base/file_util.h" -#if defined(OS_WIN) -#include -#endif #include #include @@ -279,24 +276,6 @@ bool CloseFile(FILE* file) { return fclose(file) == 0; } -bool TruncateFile(FILE* file) { - if (file == NULL) - return false; - long current_offset = ftell(file); - if (current_offset == -1) - return false; -#if defined(OS_WIN) - int fd = _fileno(file); - if (_chsize(fd, current_offset) != 0) - return false; -#else - int fd = fileno(file); - if (ftruncate(fd, current_offset) != 0) - return false; -#endif - return true; -} - bool ContainsPath(const FilePath &parent, const FilePath& child) { FilePath abs_parent = FilePath(parent); FilePath abs_child = FilePath(child); diff --git a/base/file_util.h b/base/file_util.h index c546b9a..4154856 100644 --- a/base/file_util.h +++ b/base/file_util.h @@ -24,7 +24,6 @@ #include #include "base/basictypes.h" -#include "base/scoped_ptr.h" #include "base/file_path.h" namespace file_util { @@ -319,10 +318,6 @@ FILE* OpenFile(const std::wstring& filename, const char* mode); // Closes file opened by OpenFile. Returns true on success. bool CloseFile(FILE* file); -// Truncates an open file to end at the location of the current file pointer. -// This is a cross-platform analog to Windows' SetEndOfFile() function. -bool TruncateFile(FILE* file); - // Reads the given number of bytes from the file into the buffer. Returns // the number of read bytes, or -1 on error. int ReadFile(const std::wstring& filename, char* data, int size); @@ -341,18 +336,6 @@ bool SetCurrentDirectory(const FilePath& path); // Deprecated temporary compatibility function. bool SetCurrentDirectory(const std::wstring& current_directory); -// A class to handle auto-closing of FILE*'s. -class ScopedFILEClose { - public: - inline void operator()(FILE* x) const { - if (x) { - fclose(x); - } - } -}; - -typedef scoped_ptr_malloc ScopedFILE; - // A class for enumerating the files in a provided path. The order of the // results is not guaranteed. // -- cgit v1.1