Chromium Code Reviews| Index: chrome/browser/privacy_blacklist/blacklist_store.cc |
| =================================================================== |
| --- chrome/browser/privacy_blacklist/blacklist_store.cc (revision 20820) |
| +++ chrome/browser/privacy_blacklist/blacklist_store.cc (working copy) |
| @@ -13,20 +13,26 @@ |
| const char cookie[] = "GCPBL100"; |
| +// This is a wrapper function for fwrite() to avoid warnings of GCC 4.4. |
| +void WriteData(const char* data, size_t size, size_t items, FILE* stream) { |
| + if (fwrite(data, size, items, stream) != size * items) |
| + return; |
|
Evan Martin
2009/07/17 17:15:49
Should this LOG(WARNING) ?
|
| } |
| +} |
| + |
| void BlacklistStoreOutput::WriteUInt(uint32 i) { |
| - fwrite(reinterpret_cast<char*>(&i), 1, sizeof(uint32), file_); |
| + WriteData(reinterpret_cast<char*>(&i), 1, sizeof(uint32), file_); |
| } |
| void BlacklistStoreOutput::WriteString(const std::string& s) { |
| uint32 n = s.size(); |
| - fwrite(reinterpret_cast<char*>(&n), 1, sizeof(uint32), file_); |
| - fwrite(s.c_str(), 1, s.size(), file_); |
| + WriteData(reinterpret_cast<char*>(&n), 1, sizeof(uint32), file_); |
| + WriteData(s.c_str(), 1, s.size(), file_); |
| } |
| BlacklistStoreOutput::BlacklistStoreOutput(FILE* file) : file_(file) { |
| - fwrite(cookie, 1, sizeof(cookie), file_); |
| + WriteData(cookie, 1, sizeof(cookie), file_); |
| } |
| BlacklistStoreOutput::~BlacklistStoreOutput() { |