diff options
author | dmichael@google.com <dmichael@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-05 14:45:44 +0000 |
---|---|---|
committer | dmichael@google.com <dmichael@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-05 14:45:44 +0000 |
commit | 6f2e3919c4709404d8d7b6742f9cd9989b799c98 (patch) | |
tree | 55a933f7e2988625f0f3ded5a562203c7e3921c9 /ppapi/c/pp_var.h | |
parent | 79ba2d8a26fe6c9b343c57fef57896a90baa3878 (diff) | |
download | chromium_src-6f2e3919c4709404d8d7b6742f9cd9989b799c98.zip chromium_src-6f2e3919c4709404d8d7b6742f9cd9989b799c98.tar.gz chromium_src-6f2e3919c4709404d8d7b6742f9cd9989b799c98.tar.bz2 |
Make PPAPI headers compile with C compilers (gcc on Linux & Mac and MSVS on Windows). This includes changing bool to PP_Bool and adding a PP_INLINE macro.
TEST=tests/test_c_includes.c
BUG=59791,53451
The first patch set is a straight copy of http://codereview.chromium.org/4019010/show which got LGTMed when PPAPI was in its own repo, but had to be rolled back in order to include chrome changes.
IMPORTANT: This change will break plugin implementations that use the C interface, and might break others as well.
Review URL: http://codereview.chromium.org/4310002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65200 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/c/pp_var.h')
-rw-r--r-- | ppapi/c/pp_var.h | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/ppapi/c/pp_var.h b/ppapi/c/pp_var.h index 75a9492..81596d6 100644 --- a/ppapi/c/pp_var.h +++ b/ppapi/c/pp_var.h @@ -13,6 +13,8 @@ * @{ */ +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_macros.h" #include "ppapi/c/pp_stdint.h" typedef enum { @@ -40,7 +42,7 @@ typedef enum { struct PP_Var { PP_VarType type; union { - bool as_bool; + PP_Bool as_bool; int32_t as_int; double as_double; @@ -53,30 +55,30 @@ struct PP_Var { } value; }; -inline struct PP_Var PP_MakeUndefined() { - struct PP_Var result = { PP_VARTYPE_UNDEFINED, {0} }; +PP_INLINE struct PP_Var PP_MakeUndefined() { + struct PP_Var result = { PP_VARTYPE_UNDEFINED, {PP_FALSE} }; return result; } -inline struct PP_Var PP_MakeNull() { - struct PP_Var result = { PP_VARTYPE_NULL, {0} }; +PP_INLINE struct PP_Var PP_MakeNull() { + struct PP_Var result = { PP_VARTYPE_NULL, {PP_FALSE} }; return result; } -inline struct PP_Var PP_MakeBool(bool value) { - struct PP_Var result = { PP_VARTYPE_BOOL, {0} }; +PP_INLINE struct PP_Var PP_MakeBool(PP_Bool value) { + struct PP_Var result = { PP_VARTYPE_BOOL, {PP_FALSE} }; result.value.as_bool = value; return result; } -inline struct PP_Var PP_MakeInt32(int32_t value) { - PP_Var result = { PP_VARTYPE_INT32, {0} }; +PP_INLINE struct PP_Var PP_MakeInt32(int32_t value) { + struct PP_Var result = { PP_VARTYPE_INT32, {PP_FALSE} }; result.value.as_int = value; return result; } -inline struct PP_Var PP_MakeDouble(double value) { - PP_Var result = { PP_VARTYPE_DOUBLE, {0} }; +PP_INLINE struct PP_Var PP_MakeDouble(double value) { + struct PP_Var result = { PP_VARTYPE_DOUBLE, {PP_FALSE} }; result.value.as_double = value; return result; } |