OLD | NEW |
1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 /* Copyright (c) 2010 The Chromium OS 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 * Stub implementations of utility functions which call their linux-specific | 5 * Implementations of stateful memory operations. |
6 * equivalents. | |
7 */ | 6 */ |
8 | 7 |
9 #include "stateful_util.h" | 8 #include "stateful_util.h" |
10 | 9 |
11 #include "utility.h" | 10 #include "utility.h" |
12 | 11 |
13 void* StatefulSkip(MemcpyState* state, uint64_t len) { | 12 void* StatefulSkip(MemcpyState* state, uint64_t len) { |
14 if (state->overrun) | 13 if (state->overrun) |
15 return NULL; | 14 return NULL; |
16 if (len > state->remaining_len) { | 15 if (len > state->remaining_len) { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 return NULL; | 55 return NULL; |
57 if (len > state->remaining_len) { | 56 if (len > state->remaining_len) { |
58 state->overrun = 1; | 57 state->overrun = 1; |
59 return NULL; | 58 return NULL; |
60 } | 59 } |
61 Memset(state->remaining_buf, val, len); | 60 Memset(state->remaining_buf, val, len); |
62 state->remaining_buf += len; | 61 state->remaining_buf += len; |
63 state->remaining_len -= len; | 62 state->remaining_len -= len; |
64 return state; // have to return something non-NULL | 63 return state; // have to return something non-NULL |
65 } | 64 } |
OLD | NEW |