diff --git a/src/gfxstream/aemu/Stream.cpp b/src/gfxstream/aemu/Stream.cpp index c75311b589e..99b8e6348d7 100644 --- a/src/gfxstream/aemu/Stream.cpp +++ b/src/gfxstream/aemu/Stream.cpp @@ -3,13 +3,13 @@ * SPDX-License-Identifier: MIT */ -#include "aemu/base/files/Stream.h" +#include "Stream.h" #include #include -namespace android { -namespace base { +namespace gfxstream { +namespace aemu { void Stream::putByte(uint8_t value) { write(&value, 1U); } @@ -208,5 +208,12 @@ void Stream::fromBe64(uint8_t* v) { memcpy(v, &value, sizeof(uint64_t)); } -} // namespace base -} // namespace android +void saveStringArray(Stream* stream, const char* const* strings, uint32_t count) { + stream->putBe32(count); + for (uint32_t i = 0; i < count; ++i) { + stream->putString(strings[i]); + } +} + +} // namespace aemu +} // namespace gfxstream diff --git a/src/gfxstream/aemu/include/AlignedBuf.h b/src/gfxstream/aemu/include/AlignedBuf.h index 48a1f42d5eb..767f364af5d 100644 --- a/src/gfxstream/aemu/include/AlignedBuf.h +++ b/src/gfxstream/aemu/include/AlignedBuf.h @@ -19,7 +19,7 @@ #include #endif -namespace android { +namespace gfxstream { /** * Do not abuse this by using any complicated T. Use it for POD or primitives @@ -147,4 +147,4 @@ class AlignedBuf { void* aligned_buf_alloc(size_t align, size_t size); void aligned_buf_free(void* buf); -} // namespace android +} // namespace gfxstream diff --git a/src/gfxstream/aemu/include/Allocator.h b/src/gfxstream/aemu/include/Allocator.h index 6cd7ffb50ec..c0f83d14cfa 100644 --- a/src/gfxstream/aemu/include/Allocator.h +++ b/src/gfxstream/aemu/include/Allocator.h @@ -8,8 +8,8 @@ #include #include -namespace android { -namespace base { +namespace gfxstream { +namespace aemu { // A generic memory allocator interface which could be used to allocate // a certain size of memory region, or memory region for arrays / strings. @@ -55,5 +55,5 @@ class Allocator { } }; -} // namespace base -} // namespace android +} // namespace aemu +} // namespace gfxstream diff --git a/src/gfxstream/aemu/include/BumpPool.h b/src/gfxstream/aemu/include/BumpPool.h index 46a3b85908e..e95e36be462 100644 --- a/src/gfxstream/aemu/include/BumpPool.h +++ b/src/gfxstream/aemu/include/BumpPool.h @@ -9,11 +9,11 @@ #include #include -#include "aemu/base/AlignedBuf.h" -#include "aemu/base/Allocator.h" +#include "AlignedBuf.h" +#include "Allocator.h" -namespace android { -namespace base { +namespace gfxstream { +namespace aemu { // Class to make it easier to set up memory regions where it is fast // to allocate buffers AND we don't care about freeing individual pieces, @@ -65,5 +65,5 @@ class BumpPool : public Allocator { bool mNeedRealloc = false; }; -} // namespace base -} // namespace android +} // namespace aemu +} // namespace gfxstream diff --git a/src/gfxstream/aemu/include/Stream.h b/src/gfxstream/aemu/include/Stream.h index 96460c89a17..df93d7883b7 100644 --- a/src/gfxstream/aemu/include/Stream.h +++ b/src/gfxstream/aemu/include/Stream.h @@ -10,10 +10,8 @@ #include -#include "aemu/base/msvc.h" - -namespace android { -namespace base { +namespace gfxstream { +namespace aemu { // Abstract interface to byte streams of all kind. // This is mainly used to implement disk serialization. @@ -109,5 +107,7 @@ class Stream { static void fromBe64(uint8_t*); }; -} // namespace base -} // namespace android +void saveStringArray(Stream* stream, const char* const* strings, uint32_t count); + +} // namespace aemu +} // namespace gfxstream diff --git a/src/gfxstream/aemu/include/ring_buffer.h b/src/gfxstream/aemu/include/ring_buffer.h index fffe841fd15..920402d5bb3 100644 --- a/src/gfxstream/aemu/include/ring_buffer.h +++ b/src/gfxstream/aemu/include/ring_buffer.h @@ -4,6 +4,10 @@ */ #pragma once +#ifdef __cplusplus +extern "C" { +#endif + #include #include @@ -169,3 +173,7 @@ void ring_buffer_consumer_hung_up(struct ring_buffer* r); // Convenient function to reschedule thread void ring_buffer_yield(); + +#ifdef __cplusplus +} +#endif diff --git a/src/gfxstream/aemu/ring_buffer.cpp b/src/gfxstream/aemu/ring_buffer.cpp index bd5168a29bb..a0941577165 100644 --- a/src/gfxstream/aemu/ring_buffer.cpp +++ b/src/gfxstream/aemu/ring_buffer.cpp @@ -2,7 +2,7 @@ * Copyright 2018 Google * SPDX-License-Identifier: MIT */ -#include "aemu/base/ring_buffer.h" +#include "ring_buffer.h" #include #include