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

Side by Side Diff: core/include/fxcrt/fx_basic.h

Issue 818193004: XFA: merge patch from CL 729293003, use FX_ArraySize for safety (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 6 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
« no previous file with comments | « no previous file | core/include/fxcrt/fx_string.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium 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 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #ifndef _FX_BASIC_H_ 7 #ifndef _FX_BASIC_H_
8 #define _FX_BASIC_H_ 8 #define _FX_BASIC_H_
9 #ifndef _FX_SYSTEM_H_ 9 #ifndef _FX_SYSTEM_H_
10 #include "fx_system.h" 10 #include "fx_system.h"
11 #endif 11 #endif
12 #ifndef _FX_MEMORY_H_ 12 #ifndef _FX_MEMORY_H_
13 #include "fx_memory.h" 13 #include "fx_memory.h"
14 #endif 14 #endif
15 #ifndef _FX_STRING_H_ 15 #ifndef _FX_STRING_H_
16 #include "fx_string.h" 16 #include "fx_string.h"
17 #endif 17 #endif
18 #ifndef _FX_STREAM_H_ 18 #ifndef _FX_STREAM_H_
19 #include "fx_stream.h" 19 #include "fx_stream.h"
20 #endif 20 #endif
21
22 // The FX_ArraySize(arr) macro returns the # of elements in an array arr.
23 // The expression is a compile-time constant, and therefore can be
24 // used in defining new arrays, for example. If you use FX_ArraySize on
25 // a pointer by mistake, you will get a compile-time error.
26 //
27 // One caveat is that FX_ArraySize() doesn't accept any array of an
28 // anonymous type or a type defined inside a function.
29 #define FX_ArraySize(array) (sizeof(ArraySizeHelper(array)))
30
31 // This template function declaration is used in defining FX_ArraySize.
32 // Note that the function doesn't need an implementation, as we only
33 // use its type.
34 template <typename T, size_t N>
35 char (&ArraySizeHelper(T (&array)[N]))[N];
36
21 class CFX_BinaryBuf : public CFX_Object 37 class CFX_BinaryBuf : public CFX_Object
22 { 38 {
23 public: 39 public:
24 CFX_BinaryBuf(); 40 CFX_BinaryBuf();
25 CFX_BinaryBuf(FX_STRSIZE size); 41 CFX_BinaryBuf(FX_STRSIZE size);
26 42
27 ~CFX_BinaryBuf(); 43 ~CFX_BinaryBuf();
28 44
29 void Clear(); 45 void Clear();
30 46
(...skipping 1594 matching lines...) Expand 10 before | Expand all | Expand 10 after
1625 FX_FLOAT c; 1641 FX_FLOAT c;
1626 FX_FLOAT d; 1642 FX_FLOAT d;
1627 FX_FLOAT e; 1643 FX_FLOAT e;
1628 FX_FLOAT f; 1644 FX_FLOAT f;
1629 FX_FLOAT g; 1645 FX_FLOAT g;
1630 FX_FLOAT h; 1646 FX_FLOAT h;
1631 FX_FLOAT i; 1647 FX_FLOAT i;
1632 }; 1648 };
1633 1649
1634 #endif 1650 #endif
OLDNEW
« no previous file with comments | « no previous file | core/include/fxcrt/fx_string.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698