2

Found this SO about gethostuuid depreciated but it's not helping me much in this case.

Target is iOS6.0, at compil time in 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) ){     

=>> warning: '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;
}
  • I understand that gethostuuid has been deprecated in iOS 5.0.
  • And that the API gethostuuid() has been removed and will not be accepted for submission to the store, regardless of the targeted OS. For existing apps running on iOS 7, the function will return a uuid_t representation of the vendor identifier (-[UIDevice identifierForVendor]).

How to replace the call to gethostuuid in sqlite3.c?

Community
  • 1
  • 1
lucasart
  • 1,643
  • 1
  • 20
  • 29

1 Answers1

3

Found it. Replace the above code spinet in sqlite3.c with the following:

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;
}

Source: https://groups.google.com/forum/#!topic/sqlcipher/_ji0WbDH88s

lucasart
  • 1,643
  • 1
  • 20
  • 29