OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. |
3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 | 7 |
8 /* NaCl inter-module communication primitives. */ | 8 /* NaCl inter-module communication primitives. */ |
9 | 9 |
| 10 #include "native_client/src/include/nacl_defines.h" |
| 11 |
10 /* Used for UINT32_MAX */ | 12 /* Used for UINT32_MAX */ |
11 #if !NACL_WINDOWS | 13 #if !NACL_WINDOWS |
12 # ifndef __STDC_LIMIT_MACROS | 14 # ifndef __STDC_LIMIT_MACROS |
13 # define __STDC_LIMIT_MACROS | 15 # define __STDC_LIMIT_MACROS |
14 # endif | 16 # endif |
15 #include <stdint.h> | 17 #include <stdint.h> |
16 #endif | 18 #endif |
17 | 19 |
18 /* TODO(robertm): stdio.h is included for NULL only - find a better way */ | 20 /* TODO(robertm): stdio.h is included for NULL only - find a better way */ |
19 #include <stdio.h> | 21 #include <stdio.h> |
(...skipping 11 matching lines...) Expand all Loading... |
31 /* we assume that sizeof(uint32_t) <= sizeof(size_t) */ | 33 /* we assume that sizeof(uint32_t) <= sizeof(size_t) */ |
32 | 34 |
33 for (ix = 0; ix < message->iov_length; ++ix) { | 35 for (ix = 0; ix < message->iov_length; ++ix) { |
34 if (kMax - cur_bytes < message->iov[ix].length) { | 36 if (kMax - cur_bytes < message->iov[ix].length) { |
35 return 0; | 37 return 0; |
36 } | 38 } |
37 cur_bytes += message->iov[ix].length; /* no overflow is possible */ | 39 cur_bytes += message->iov[ix].length; /* no overflow is possible */ |
38 } | 40 } |
39 return 1; | 41 return 1; |
40 } | 42 } |
OLD | NEW |