diff options
author | Tim Murray <timmurray@google.com> | 2015-04-07 15:43:11 -0700 |
---|---|---|
committer | Tim Murray <timmurray@google.com> | 2015-04-09 12:19:00 -0700 |
commit | ea6e0621b4716ed77635f9d81787ee7057752af1 (patch) | |
tree | e2bbc1ba533bd2dde85997f2d3010012609287da /rsContext.h | |
parent | ca3c91ff8b9a4a4ef092809ab2361ab48940a434 (diff) | |
download | rs-ea6e0621b4716ed77635f9d81787ee7057752af1.tar.gz |
Add cache dir to context object.
Change-Id: Icc3220329fbaee7d453259fbe1cbf34d145d195c
Diffstat (limited to 'rsContext.h')
-rw-r--r-- | rsContext.h | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/rsContext.h b/rsContext.h index 1c6fc58f..dac276f4 100644 --- a/rsContext.h +++ b/rsContext.h @@ -256,13 +256,35 @@ public: #ifdef RS_COMPATIBILITY_LIB void setNativeLibDir(const char * libDir, uint32_t length) { - memcpy(nativeLibDir, libDir, length); + if (!hasSetNativeLibDir) { + if (length <= PATH_MAX) { + memcpy(nativeLibDir, libDir, length); + hasSetNativeLibDir = true; + } else { + setError(RS_ERROR_BAD_VALUE, "Invalid path"); + } + } } const char * getNativeLibDir() { return nativeLibDir; } #endif + void setCacheDir(const char * cacheDir_arg, uint32_t length) { + if (!hasSetCacheDir) { + if (length <= PATH_MAX) { + memcpy(mCacheDir, cacheDir_arg, length); + hasSetCacheDir = true; + } else { + setError(RS_ERROR_BAD_VALUE, "Invalid path"); + } + } + } + const char * getCacheDir() { + return mCacheDir; + } + + protected: uint32_t mTargetSdkVersion; @@ -329,8 +351,11 @@ private: uint64_t mAverageFPSStartTime; uint32_t mAverageFPS; #ifdef RS_COMPATIBILITY_LIB + bool hasSetNativeLibDir = false; char nativeLibDir[PATH_MAX+1]; #endif + bool hasSetCacheDir = false; + char mCacheDir[PATH_MAX+1]; }; void LF_ObjDestroy_handcode(const Context *rsc, RsAsyncVoidPtr objPtr); |