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

Side by Side Diff: ppapi/c/dev/ppb_char_set_dev.h

Issue 5674004: Add compile assertions to enforce the sizes of all structs and enums in the C... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef PPAPI_C_DEV_PPB_CHAR_SET_DEV_H_ 5 #ifndef PPAPI_C_DEV_PPB_CHAR_SET_DEV_H_
6 #define PPAPI_C_DEV_PPB_CHAR_SET_DEV_H_ 6 #define PPAPI_C_DEV_PPB_CHAR_SET_DEV_H_
7 7
8 #include "ppapi/c/pp_macros.h"
8 #include "ppapi/c/pp_module.h" 9 #include "ppapi/c/pp_module.h"
9 #include "ppapi/c/pp_stdint.h" 10 #include "ppapi/c/pp_stdint.h"
10 #include "ppapi/c/pp_var.h" 11 #include "ppapi/c/pp_var.h"
11 12
12 #define PPB_CHAR_SET_DEV_INTERFACE "PPB_CharSet(Dev);0.2" 13 #define PPB_CHAR_SET_DEV_INTERFACE "PPB_CharSet(Dev);0.3"
13 14
14 // Specifies the error behavior for the character set conversion functions. 15 // Specifies the error behavior for the character set conversion functions.
15 // This will affect two cases: where the input is not encoded correctly, and 16 // This will affect two cases: where the input is not encoded correctly, and
16 // when the requested character can not be converted to the destination 17 // when the requested character can not be converted to the destination
17 // character set. 18 // character set.
18 enum PP_CharSet_ConversionError { 19 enum PP_CharSet_ConversionError {
19 // Causes the entire conversion to fail if an error is encountered. The 20 // Causes the entire conversion to fail if an error is encountered. The
20 // conversion function will return NULL. 21 // conversion function will return NULL.
21 PP_CHARSET_CONVERSIONERROR_FAIL, 22 PP_CHARSET_CONVERSIONERROR_FAIL,
22 23
23 // Silently skips over errors. Unrepresentable characters and input encoding 24 // Silently skips over errors. Unrepresentable characters and input encoding
24 // errors will be removed from the output. 25 // errors will be removed from the output.
25 PP_CHARSET_CONVERSIONERROR_SKIP, 26 PP_CHARSET_CONVERSIONERROR_SKIP,
26 27
27 // Replaces the error or unrepresentable character with a substitution 28 // Replaces the error or unrepresentable character with a substitution
28 // character. When converting to a Unicode character set (UTF-8 or UTF-16) 29 // character. When converting to a Unicode character set (UTF-8 or UTF-16)
29 // it will use the unicode "substitution character" U+FFFD. When converting 30 // it will use the unicode "substitution character" U+FFFD. When converting
30 // to another character set, the character will be charset-specific. For 31 // to another character set, the character will be charset-specific. For
31 // many languages this will be the representation of the '?' character. 32 // many languages this will be the representation of the '?' character.
32 PP_CHARSET_CONVERSIONERROR_SUBSTITUTE 33 PP_CHARSET_CONVERSIONERROR_SUBSTITUTE
33 }; 34 };
35 PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_CharSet_ConversionError, 4);
34 36
35 struct PPB_CharSet_Dev { 37 struct PPB_CharSet_Dev {
36 // Converts the UTF-16 string pointed to in |*utf16| to an 8-bit string in the 38 // Converts the UTF-16 string pointed to in |*utf16| to an 8-bit string in the
37 // specified code page. |utf16_len| is measured in UTF-16 units, not bytes. 39 // specified code page. |utf16_len| is measured in UTF-16 units, not bytes.
38 // This value may not be NULL. 40 // This value may not be NULL.
39 // 41 //
40 // The return value is a NULL-terminated 8-bit string corresponding to the 42 // The return value is a NULL-terminated 8-bit string corresponding to the
41 // new character set, or NULL on failure. THIS STRING MUST BE FREED USING 43 // new character set, or NULL on failure. THIS STRING MUST BE FREED USING
42 // PPB_Core::MemFree(). The length of the returned string, not including the 44 // PPB_Core::MemFree(). The length of the returned string, not including the
43 // terminating NULL, will be placed into *output_length. When there is no 45 // terminating NULL, will be placed into *output_length. When there is no
(...skipping 25 matching lines...) Expand all
69 // Returns a string var representing the current multi-byte character set of 71 // Returns a string var representing the current multi-byte character set of
70 // the current system. 72 // the current system.
71 // 73 //
72 // WARNING: You really shouldn't be using this function unless you're dealing 74 // WARNING: You really shouldn't be using this function unless you're dealing
73 // with legacy data. You should be using UTF-8 or UTF-16 and you don't have 75 // with legacy data. You should be using UTF-8 or UTF-16 and you don't have
74 // to worry about the character sets. 76 // to worry about the character sets.
75 struct PP_Var (*GetDefaultCharSet)(PP_Module module); 77 struct PP_Var (*GetDefaultCharSet)(PP_Module module);
76 }; 78 };
77 79
78 #endif // PPAPI_C_DEV_PPB_CHAR_SET_DEV_H_ 80 #endif // PPAPI_C_DEV_PPB_CHAR_SET_DEV_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698