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

Unified Diff: base/enum_validation.h

Issue 15841011: Implement off-the-wire validation scheme for enum types. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Correct check in content_settings.h Created 7 years, 7 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: base/enum_validation.h
diff --git a/base/enum_validation.h b/base/enum_validation.h
new file mode 100644
index 0000000000000000000000000000000000000000..4d4e3f30e76a73bff899d902b2f0352b8275ebee
--- /dev/null
+++ b/base/enum_validation.h
@@ -0,0 +1,13 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BASE_ENUM_VALIDATION_H
+#define BASE_ENUM_VALIDATION_H
+
+// Defines a function template which enum authors can specialize to perform
+// validation upon an untrusted value prior to its being cast to their enum
+// type. Intended mainly for use by (generated) unmarshalling code.
+template <typename T> inline bool IsIntValidForEnum(int x) { return true; }
+
+#endif // BASE_ENUM_VALIDATION_H

Powered by Google App Engine
This is Rietveld 408576698