diff options
Diffstat (limited to 'cpp/RenderScript.cpp')
| -rw-r--r-- | cpp/RenderScript.cpp | 13 |
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) { |
