diff options
Diffstat (limited to 'linden/indra/llmessage/llcachename.cpp')
-rw-r--r-- | linden/indra/llmessage/llcachename.cpp | 55 |
1 files changed, 46 insertions, 9 deletions
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) | |||
276 | impl.mObservers.push_back(callback); | 276 | impl.mObservers.push_back(callback); |
277 | } | 277 | } |
278 | 278 | ||
279 | void LLCacheName::removeObserver(LLCacheNameCallback callback) | ||
280 | { | ||
281 | Observers::iterator it = impl.mObservers.begin(); | ||
282 | Observers::iterator end = impl.mObservers.end(); | ||
283 | |||
284 | for ( ; it != end; ++it) | ||
285 | { | ||
286 | const LLCacheNameCallback& cb = (*it); | ||
287 | if (cb == callback) | ||
288 | { | ||
289 | impl.mObservers.erase(it); | ||
290 | return; | ||
291 | } | ||
292 | } | ||
293 | } | ||
294 | |||
295 | void LLCacheName::cancelCallback(const LLUUID& id, LLCacheNameCallback callback, void* user_data) | ||
296 | { | ||
297 | ReplyQueue::iterator it = impl.mReplyQueue.begin(); | ||
298 | ReplyQueue::iterator end = impl.mReplyQueue.end(); | ||
299 | |||
300 | for(; it != end; ++it) | ||
301 | { | ||
302 | const PendingReply& reply = (*it); | ||
303 | |||
304 | if ((callback == reply.mCallback) | ||
305 | && (id == reply.mID) | ||
306 | && (user_data == reply.mData) ) | ||
307 | { | ||
308 | impl.mReplyQueue.erase(it); | ||
309 | return; | ||
310 | } | ||
311 | } | ||
312 | } | ||
279 | 313 | ||
280 | void LLCacheName::importFile(FILE* fp) | 314 | void LLCacheName::importFile(FILE* fp) |
281 | { | 315 | { |
@@ -297,7 +331,10 @@ void LLCacheName::importFile(FILE* fp) | |||
297 | // *NOTE: This buffer size is hardcoded into sscanf() below | 331 | // *NOTE: This buffer size is hardcoded into sscanf() below |
298 | char version_string[BUFFER_SIZE]; /*Flawfinder: ignore*/ | 332 | char version_string[BUFFER_SIZE]; /*Flawfinder: ignore*/ |
299 | S32 version = 0; | 333 | S32 version = 0; |
300 | S32 match = sscanf(buffer, "%1023s %d", version_string, &version); | 334 | S32 match = sscanf( /* Flawfinder: ignore */ |
335 | buffer, | ||
336 | "%1023s %d", | ||
337 | version_string, &version); | ||
301 | if ( match != 2 | 338 | if ( match != 2 |
302 | || strcmp(version_string, "version") | 339 | || strcmp(version_string, "version") |
303 | || version != CN_FILE_VERSION) | 340 | || version != CN_FILE_VERSION) |
@@ -316,7 +353,7 @@ void LLCacheName::importFile(FILE* fp) | |||
316 | valid = fgets(buffer, BUFFER_SIZE, fp); | 353 | valid = fgets(buffer, BUFFER_SIZE, fp); |
317 | if (!valid) break; | 354 | if (!valid) break; |
318 | 355 | ||
319 | match = sscanf( | 356 | match = sscanf( /* Flawfinder: ignore */ |
320 | buffer, | 357 | buffer, |
321 | "%254s %u %254s %254s", | 358 | "%254s %u %254s %254s", |
322 | id_string, | 359 | id_string, |
@@ -395,7 +432,7 @@ BOOL LLCacheName::getName(const LLUUID& id, char* first, char* last) | |||
395 | { | 432 | { |
396 | // The function signature needs to change to pass in the | 433 | // The function signature needs to change to pass in the |
397 | // length of first and last. | 434 | // length of first and last. |
398 | strcpy(first, CN_NOBODY); | 435 | strcpy(first, CN_NOBODY); /*Flawfinder: ignore*/ |
399 | last[0] = '\0'; | 436 | last[0] = '\0'; |
400 | return FALSE; | 437 | return FALSE; |
401 | } | 438 | } |
@@ -405,8 +442,8 @@ BOOL LLCacheName::getName(const LLUUID& id, char* first, char* last) | |||
405 | { | 442 | { |
406 | // The function signature needs to change to pass in the | 443 | // The function signature needs to change to pass in the |
407 | // length of first and last. | 444 | // length of first and last. |
408 | strcpy(first, entry->mFirstName); | 445 | strcpy(first, entry->mFirstName); /*Flawfinder: ignore*/ |
409 | strcpy(last, entry->mLastName); | 446 | strcpy(last, entry->mLastName); /*Flawfinder: ignore*/ |
410 | return TRUE; | 447 | return TRUE; |
411 | } | 448 | } |
412 | else | 449 | else |
@@ -416,7 +453,7 @@ BOOL LLCacheName::getName(const LLUUID& id, char* first, char* last) | |||
416 | strcpy(first,(ll_frand() < HIPPO_PROBABILITY) | 453 | strcpy(first,(ll_frand() < HIPPO_PROBABILITY) |
417 | ? CN_HIPPOS | 454 | ? CN_HIPPOS |
418 | : CN_WAITING); | 455 | : CN_WAITING); |
419 | strcpy(last, ""); | 456 | strcpy(last, ""); /*Flawfinder: ignore*/ |
420 | 457 | ||
421 | impl.mAskNameQueue.push_back(id); | 458 | impl.mAskNameQueue.push_back(id); |
422 | return FALSE; | 459 | return FALSE; |
@@ -432,7 +469,7 @@ BOOL LLCacheName::getGroupName(const LLUUID& id, char* group) | |||
432 | { | 469 | { |
433 | // The function signature needs to change to pass in the | 470 | // The function signature needs to change to pass in the |
434 | // length of first and last. | 471 | // length of first and last. |
435 | strcpy(group, CN_NONE); | 472 | strcpy(group, CN_NONE); /*Flawfinder: ignore*/ |
436 | return FALSE; | 473 | return FALSE; |
437 | } | 474 | } |
438 | 475 | ||
@@ -450,14 +487,14 @@ BOOL LLCacheName::getGroupName(const LLUUID& id, char* group) | |||
450 | { | 487 | { |
451 | // The function signature needs to change to pass in the length | 488 | // The function signature needs to change to pass in the length |
452 | // of group. | 489 | // of group. |
453 | strcpy(group, entry->mGroupName); | 490 | strcpy(group, entry->mGroupName); /*Flawfinder: ignore*/ |
454 | return TRUE; | 491 | return TRUE; |
455 | } | 492 | } |
456 | else | 493 | else |
457 | { | 494 | { |
458 | // The function signature needs to change to pass in the length | 495 | // The function signature needs to change to pass in the length |
459 | // of first and last. | 496 | // of first and last. |
460 | strcpy(group, CN_WAITING); | 497 | strcpy(group, CN_WAITING); /*Flawfinder: ignore*/ |
461 | 498 | ||
462 | impl.mAskGroupQueue.push_back(id); | 499 | impl.mAskGroupQueue.push_back(id); |
463 | return FALSE; | 500 | return FALSE; |