diff options
| author | Rider Linden <rider@lindenlab.com> | 2015-08-28 10:05:15 -0700 | 
|---|---|---|
| committer | Rider Linden <rider@lindenlab.com> | 2015-08-28 10:05:15 -0700 | 
| commit | 02c3262ac8e7f27b0effb546ad235e103c9581cf (patch) | |
| tree | 0c432abf7c57e55e11d3f480ad17ceccce89ed89 | |
| parent | ac3af19539e0f3a4d8557cc68f19781893de2fc3 (diff) | |
MAINT-5574: Added default parameter for callbalk on AISAPI interface.
Better check on callback exsit in coroutine
Don't create AISAPI::completion_t if there is no call back passed.
| -rwxr-xr-x | indra/newview/llaisapi.cpp | 2 | ||||
| -rwxr-xr-x | indra/newview/llaisapi.h | 16 | ||||
| -rwxr-xr-x | indra/newview/llviewerinventory.cpp | 16 | 
3 files changed, 17 insertions, 17 deletions
| diff --git a/indra/newview/llaisapi.cpp b/indra/newview/llaisapi.cpp index 5d2c48a1b4..da2f69126a 100755 --- a/indra/newview/llaisapi.cpp +++ b/indra/newview/llaisapi.cpp @@ -400,7 +400,7 @@ void AISAPI::InvokeAISCommandCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t ht      gInventory.onAISUpdateReceived("AISCommand", result); -    if (callback) +    if (callback && !callback.empty())      {             LLUUID id(LLUUID::null); diff --git a/indra/newview/llaisapi.h b/indra/newview/llaisapi.h index cc6bda3c7f..2de8003c2f 100755 --- a/indra/newview/llaisapi.h +++ b/indra/newview/llaisapi.h @@ -46,14 +46,14 @@ public:      static bool isAvailable();      static void getCapNames(LLSD& capNames); -    static void CreateInventory(const LLUUID& parentId, const LLSD& newInventory, completion_t callback); -    static void SlamFolder(const LLUUID& folderId, const LLSD& newInventory, completion_t callback); -    static void RemoveCategory(const LLUUID &categoryId, completion_t callback); -    static void RemoveItem(const LLUUID &itemId, completion_t callback); -    static void PurgeDescendents(const LLUUID &categoryId, completion_t callback); -    static void UpdateCategory(const LLUUID &categoryId, const LLSD &updates, completion_t callback); -    static void UpdateItem(const LLUUID &itemId, const LLSD &updates, completion_t callback); -    static void CopyLibraryCategory(const LLUUID& sourceId, const LLUUID& destId, bool copySubfolders, completion_t callback); +    static void CreateInventory(const LLUUID& parentId, const LLSD& newInventory, completion_t callback = completion_t()); +    static void SlamFolder(const LLUUID& folderId, const LLSD& newInventory, completion_t callback = completion_t()); +    static void RemoveCategory(const LLUUID &categoryId, completion_t callback = completion_t()); +    static void RemoveItem(const LLUUID &itemId, completion_t callback = completion_t()); +    static void PurgeDescendents(const LLUUID &categoryId, completion_t callback = completion_t()); +    static void UpdateCategory(const LLUUID &categoryId, const LLSD &updates, completion_t callback = completion_t()); +    static void UpdateItem(const LLUUID &itemId, const LLSD &updates, completion_t callback = completion_t()); +    static void CopyLibraryCategory(const LLUUID& sourceId, const LLUUID& destId, bool copySubfolders, completion_t callback = completion_t());  private:      typedef enum { diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index ac19d84a5e..573791aca3 100755 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -1294,7 +1294,7 @@ void link_inventory_array(const LLUUID& category,  	{  		LLSD new_inventory = LLSD::emptyMap();  		new_inventory["links"] = links; -        AISAPI::completion_t cr = boost::bind(&doInventoryCb, cb, _1); +        AISAPI::completion_t cr = (cb) ? boost::bind(&doInventoryCb, cb, _1) : AISAPI::completion_t();          AISAPI::CreateInventory(category, new_inventory, cr);  	}      else @@ -1368,7 +1368,7 @@ void update_inventory_item(  			updates.erase("shadow_id");  			updates["hash_id"] = update_item->getTransactionID();  		} -        AISAPI::completion_t cr = boost::bind(&doInventoryCb, cb, _1); +        AISAPI::completion_t cr = (cb) ? boost::bind(&doInventoryCb, cb, _1) : AISAPI::completion_t();          AISAPI::UpdateItem(item_id, updates, cr);  	}      else @@ -1409,7 +1409,7 @@ void update_inventory_item(  {      if (AISAPI::isAvailable())  	{ -        AISAPI::completion_t cr = boost::bind(&doInventoryCb, cb, _1); +        AISAPI::completion_t cr = (cb) ? boost::bind(&doInventoryCb, cb, _1) : AISAPI::completion_t();          AISAPI::UpdateItem(item_id, updates, cr);  	}      else @@ -1465,7 +1465,7 @@ void update_inventory_category(          if (AISAPI::isAvailable())  		{  			LLSD new_llsd = new_cat->asLLSD(); -            AISAPI::completion_t cr = boost::bind(&doInventoryCb, cb, _1); +            AISAPI::completion_t cr = (cb) ? boost::bind(&doInventoryCb, cb, _1) : AISAPI::completion_t();              AISAPI::UpdateCategory(cat_id, new_llsd, cr);  		}  		else // no cap @@ -1530,7 +1530,7 @@ void remove_inventory_item(  		LL_DEBUGS(LOG_INV) << "item_id: [" << item_id << "] name " << obj->getName() << LL_ENDL;          if (AISAPI::isAvailable())  		{ -            AISAPI::completion_t cr = boost::bind(&doInventoryCb, cb, _1); +            AISAPI::completion_t cr = (cb) ? boost::bind(&doInventoryCb, cb, _1) : AISAPI::completion_t();              AISAPI::RemoveItem(item_id, cr);  			if (immediate_delete) @@ -1606,7 +1606,7 @@ void remove_inventory_category(  		}          if (AISAPI::isAvailable())  		{ -            AISAPI::completion_t cr = boost::bind(&doInventoryCb, cb, _1); +            AISAPI::completion_t cr = (cb) ? boost::bind(&doInventoryCb, cb, _1) : AISAPI::completion_t();              AISAPI::RemoveCategory(cat_id, cr);  		}  		else // no cap @@ -1709,7 +1709,7 @@ void purge_descendents_of(const LLUUID& id, LLPointer<LLInventoryCallback> cb)  		{              if (AISAPI::isAvailable())  			{ -                AISAPI::completion_t cr = boost::bind(&doInventoryCb, cb, _1); +                AISAPI::completion_t cr = (cb) ? boost::bind(&doInventoryCb, cb, _1) : AISAPI::completion_t();                  AISAPI::PurgeDescendents(id, cr);  			}  			else // no cap @@ -1862,7 +1862,7 @@ void slam_inventory_folder(const LLUUID& folder_id,  		LL_DEBUGS(LOG_INV) << "using AISv3 to slam folder, id " << folder_id  						   << " new contents: " << ll_pretty_print_sd(contents) << LL_ENDL; -        AISAPI::completion_t cr = boost::bind(&doInventoryCb, cb, _1); +        AISAPI::completion_t cr = (cb) ? boost::bind(&doInventoryCb, cb, _1) : AISAPI::completion_t();          AISAPI::SlamFolder(folder_id, contents, cr);  	}  	else // no cap | 
