summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/utils/BasicHashtable.h9
-rw-r--r--include/utils/String16.h16
-rw-r--r--include/utils/String8.h18
-rw-r--r--libutils/BasicHashtable.cpp8
-rw-r--r--libutils/SharedBuffer.cpp3
-rw-r--r--libutils/SharedBuffer.h (renamed from include/utils/SharedBuffer.h)0
-rw-r--r--libutils/String16.cpp11
-rw-r--r--libutils/String8.cpp13
-rw-r--r--libutils/VectorImpl.cpp3
9 files changed, 43 insertions, 38 deletions
diff --git a/include/utils/BasicHashtable.h b/include/utils/BasicHashtable.h
index c235d6252..cf4705954 100644
--- a/include/utils/BasicHashtable.h
+++ b/include/utils/BasicHashtable.h
@@ -19,7 +19,6 @@
#include <stdint.h>
#include <sys/types.h>
-#include <utils/SharedBuffer.h>
#include <utils/TypeHelpers.h>
namespace android {
@@ -55,13 +54,7 @@ protected:
virtual ~BasicHashtableImpl();
void dispose();
-
- inline void edit() {
- if (mBuckets && !SharedBuffer::bufferFromData(mBuckets)->onlyOwner()) {
- clone();
- }
- }
-
+ void edit();
void setTo(const BasicHashtableImpl& other);
void clear();
diff --git a/include/utils/String16.h b/include/utils/String16.h
index d131bfc6a..b2ab5dc11 100644
--- a/include/utils/String16.h
+++ b/include/utils/String16.h
@@ -18,7 +18,6 @@
#define ANDROID_STRING16_H
#include <utils/Errors.h>
-#include <utils/SharedBuffer.h>
#include <utils/Unicode.h>
#include <utils/TypeHelpers.h>
@@ -34,6 +33,7 @@ namespace android {
// ---------------------------------------------------------------------------
+class SharedBuffer;
class String8;
class TextOutput;
@@ -64,10 +64,10 @@ public:
~String16();
inline const char16_t* string() const;
- inline size_t size() const;
- inline const SharedBuffer* sharedBuffer() const;
+ const SharedBuffer* sharedBuffer() const;
+ size_t size() const;
void setTo(const String16& other);
status_t setTo(const char16_t* other);
status_t setTo(const char16_t* other, size_t len);
@@ -144,16 +144,6 @@ inline const char16_t* String16::string() const
return mString;
}
-inline size_t String16::size() const
-{
- return SharedBuffer::sizeFromData(mString)/sizeof(char16_t)-1;
-}
-
-inline const SharedBuffer* String16::sharedBuffer() const
-{
- return SharedBuffer::bufferFromData(mString);
-}
-
inline String16& String16::operator=(const String16& other)
{
setTo(other);
diff --git a/include/utils/String8.h b/include/utils/String8.h
index ecfcf10be..a8a37db21 100644
--- a/include/utils/String8.h
+++ b/include/utils/String8.h
@@ -18,7 +18,6 @@
#define ANDROID_STRING8_H
#include <utils/Errors.h>
-#include <utils/SharedBuffer.h>
#include <utils/Unicode.h>
#include <utils/TypeHelpers.h>
@@ -29,6 +28,7 @@
namespace android {
+class SharedBuffer;
class String16;
class TextOutput;
@@ -65,11 +65,11 @@ public:
inline const char* string() const;
inline size_t size() const;
- inline size_t length() const;
inline size_t bytes() const;
inline bool isEmpty() const;
- inline const SharedBuffer* sharedBuffer() const;
+ size_t length() const;
+ const SharedBuffer* sharedBuffer() const;
void clear();
@@ -263,11 +263,6 @@ inline const char* String8::string() const
return mString;
}
-inline size_t String8::length() const
-{
- return SharedBuffer::sizeFromData(mString)-1;
-}
-
inline size_t String8::size() const
{
return length();
@@ -280,12 +275,7 @@ inline bool String8::isEmpty() const
inline size_t String8::bytes() const
{
- return SharedBuffer::sizeFromData(mString)-1;
-}
-
-inline const SharedBuffer* String8::sharedBuffer() const
-{
- return SharedBuffer::bufferFromData(mString);
+ return length();
}
inline bool String8::contains(const char* other) const
diff --git a/libutils/BasicHashtable.cpp b/libutils/BasicHashtable.cpp
index 491d9e98b..1e9f05333 100644
--- a/libutils/BasicHashtable.cpp
+++ b/libutils/BasicHashtable.cpp
@@ -22,6 +22,8 @@
#include <utils/BasicHashtable.h>
#include <utils/misc.h>
+#include "SharedBuffer.h"
+
namespace android {
BasicHashtableImpl::BasicHashtableImpl(size_t entrySize, bool hasTrivialDestructor,
@@ -46,6 +48,12 @@ BasicHashtableImpl::~BasicHashtableImpl()
{
}
+void BasicHashtableImpl::edit() {
+ if (mBuckets && !SharedBuffer::bufferFromData(mBuckets)->onlyOwner()) {
+ clone();
+ }
+}
+
void BasicHashtableImpl::dispose() {
if (mBuckets) {
releaseBuckets(mBuckets, mBucketCount);
diff --git a/libutils/SharedBuffer.cpp b/libutils/SharedBuffer.cpp
index 947551a6a..c7dd1ab34 100644
--- a/libutils/SharedBuffer.cpp
+++ b/libutils/SharedBuffer.cpp
@@ -20,9 +20,10 @@
#include <string.h>
#include <log/log.h>
-#include <utils/SharedBuffer.h>
#include <utils/Atomic.h>
+#include "SharedBuffer.h"
+
// ---------------------------------------------------------------------------
namespace android {
diff --git a/include/utils/SharedBuffer.h b/libutils/SharedBuffer.h
index b6709537e..b6709537e 100644
--- a/include/utils/SharedBuffer.h
+++ b/libutils/SharedBuffer.h
diff --git a/libutils/String16.cpp b/libutils/String16.cpp
index 91efdaa39..67be9d8fa 100644
--- a/libutils/String16.cpp
+++ b/libutils/String16.cpp
@@ -25,6 +25,7 @@
#include <stdio.h>
#include <ctype.h>
+#include "SharedBuffer.h"
namespace android {
@@ -165,6 +166,16 @@ String16::~String16()
SharedBuffer::bufferFromData(mString)->release();
}
+size_t String16::size() const
+{
+ return SharedBuffer::sizeFromData(mString)/sizeof(char16_t)-1;
+}
+
+const SharedBuffer* String16::sharedBuffer() const
+{
+ return SharedBuffer::bufferFromData(mString);
+}
+
void String16::setTo(const String16& other)
{
SharedBuffer::bufferFromData(other.mString)->acquire();
diff --git a/libutils/String8.cpp b/libutils/String8.cpp
index 2d0602357..4fca2c119 100644
--- a/libutils/String8.cpp
+++ b/libutils/String8.cpp
@@ -22,12 +22,13 @@
#include <utils/Compat.h>
#include <utils/Log.h>
#include <utils/Unicode.h>
-#include <utils/SharedBuffer.h>
#include <utils/String16.h>
#include <utils/threads.h>
#include <ctype.h>
+#include "SharedBuffer.h"
+
/*
* Functions outside android is below the namespace android, since they use
* functions and constants in android namespace.
@@ -214,6 +215,16 @@ String8::~String8()
SharedBuffer::bufferFromData(mString)->release();
}
+size_t String8::length() const
+{
+ return SharedBuffer::sizeFromData(mString)-1;
+}
+
+const SharedBuffer* String8::sharedBuffer() const
+{
+ return SharedBuffer::bufferFromData(mString);
+}
+
String8 String8::format(const char* fmt, ...)
{
va_list args;
diff --git a/libutils/VectorImpl.cpp b/libutils/VectorImpl.cpp
index 2f770f590..2ac158b9f 100644
--- a/libutils/VectorImpl.cpp
+++ b/libutils/VectorImpl.cpp
@@ -23,9 +23,10 @@
#include <cutils/log.h>
#include <utils/Errors.h>
-#include <utils/SharedBuffer.h>
#include <utils/VectorImpl.h>
+#include "SharedBuffer.h"
+
/*****************************************************************************/