diff options
author | mark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-01 17:40:13 +0000 |
---|---|---|
committer | mark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-01 17:40:13 +0000 |
commit | 836f134c56bfa714217ca12a73482205c1480774 (patch) | |
tree | 5c5b9d938a712e09831bdd32022e1b3716c5fbdf /chrome/tools/test/image_diff | |
parent | d46d6f3b80099ce0c630185a2e86b649bba49254 (diff) | |
download | chromium_src-836f134c56bfa714217ca12a73482205c1480774.zip chromium_src-836f134c56bfa714217ca12a73482205c1480774.tar.gz chromium_src-836f134c56bfa714217ca12a73482205c1480774.tar.bz2 |
Cross-platform wrappers for fopen, _wfopen_s, etc.
Patch by Paweł Hajdan jr <phajdan.jr@gmail.com>.
http://codereview.chromium.org/6005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2760 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/tools/test/image_diff')
-rw-r--r-- | chrome/tools/test/image_diff/image_diff.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/chrome/tools/test/image_diff/image_diff.cc b/chrome/tools/test/image_diff/image_diff.cc index 7b06ed3..65ec67a 100644 --- a/chrome/tools/test/image_diff/image_diff.cc +++ b/chrome/tools/test/image_diff/image_diff.cc @@ -13,6 +13,7 @@ #include "base/basictypes.h" #include "base/command_line.h" +#include "base/file_util.h" #include "base/gfx/png_decoder.h" #include "base/logging.h" #include "base/process_util.h" @@ -65,8 +66,8 @@ class Image { // Creates the image from the given filename on disk, and returns true on // success. bool CreateFromFilename(const char* filename) { - FILE* f; - if (fopen_s(&f, filename, "rb") != 0) + FILE* f = file_util::OpenFile(std::string(filename), "rb"); + if (!f) return false; std::vector<unsigned char> compressed; @@ -77,7 +78,7 @@ class Image { std::copy(buf, &buf[num_read], std::back_inserter(compressed)); } - fclose(f); + file_util::CloseFile(f); if (!PNGDecoder::Decode(&compressed[0], compressed.size(), PNGDecoder::FORMAT_RGBA, &data_, &w_, &h_)) { |