static void piGetRoomKeysCallbackW ( CHAT chat, CHATBool success, const unsigned short * channel, const unsigned short * user, int num, const unsigned short ** keys, const unsigned short ** values, void * param ) { char* channel_A = UCS2ToUTF8StringAlloc(channel); char* user_A = UCS2ToUTF8StringAlloc(user); char** keys_A = UCS2ToUTF8StringArrayAlloc(keys, num); char** values_A = UCS2ToUTF8StringArrayAlloc(values, num); int i; piGetRoomKeysCallbackA(chat, success, channel_A, user_A, num, (const char**)keys_A, (const char**)values_A, param); gsifree(channel_A); gsifree(user_A); for(i=0; i<num; i++) { if (keys_A != NULL) gsifree(keys_A[i]); if (values_A != NULL) gsifree(values_A[i]); } gsifree(keys_A); gsifree(values_A); }
static const unsigned short * piGetWatchKeyW ( const unsigned short * nick, const unsigned short * key, HashTable watchCache ) { #ifndef GSI_UNICODE GSI_UNUSED(nick); GSI_UNUSED(key); GSI_UNUSED(watchCache); return NULL; // can't use this function unless in GSI_UNICODE mode #else piCacheKey keyTemp; piCacheKey * cacheKey; char* nick_A = UCS2ToUTF8StringAlloc(nick); char* key_A = UCS2ToUTF8StringAlloc(key); keyTemp.nick = (char *)nick_A; keyTemp.key = (char *)key_A; cacheKey = (piCacheKey *)TableLookup(watchCache, &keyTemp); gsifree(nick_A); gsifree(key_A); if (!cacheKey) return NULL; if(cacheKey->value_W) return cacheKey->value_W; return L""; #endif }
const unsigned short *SBServerGetStringValueW(SBServer server, const unsigned short *keyname, const unsigned short *def) { char* keyname_A = UCS2ToUTF8StringAlloc(keyname); const char* value = SBServerGetStringValueA(server, keyname_A, NULL); if (value == NULL) return def; else { // Since we need the unicode version, we have to dig down to the // reference counted string structure SBRefString ref, *val; ref.str = value; val = (SBRefString *)TableLookup(SBRefStrHash(NULL), &ref); if (val == NULL) return def; // this shouldn't happen return val->str_W; } }