From 89fe5dab825a62a0e3fd8d248cbc91c65eb2a426 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Fri, 15 Aug 2008 23:44:50 -0500 Subject: Second Life viewer sources 1.14.0.0 --- linden/indra/llmessage/llcachename.cpp | 55 ++++++++++++++++++++++++++++------ 1 file changed, 46 insertions(+), 9 deletions(-) (limited to 'linden/indra/llmessage/llcachename.cpp') diff --git a/linden/indra/llmessage/llcachename.cpp b/linden/indra/llmessage/llcachename.cpp index 3a92812..e92c72f 100644 --- a/linden/indra/llmessage/llcachename.cpp +++ b/linden/indra/llmessage/llcachename.cpp @@ -276,6 +276,40 @@ void LLCacheName::addObserver(LLCacheNameCallback callback) impl.mObservers.push_back(callback); } +void LLCacheName::removeObserver(LLCacheNameCallback callback) +{ + Observers::iterator it = impl.mObservers.begin(); + Observers::iterator end = impl.mObservers.end(); + + for ( ; it != end; ++it) + { + const LLCacheNameCallback& cb = (*it); + if (cb == callback) + { + impl.mObservers.erase(it); + return; + } + } +} + +void LLCacheName::cancelCallback(const LLUUID& id, LLCacheNameCallback callback, void* user_data) +{ + ReplyQueue::iterator it = impl.mReplyQueue.begin(); + ReplyQueue::iterator end = impl.mReplyQueue.end(); + + for(; it != end; ++it) + { + const PendingReply& reply = (*it); + + if ((callback == reply.mCallback) + && (id == reply.mID) + && (user_data == reply.mData) ) + { + impl.mReplyQueue.erase(it); + return; + } + } +} void LLCacheName::importFile(FILE* fp) { @@ -297,7 +331,10 @@ void LLCacheName::importFile(FILE* fp) // *NOTE: This buffer size is hardcoded into sscanf() below char version_string[BUFFER_SIZE]; /*Flawfinder: ignore*/ S32 version = 0; - S32 match = sscanf(buffer, "%1023s %d", version_string, &version); + S32 match = sscanf( /* Flawfinder: ignore */ + buffer, + "%1023s %d", + version_string, &version); if ( match != 2 || strcmp(version_string, "version") || version != CN_FILE_VERSION) @@ -316,7 +353,7 @@ void LLCacheName::importFile(FILE* fp) valid = fgets(buffer, BUFFER_SIZE, fp); if (!valid) break; - match = sscanf( + match = sscanf( /* Flawfinder: ignore */ buffer, "%254s %u %254s %254s", id_string, @@ -395,7 +432,7 @@ BOOL LLCacheName::getName(const LLUUID& id, char* first, char* last) { // The function signature needs to change to pass in the // length of first and last. - strcpy(first, CN_NOBODY); + strcpy(first, CN_NOBODY); /*Flawfinder: ignore*/ last[0] = '\0'; return FALSE; } @@ -405,8 +442,8 @@ BOOL LLCacheName::getName(const LLUUID& id, char* first, char* last) { // The function signature needs to change to pass in the // length of first and last. - strcpy(first, entry->mFirstName); - strcpy(last, entry->mLastName); + strcpy(first, entry->mFirstName); /*Flawfinder: ignore*/ + strcpy(last, entry->mLastName); /*Flawfinder: ignore*/ return TRUE; } else @@ -416,7 +453,7 @@ BOOL LLCacheName::getName(const LLUUID& id, char* first, char* last) strcpy(first,(ll_frand() < HIPPO_PROBABILITY) ? CN_HIPPOS : CN_WAITING); - strcpy(last, ""); + strcpy(last, ""); /*Flawfinder: ignore*/ impl.mAskNameQueue.push_back(id); return FALSE; @@ -432,7 +469,7 @@ BOOL LLCacheName::getGroupName(const LLUUID& id, char* group) { // The function signature needs to change to pass in the // length of first and last. - strcpy(group, CN_NONE); + strcpy(group, CN_NONE); /*Flawfinder: ignore*/ return FALSE; } @@ -450,14 +487,14 @@ BOOL LLCacheName::getGroupName(const LLUUID& id, char* group) { // The function signature needs to change to pass in the length // of group. - strcpy(group, entry->mGroupName); + strcpy(group, entry->mGroupName); /*Flawfinder: ignore*/ return TRUE; } else { // The function signature needs to change to pass in the length // of first and last. - strcpy(group, CN_WAITING); + strcpy(group, CN_WAITING); /*Flawfinder: ignore*/ impl.mAskGroupQueue.push_back(id); return FALSE; -- cgit v1.1