From 1941642607e8fee60f508faa1215062e7db41519 Mon Sep 17 00:00:00 2001 From: Eric House Date: Fri, 6 Jul 2018 06:56:54 -0700 Subject: [PATCH] add load and store to dutils, and implement with stubs --- xwords4/android/jni/utilwrapper.c | 16 ++++++++++++++++ xwords4/common/dutil.h | 10 ++++++++++ xwords4/linux/lindutil.c | 21 +++++++++++++++++++++ 3 files changed, 47 insertions(+) diff --git a/xwords4/android/jni/utilwrapper.c b/xwords4/android/jni/utilwrapper.c index 3428afa3b..dec3de003 100644 --- a/xwords4/android/jni/utilwrapper.c +++ b/xwords4/android/jni/utilwrapper.c @@ -458,6 +458,20 @@ and_dutil_getUserQuantityString( XW_DUtilCtxt* duc, XP_U16 stringCode, XP_U16 qu return result; } +static void +and_dutil_store( XW_DUtilCtxt* duc, const XP_UCHAR* key, XWStreamCtxt* data ) +{ + XP_LOGF( "%s() NOT IMPLEMENTED", __func__ ); + // XP_ASSERT(0); +} + +static void +and_dutil_load( XW_DUtilCtxt* duc, const XP_UCHAR* key,XWStreamCtxt* inOut ) +{ + XP_LOGF( "%s() NOT IMPLEMENTED", __func__ ); + // XP_ASSERT(0); +} + static void and_util_notifyIllegalWords( XW_UtilCtxt* uc, BadWordInfo* bwi, XP_U16 turn, XP_Bool turnLost ) @@ -809,6 +823,8 @@ makeDUtil( MPFORMAL EnvThreadInfo* ti, jobject jdutil, VTableMgr* vtMgr, SET_DPROC(getCurSeconds); SET_DPROC(getUserString); SET_DPROC(getUserQuantityString); + SET_DPROC(store); + SET_DPROC(load); # ifdef XWFEATURE_DEVID SET_DPROC(getDevID); SET_DPROC(deviceRegistered); diff --git a/xwords4/common/dutil.h b/xwords4/common/dutil.h index 76e3920d6..ae7d4aa3d 100644 --- a/xwords4/common/dutil.h +++ b/xwords4/common/dutil.h @@ -33,6 +33,11 @@ typedef struct _DUtilVtable { const XP_UCHAR* (*m_dutil_getUserQuantityString)( XW_DUtilCtxt* duc, XP_U16 stringCode, XP_U16 quantity ); + void (*m_dutil_store)( XW_DUtilCtxt* duc, const XP_UCHAR* key, + XWStreamCtxt* data ); + /* Pass in an empty stream, and it'll be returned full */ + void (*m_dutil_load)( XW_DUtilCtxt* duc, const XP_UCHAR* key, + XWStreamCtxt* inOut ); #ifdef XWFEATURE_SMS XP_Bool (*m_dutil_phoneNumbersSame)( XW_DUtilCtxt* uc, const XP_UCHAR* p1, const XP_UCHAR* p2 ); @@ -67,6 +72,11 @@ struct XW_DUtilCtxt { #define dutil_getUserQuantityString( duc, c, q ) \ (duc)->vtable.m_dutil_getUserQuantityString((duc),(c),(q)) +#define dutil_stor(duc, k, v) \ + (duc)->vtable.m_dutil_store((duc), (k), (v)); +#define dutil_load(uc, k, s) \ + (duc)->vtable.m_dutil_load((duc), (k), (s)); + #ifdef XWFEATURE_SMS # define dutil_phoneNumbersSame(duc,p1,p2) \ (duc)->vtable.m_dutil_phoneNumbersSame( (duc), (p1), (p2) ) diff --git a/xwords4/linux/lindutil.c b/xwords4/linux/lindutil.c index 4e6904b74..6b0cf5fc3 100644 --- a/xwords4/linux/lindutil.c +++ b/xwords4/linux/lindutil.c @@ -30,6 +30,9 @@ static const XP_UCHAR* linux_dutil_getUserString( XW_DUtilCtxt* duc, XP_U16 code static const XP_UCHAR* linux_dutil_getUserQuantityString( XW_DUtilCtxt* duc, XP_U16 code, XP_U16 quantity ); +static void linux_dutil_store( XW_DUtilCtxt* duc, const XP_UCHAR* key, + XWStreamCtxt* data ); +static void linux_dutil_load( XW_DUtilCtxt* duc, const XP_UCHAR* key, XWStreamCtxt* inOut ); #ifdef XWFEATURE_SMS static XP_Bool linux_dutil_phoneNumbersSame( XW_DUtilCtxt* duc, const XP_UCHAR* p1, @@ -60,6 +63,8 @@ dutils_init( MPFORMAL VTableMgr* vtMgr, void* closure ) SET_PROC(getCurSeconds); SET_PROC(getUserString); SET_PROC(getUserQuantityString); + SET_PROC(store); + SET_PROC(load); #ifdef XWFEATURE_SMS SET_PROC(phoneNumbersSame); @@ -174,6 +179,22 @@ linux_dutil_getUserQuantityString( XW_DUtilCtxt* duc, XP_U16 code, return linux_dutil_getUserString( duc, code ); } +static void +linux_dutil_store( XW_DUtilCtxt* duc, const XP_UCHAR* key, XWStreamCtxt* data ) +{ + XP_LOGF( "%s(key=%s)", __func__, key ); + XP_USE( duc ); + XP_USE( data ); +} + +static void +linux_dutil_load( XW_DUtilCtxt* duc, const XP_UCHAR* key, XWStreamCtxt* inOut ) +{ + XP_LOGF( "%s(key=%s)", __func__, key ); + XP_USE( duc ); + XP_USE( inOut ); +} + #ifdef XWFEATURE_SMS static XP_Bool linux_dutil_phoneNumbersSame( XW_DUtilCtxt* duc, const XP_UCHAR* p1,