summaryrefslogtreecommitdiff
path: root/cpp/RenderScript.cpp
diff options
context:
space:
mode:
authorMiao Wang <miaowang@google.com>2015-04-03 17:44:55 -0700
committerMiao Wang <miaowang@google.com>2015-04-13 17:11:08 -0700
commitbc10dff26207bb8c02051b28326bb134a8f28eb3 (patch)
tree166685cd4ef0a8eb4bb9e15c9e76284b1c607481 /cpp/RenderScript.cpp
parent893754fc6016d6c144788ec94a7db55d1061ef18 (diff)
remove STL from rs C++ public interface. Nuke stlport.
Change-Id: Ida273c1cfa21c4db51ae41a4c42746d9d828f292
Diffstat (limited to 'cpp/RenderScript.cpp')
-rw-r--r--cpp/RenderScript.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/cpp/RenderScript.cpp b/cpp/RenderScript.cpp
index 2a041090..c05e0f90 100644
--- a/cpp/RenderScript.cpp
+++ b/cpp/RenderScript.cpp
@@ -74,7 +74,7 @@ RS::~RS() {
}
}
-bool RS::init(std::string name, uint32_t flags) {
+bool RS::init(const char * name, uint32_t flags) {
return RS::init(name, RS_VERSION, flags);
}
@@ -139,7 +139,7 @@ bool RS::initDispatch(int targetApi) {
return false;
}
-bool RS::init(std::string &name, int targetApi, uint32_t flags) {
+bool RS::init(const char * name, int targetApi, uint32_t flags) {
if (mInit) {
return true;
}
@@ -149,7 +149,14 @@ bool RS::init(std::string &name, int targetApi, uint32_t flags) {
return false;
}
- mCacheDir = name;
+ uint32_t nameLen = strlen(name);
+ if (nameLen > PATH_MAX) {
+ ALOGE("The path to the cache directory is too long");
+ return false;
+ }
+ memcpy(mCacheDir, name, nameLen);
+ mCacheDir[nameLen] = 0; //add the null character even if the user does not.
+ mCacheDirLen = nameLen + 1;
mDev = RS::dispatch->DeviceCreate();
if (mDev == 0) {