blob: 0883c75296c31193cdd10180cc0d5a9d00746353 [file] [log] [blame]
mukesh agrawal5a4f6db2016-10-13 16:06:50 -07001/*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "wifilogd/memory_reader.h"
18
19namespace android {
20namespace wifilogd {
21
22const uint8_t* MemoryReader::GetBytesOrDie(size_t n_bytes) {
23 CHECK(head_);
24 CHECK(n_bytes <= n_bytes_avail_);
25
26 const uint8_t* old_head = head_;
27 head_ += n_bytes;
28 n_bytes_avail_ -= n_bytes;
29
30 return old_head;
31}
32
33} // namespace wifilogd
34} // namespace android