Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1675)

Unified Diff: chrome/browser/policy/preg_parser_win.cc

Issue 13963003: Add standard policy provider tests for PReg policy reading. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/policy/preg_parser_win.cc
diff --git a/chrome/browser/policy/preg_parser_win.cc b/chrome/browser/policy/preg_parser_win.cc
index 9963506f0ac560db502235d81c86dab14333d5e8..b2f62c49d5a18294aa0550d7de56def21e5b7f58 100644
--- a/chrome/browser/policy/preg_parser_win.cc
+++ b/chrome/browser/policy/preg_parser_win.cc
@@ -4,10 +4,11 @@
#include "chrome/browser/policy/preg_parser_win.h"
+#include <windows.h>
+
#include <algorithm>
#include <iterator>
-
-#include <windows.h>
+#include <vector>
#include "base/basictypes.h"
#include "base/files/file_path.h"
@@ -23,8 +24,8 @@
namespace policy {
namespace preg_parser {
-// The magic header in PReg files: ASCII "PReg" + version (0x0001).
-const char kPolicyRegistryFileHeader[] = "PReg\x01\x00\x00\x00";
+const char kPRegFileHeader[8] =
+ { 'P', 'R', 'e', 'g', '\x01', '\x00', '\x00', '\x00' };
// Maximum PReg file size we're willing to accept.
const int64 kMaxPRegFileSize = 1024 * 1024 * 16;
@@ -228,9 +229,9 @@ bool ReadFile(const base::FilePath& file_path,
}
// Check the header.
- const int kHeaderSize = arraysize(kPolicyRegistryFileHeader) - 1;
+ const int kHeaderSize = arraysize(kPRegFileHeader);
if (mapped_file.length() < kHeaderSize ||
- memcmp(kPolicyRegistryFileHeader, mapped_file.data(), kHeaderSize) != 0) {
+ memcmp(kPRegFileHeader, mapped_file.data(), kHeaderSize) != 0) {
LOG(ERROR) << "Bad policy file " << file_path.value();
return false;
}

Powered by Google App Engine
This is Rietveld 408576698