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

Unified Diff: sandbox/win/src/crosscall_params.h

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_client.h ('k') | sandbox/win/src/crosscall_server.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sandbox/win/src/crosscall_params.h
diff --git a/sandbox/win/src/crosscall_params.h b/sandbox/win/src/crosscall_params.h
index 7adb918237f27a1ffcc46ff4c0884d30130411c5..a601fc77b2f9ec63f4623f6099f5df8529eef859 100644
--- a/sandbox/win/src/crosscall_params.h
+++ b/sandbox/win/src/crosscall_params.h
@@ -7,6 +7,7 @@
#include <windows.h>
#include <lmaccess.h>
+#include <stdint.h>
#include <memory>
@@ -14,10 +15,10 @@
#include "sandbox/win/src/internal_types.h"
#include "sandbox/win/src/sandbox_types.h"
-// Increases |value| until there is no need for padding given an int64
+// Increases |value| until there is no need for padding given an int64_t
// alignment. Returns the increased value.
-inline uint32 Align(uint32 value) {
- uint32 alignment = sizeof(int64);
+inline uint32_t Align(uint32_t value) {
+ uint32_t alignment = sizeof(int64_t);
return ((value + alignment - 1) / alignment) * alignment;
}
@@ -27,7 +28,7 @@ inline uint32 Align(uint32 value) {
// parameters of an IPC call and CrossCallReturn models the output params and
// the return value.
//
-// An IPC call is defined by its 'tag' which is a (uint32) unique identifier
+// An IPC call is defined by its 'tag' which is a (uint32_t) unique identifier
// that is used to route the IPC call to the proper server. Every tag implies
// a complete call signature including the order and type of each parameter.
//
@@ -36,7 +37,7 @@ inline uint32 Align(uint32 value) {
// them are not supported.
//
// Another limitation of CrossCall is that the return value and output
-// parameters can only be uint32 integers. Returning complex structures or
+// parameters can only be uint32_t integers. Returning complex structures or
// strings is not supported.
namespace sandbox {
@@ -47,7 +48,7 @@ const size_t kExtendedReturnCount = 8;
// Union of multiple types to be used as extended results
// in the CrossCallReturn.
union MultiType {
- uint32 unsigned_int;
+ uint32_t unsigned_int;
void* pointer;
HANDLE handle;
ULONG_PTR ulong_ptr;
@@ -63,8 +64,8 @@ const int kMaxIpcParams = 9;
// Contains the information about a parameter in the ipc buffer.
struct ParamInfo {
ArgType type_;
- uint32 offset_;
- uint32 size_;
+ uint32_t offset_;
+ uint32_t size_;
};
// Models the return value and the return parameters of an IPC call
@@ -73,7 +74,7 @@ struct ParamInfo {
// might have to use other integer types.
struct CrossCallReturn {
// the IPC tag. It should match the original IPC tag.
- uint32 tag;
+ uint32_t tag;
// The result of the IPC operation itself.
ResultCode call_outcome;
// the result of the IPC call as executed in the server. The interpretation
@@ -83,7 +84,7 @@ struct CrossCallReturn {
DWORD win32_result;
};
// Number of extended return values.
- uint32 extended_count;
+ uint32_t extended_count;
// for calls that should return a windows handle. It is found here.
HANDLE handle;
// The array of extended values.
@@ -104,9 +105,7 @@ struct CrossCallReturn {
class CrossCallParams {
public:
// Returns the tag (ipc unique id) associated with this IPC.
- uint32 GetTag() const {
- return tag_;
- }
+ uint32_t GetTag() const { return tag_; }
// Returns the beggining of the buffer where the IPC params can be stored.
// prior to an IPC call
@@ -115,9 +114,7 @@ class CrossCallParams {
}
// Returns how many parameter this IPC call should have.
- const uint32 GetParamsCount() const {
- return params_count_;
- }
+ const uint32_t GetParamsCount() const { return params_count_; }
// Returns a pointer to the CrossCallReturn structure.
CrossCallReturn* GetCallReturn() {
@@ -139,14 +136,14 @@ class CrossCallParams {
protected:
// constructs the IPC call params. Called only from the derived classes
- CrossCallParams(uint32 tag, uint32 params_count)
+ CrossCallParams(uint32_t tag, uint32_t params_count)
: tag_(tag), is_in_out_(0), params_count_(params_count) {}
private:
- uint32 tag_;
- uint32 is_in_out_;
+ uint32_t tag_;
+ uint32_t is_in_out_;
CrossCallReturn call_return;
- const uint32 params_count_;
+ const uint32_t params_count_;
DISALLOW_COPY_AND_ASSIGN(CrossCallParams);
};
@@ -192,37 +189,40 @@ template <size_t NUMBER_PARAMS, size_t BLOCK_SIZE>
class ActualCallParams : public CrossCallParams {
public:
// constructor. Pass the ipc unique tag as input
- explicit ActualCallParams(uint32 tag)
+ explicit ActualCallParams(uint32_t tag)
: CrossCallParams(tag, NUMBER_PARAMS) {
param_info_[0].offset_ =
- static_cast<uint32>(parameters_ - reinterpret_cast<char*>(this));
+ static_cast<uint32_t>(parameters_ - reinterpret_cast<char*>(this));
}
// Testing-only constructor. Allows setting the |number_params| to a
// wrong value.
- ActualCallParams(uint32 tag, uint32 number_params)
+ ActualCallParams(uint32_t tag, uint32_t number_params)
: CrossCallParams(tag, number_params) {
param_info_[0].offset_ =
- static_cast<uint32>(parameters_ - reinterpret_cast<char*>(this));
+ static_cast<uint32_t>(parameters_ - reinterpret_cast<char*>(this));
}
// Testing-only method. Allows setting the apparent size to a wrong value.
// returns the previous size.
- uint32 OverrideSize(uint32 new_size) {
- uint32 previous_size = param_info_[NUMBER_PARAMS].offset_;
+ uint32_t OverrideSize(uint32_t new_size) {
+ uint32_t previous_size = param_info_[NUMBER_PARAMS].offset_;
param_info_[NUMBER_PARAMS].offset_ = new_size;
return previous_size;
}
// Copies each paramter into the internal buffer. For each you must supply:
// index: 0 for the first param, 1 for the next an so on
- bool CopyParamIn(uint32 index, const void* parameter_address, uint32 size,
- bool is_in_out, ArgType type) {
+ bool CopyParamIn(uint32_t index,
+ const void* parameter_address,
+ uint32_t size,
+ bool is_in_out,
+ ArgType type) {
if (index >= NUMBER_PARAMS) {
return false;
}
- if (kuint32max == size) {
+ if (UINT32_MAX == size) {
// Memory error while getting the size.
return false;
}
@@ -267,9 +267,7 @@ class ActualCallParams : public CrossCallParams {
// Returns the total size of the buffer. Only valid once all the paramters
// have been copied in with CopyParamIn.
- uint32 GetSize() const {
- return param_info_[NUMBER_PARAMS].offset_;
- }
+ uint32_t GetSize() const { return param_info_[NUMBER_PARAMS].offset_; }
protected:
ActualCallParams() : CrossCallParams(0, NUMBER_PARAMS) { }
« no previous file with comments | « sandbox/win/src/crosscall_client.h ('k') | sandbox/win/src/crosscall_server.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698