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 * Stub implementations of utility functions which call their linux-specific |
6 * equivalents. | 6 * equivalents. |
7 */ | 7 */ |
8 | 8 |
9 #include "stateful_util.h" | 9 #include "stateful_util.h" |
10 | 10 |
11 #include <stdarg.h> | 11 #include "utility.h" |
12 #include <stdio.h> | |
13 #include <stdlib.h> | |
14 | 12 |
15 void* StatefulSkip(MemcpyState* state, uint64_t len) { | 13 void* StatefulSkip(MemcpyState* state, uint64_t len) { |
16 if (state->overrun) | 14 if (state->overrun) |
17 return NULL; | 15 return NULL; |
18 if (len > state->remaining_len) { | 16 if (len > state->remaining_len) { |
19 state->overrun = 1; | 17 state->overrun = 1; |
20 return NULL; | 18 return NULL; |
21 } | 19 } |
22 state->remaining_buf += len; | 20 state->remaining_buf += len; |
23 state->remaining_len -= len; | 21 state->remaining_len -= len; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 return NULL; | 56 return NULL; |
59 if (len > state->remaining_len) { | 57 if (len > state->remaining_len) { |
60 state->overrun = 1; | 58 state->overrun = 1; |
61 return NULL; | 59 return NULL; |
62 } | 60 } |
63 Memset(state->remaining_buf, val, len); | 61 Memset(state->remaining_buf, val, len); |
64 state->remaining_buf += len; | 62 state->remaining_buf += len; |
65 state->remaining_len -= len; | 63 state->remaining_len -= len; |
66 return state; // have to return something non-NULL | 64 return state; // have to return something non-NULL |
67 } | 65 } |
OLD | NEW |