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

Unified Diff: sandbox/win/src/crosscall_server.cc

Issue 1492403002: Remove kuint32max. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: http security header file Created 5 years 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
« no previous file with comments | « sandbox/win/src/crosscall_server.h ('k') | sandbox/win/src/ipc_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sandbox/win/src/crosscall_server.cc
diff --git a/sandbox/win/src/crosscall_server.cc b/sandbox/win/src/crosscall_server.cc
index 6f8bd744f20ead53a84881fb1b6bb7525717ab82..f0e1183ad5d95d026e481de6ee41d9185172dbca 100644
--- a/sandbox/win/src/crosscall_server.cc
+++ b/sandbox/win/src/crosscall_server.cc
@@ -26,7 +26,7 @@ namespace sandbox {
// Returns the actual size for the parameters in an IPC buffer. Returns
// zero if the |param_count| is zero or too big.
-uint32 GetActualBufferSize(uint32 param_count, void* buffer_base) {
+uint32_t GetActualBufferSize(uint32_t param_count, void* buffer_base) {
// The template types are used to calculate the maximum expected size.
typedef ActualCallParams<1, kMaxBufferSize> ActualCP1;
typedef ActualCallParams<2, kMaxBufferSize> ActualCP2;
@@ -66,8 +66,9 @@ uint32 GetActualBufferSize(uint32 param_count, void* buffer_base) {
}
// Verifies that the declared sizes of an IPC buffer are within range.
-bool IsSizeWithinRange(uint32 buffer_size, uint32 min_declared_size,
- uint32 declared_size) {
+bool IsSizeWithinRange(uint32_t buffer_size,
+ uint32_t min_declared_size,
+ uint32_t declared_size) {
if ((buffer_size < min_declared_size) ||
(sizeof(CrossCallParamsEx) > min_declared_size)) {
// Minimal computed size bigger than existing buffer or param_count
@@ -104,8 +105,8 @@ void CrossCallParamsEx::operator delete(void* raw_memory) throw() {
// have destructors or else you get Compiler Error C2712. So no DCHECKs
// inside this function.
CrossCallParamsEx* CrossCallParamsEx::CreateFromBuffer(void* buffer_base,
- uint32 buffer_size,
- uint32* output_size) {
+ uint32_t buffer_size,
+ uint32_t* output_size) {
// IMPORTANT: Everything inside buffer_base and derived from it such
// as param_count and declared_size is untrusted.
if (NULL == buffer_base) {
@@ -119,9 +120,9 @@ CrossCallParamsEx* CrossCallParamsEx::CreateFromBuffer(void* buffer_base,
}
char* backing_mem = NULL;
- uint32 param_count = 0;
- uint32 declared_size;
- uint32 min_declared_size;
+ uint32_t param_count = 0;
+ uint32_t declared_size;
+ uint32_t min_declared_size;
CrossCallParamsEx* copied_params = NULL;
// Touching the untrusted buffer is done under a SEH try block. This
@@ -176,8 +177,8 @@ CrossCallParamsEx* CrossCallParamsEx::CreateFromBuffer(void* buffer_base,
// Verify here that all and each parameters make sense. This is done in the
// local copy.
- for (uint32 ix =0; ix != param_count; ++ix) {
- uint32 size = 0;
+ for (uint32_t ix = 0; ix != param_count; ++ix) {
+ uint32_t size = 0;
ArgType type;
char* address = reinterpret_cast<char*>(
copied_params->GetRawParameter(ix, &size, &type));
@@ -198,7 +199,8 @@ CrossCallParamsEx* CrossCallParamsEx::CreateFromBuffer(void* buffer_base,
}
// Accessors to the parameters in the raw buffer.
-void* CrossCallParamsEx::GetRawParameter(uint32 index, uint32* size,
+void* CrossCallParamsEx::GetRawParameter(uint32_t index,
+ uint32_t* size,
ArgType* type) {
if (index >= GetParamsCount()) {
return NULL;
@@ -212,20 +214,20 @@ void* CrossCallParamsEx::GetRawParameter(uint32 index, uint32* size,
}
// Covers common case for 32 bit integers.
-bool CrossCallParamsEx::GetParameter32(uint32 index, uint32* param) {
- uint32 size = 0;
+bool CrossCallParamsEx::GetParameter32(uint32_t index, uint32_t* param) {
+ uint32_t size = 0;
ArgType type;
void* start = GetRawParameter(index, &size, &type);
if ((NULL == start) || (4 != size) || (UINT32_TYPE != type)) {
return false;
}
// Copy the 4 bytes.
- *(reinterpret_cast<uint32*>(param)) = *(reinterpret_cast<uint32*>(start));
+ *(reinterpret_cast<uint32_t*>(param)) = *(reinterpret_cast<uint32_t*>(start));
return true;
}
-bool CrossCallParamsEx::GetParameterVoidPtr(uint32 index, void** param) {
- uint32 size = 0;
+bool CrossCallParamsEx::GetParameterVoidPtr(uint32_t index, void** param) {
+ uint32_t size = 0;
ArgType type;
void* start = GetRawParameter(index, &size, &type);
if ((NULL == start) || (sizeof(void*) != size) || (VOIDPTR_TYPE != type)) {
@@ -237,8 +239,9 @@ bool CrossCallParamsEx::GetParameterVoidPtr(uint32 index, void** param) {
// Covers the common case of reading a string. Note that the string is not
// scanned for invalid characters.
-bool CrossCallParamsEx::GetParameterStr(uint32 index, base::string16* string) {
- uint32 size = 0;
+bool CrossCallParamsEx::GetParameterStr(uint32_t index,
+ base::string16* string) {
+ uint32_t size = 0;
ArgType type;
void* start = GetRawParameter(index, &size, &type);
if (WCHAR_TYPE != type) {
@@ -258,9 +261,10 @@ bool CrossCallParamsEx::GetParameterStr(uint32 index, base::string16* string) {
return true;
}
-bool CrossCallParamsEx::GetParameterPtr(uint32 index, uint32 expected_size,
+bool CrossCallParamsEx::GetParameterPtr(uint32_t index,
+ uint32_t expected_size,
void** pointer) {
- uint32 size = 0;
+ uint32_t size = 0;
ArgType type;
void* start = GetRawParameter(index, &size, &type);
« no previous file with comments | « sandbox/win/src/crosscall_server.h ('k') | sandbox/win/src/ipc_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698