summaryrefslogtreecommitdiff
path: root/rsContext.h
diff options
context:
space:
mode:
authorTim Murray <timmurray@google.com>2015-04-07 15:43:11 -0700
committerTim Murray <timmurray@google.com>2015-04-09 12:19:00 -0700
commitea6e0621b4716ed77635f9d81787ee7057752af1 (patch)
treee2bbc1ba533bd2dde85997f2d3010012609287da /rsContext.h
parentca3c91ff8b9a4a4ef092809ab2361ab48940a434 (diff)
downloadrs-ea6e0621b4716ed77635f9d81787ee7057752af1.tar.gz
Add cache dir to context object.
Change-Id: Icc3220329fbaee7d453259fbe1cbf34d145d195c
Diffstat (limited to 'rsContext.h')
-rw-r--r--rsContext.h27
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);