发现此SO关于gethostuuid depreciated
,但在这种情况下它并没有帮助我。
目标是iOS6.0,在sqlite3.c(v3.7.2)的编译时间:
static int proxyGetHostID(unsigned char *pHostID, int *pError){
struct timespec timeout = {1, 0}; /* 1 sec timeout */
assert(PROXY_HOSTIDLEN == sizeof(uuid_t));
memset(pHostID, 0, PROXY_HOSTIDLEN);
if( gethostuuid(pHostID, &timeout) ){
=>>警告:'gethostuuid' is deprecated: first deprecated in iOS 5.0 - gethostuuid() is no longer supported
int err = errno;
if( pError ){
*pError = err;
}
return SQLITE_IOERR;
}
#ifdef SQLITE_TEST
/* simulate multiple hosts by creating unique hostid file paths */
if( sqlite3_hostid_num != 0){
pHostID[0] = (char)(pHostID[0] + (char)(sqlite3_hostid_num & 0xFF));
}
#endif
return SQLITE_OK;
}
如何替换gethostuuid
中的sqlite3.c
来电?
答案 0 :(得分:3)
找到它。用以下内容替换sqlite3.c中的上述代码spinet:
static int proxyGetHostID(unsigned char *pHostID, int *pError){
assert(PROXY_HOSTIDLEN == sizeof(uuid_t));
memset(pHostID, 0, PROXY_HOSTIDLEN);
#if defined(__MAX_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED<1050
{
static const struct timespec timeout = {1, 0}; /* 1 sec timeout */
if( gethostuuid(pHostID, &timeout) ){
int err = errno;
if( pError ){
*pError = err;
}
return SQLITE_IOERR;
}
}
#else
UNUSED_PARAMETER(pError);
#endif
#ifdef SQLITE_TEST
/* simulate multiple hosts by creating unique hostid file paths */
if( sqlite3_hostid_num != 0){
pHostID[0] = (char)(pHostID[0] + (char)(sqlite3_hostid_num & 0xFF));
}
#endif
return SQLITE_OK;
}
来源:https://groups.google.com/forum/#!topic/sqlcipher/_ji0WbDH88s