summaryrefslogtreecommitdiff
path: root/rsContext.cpp
diff options
context:
space:
mode:
authorJason Sams <jsams@google.com>2015-05-18 18:40:47 -0700
committerJason Sams <jsams@google.com>2015-05-18 18:40:47 -0700
commit867ce7f7985175e77f679141b698c474bd52b4c1 (patch)
tree16721cc342236d7d4e6c71f088c8ec5c5ea41be2 /rsContext.cpp
parent874ed8dee9ab7118efb517f6a8a9c1758818fd4c (diff)
downloadrs-867ce7f7985175e77f679141b698c474bd52b4c1.tar.gz
Fix cache path initialization and set.
Add null terminator to strings Return nullptr if string is not set bug 20894664 Change-Id: I33f5d84d56f6299558f5d8713694e40afc82dd20
Diffstat (limited to 'rsContext.cpp')
-rw-r--r--rsContext.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/rsContext.cpp b/rsContext.cpp
index 29b4036f..fba06cd9 100644
--- a/rsContext.cpp
+++ b/rsContext.cpp
@@ -459,8 +459,26 @@ Context::Context() {
mContextType = RS_CONTEXT_TYPE_NORMAL;
mSynchronous = false;
mFatalErrorOccured = false;
+
+ memset(mCacheDir, 0, sizeof(mCacheDir));
+#ifdef RS_COMPATIBILITY_LIB
+ memset(nativeLibDir, 0, sizeof(nativeLibDir));
+#endif
}
+void Context::setCacheDir(const char * cacheDir_arg, uint32_t length) {
+ if (!hasSetCacheDir) {
+ if (length <= PATH_MAX) {
+ memcpy(mCacheDir, cacheDir_arg, length);
+ mCacheDir[length] = 0;
+ hasSetCacheDir = true;
+ } else {
+ setError(RS_ERROR_BAD_VALUE, "Invalid path");
+ }
+ }
+}
+
+
Context * Context::createContext(Device *dev, const RsSurfaceConfig *sc,
RsContextType ct, uint32_t flags) {
Context * rsc = new Context();