summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-23 23:53:31 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-23 23:53:31 +0000
commit5415e4f78c9f5a292fad5db68b224071d10d61dc (patch)
tree5ff43b9446162e913dcf5667bf0112391c044b0b /chrome
parent9fe6464530f957ed38be9edc7a6d0cc47ab5b2df (diff)
downloadchromium_src-5415e4f78c9f5a292fad5db68b224071d10d61dc.zip
chromium_src-5415e4f78c9f5a292fad5db68b224071d10d61dc.tar.gz
chromium_src-5415e4f78c9f5a292fad5db68b224071d10d61dc.tar.bz2
Fix more gcc 4.3 warnings.
Review URL: http://codereview.chromium.org/28045 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10224 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/download/download_file.cc6
-rw-r--r--chrome/browser/extensions/user_script_master_unittest.cc17
2 files changed, 13 insertions, 10 deletions
diff --git a/chrome/browser/download/download_file.cc b/chrome/browser/download/download_file.cc
index dbd632c..257a8ae 100644
--- a/chrome/browser/download/download_file.cc
+++ b/chrome/browser/download/download_file.cc
@@ -72,11 +72,11 @@ bool DownloadFile::Initialize() {
return false;
}
-// FIXME bug 595247: handle errors on file writes.
bool DownloadFile::AppendDataToFile(const char* data, int data_len) {
if (file_) {
- fwrite(data, 1, data_len, file_);
- bytes_so_far_ += data_len;
+ // FIXME bug 595247: handle errors on file writes.
+ size_t written = fwrite(data, 1, data_len, file_);
+ bytes_so_far_ += written;
return true;
}
return false;
diff --git a/chrome/browser/extensions/user_script_master_unittest.cc b/chrome/browser/extensions/user_script_master_unittest.cc
index 155fe47..7e5408c 100644
--- a/chrome/browser/extensions/user_script_master_unittest.cc
+++ b/chrome/browser/extensions/user_script_master_unittest.cc
@@ -14,7 +14,10 @@
#include "chrome/common/notification_service.h"
#include "testing/gtest/include/gtest/gtest.h"
-// Test bringing up a master on a specific directory, putting a script in there, etc.
+namespace {
+
+// Test bringing up a master on a specific directory, putting a script
+// in there, etc.
class UserScriptMasterTest : public testing::Test,
public NotificationObserver {
@@ -69,6 +72,8 @@ class UserScriptMasterTest : public testing::Test,
base::SharedMemory* shared_memory_;
};
+} // namespace
+
// Test that we *don't* get spurious notifications.
TEST_F(UserScriptMasterTest, NoScripts) {
// Set shared_memory_ to something non-NULL, so we can check it became NULL.
@@ -92,10 +97,9 @@ TEST_F(UserScriptMasterTest, NewScripts) {
FilePath path = script_dir_.AppendASCII("script.user.js");
- FILE* file = file_util::OpenFile(path, "w");
const char content[] = "some content";
- fwrite(content, 1, arraysize(content), file);
- file_util::CloseFile(file);
+ int written = file_util::WriteFile(path, content, sizeof(content));
+ ASSERT_EQ(written, sizeof(content));
message_loop_.Run();
@@ -106,10 +110,9 @@ TEST_F(UserScriptMasterTest, NewScripts) {
TEST_F(UserScriptMasterTest, ExistingScripts) {
FilePath path = script_dir_.AppendASCII("script.user.js");
- FILE* file = file_util::OpenFile(path, "w");
const char content[] = "some content";
- fwrite(content, 1, arraysize(content), file);
- file_util::CloseFile(file);
+ int written = file_util::WriteFile(path, content, sizeof(content));
+ ASSERT_EQ(written, sizeof(content));
scoped_refptr<UserScriptMaster> master(
new UserScriptMaster(MessageLoop::current(), script_dir_));