diff options
author | McCabe Maxsted | 2011-05-09 11:06:41 -0700 |
---|---|---|
committer | McCabe Maxsted | 2011-06-08 22:00:02 -0700 |
commit | b6403a457e5ccb2269b89da3ada852d6cd361a5f (patch) | |
tree | 5986e11b308f84799903effa5aaf88e705090d93 /linden | |
parent | Always show lldebugs for inventory for now. Logs will be our best debugging t... (diff) | |
download | meta-impy-b6403a457e5ccb2269b89da3ada852d6cd361a5f.zip meta-impy-b6403a457e5ccb2269b89da3ada852d6cd361a5f.tar.gz meta-impy-b6403a457e5ccb2269b89da3ada852d6cd361a5f.tar.bz2 meta-impy-b6403a457e5ccb2269b89da3ada852d6cd361a5f.tar.xz |
Inv cleanup phase 2: death to goto
Diffstat (limited to 'linden')
-rw-r--r-- | linden/indra/newview/llinventorymodel.cpp | 278 |
1 files changed, 197 insertions, 81 deletions
diff --git a/linden/indra/newview/llinventorymodel.cpp b/linden/indra/newview/llinventorymodel.cpp index ede54a3..ceebc19 100644 --- a/linden/indra/newview/llinventorymodel.cpp +++ b/linden/indra/newview/llinventorymodel.cpp | |||
@@ -1914,9 +1914,8 @@ bool LLInventoryModel::isCategoryComplete(const LLUUID& cat_id) const | |||
1914 | return false; | 1914 | return false; |
1915 | } | 1915 | } |
1916 | 1916 | ||
1917 | bool LLInventoryModel::loadSkeleton( | 1917 | bool LLInventoryModel::loadSkeleton(const LLInventoryModel::options_t& options, |
1918 | const LLInventoryModel::options_t& options, | 1918 | const LLUUID& owner_id) |
1919 | const LLUUID& owner_id) | ||
1920 | { | 1919 | { |
1921 | LL_DEBUGS("Inventory") << "importing inventory skeleton for " << owner_id << LL_ENDL; | 1920 | LL_DEBUGS("Inventory") << "importing inventory skeleton for " << owner_id << LL_ENDL; |
1922 | 1921 | ||
@@ -1924,30 +1923,63 @@ bool LLInventoryModel::loadSkeleton( | |||
1924 | cat_set_t temp_cats; | 1923 | cat_set_t temp_cats; |
1925 | 1924 | ||
1926 | update_map_t child_counts; | 1925 | update_map_t child_counts; |
1927 | |||
1928 | LLUUID id; | 1926 | LLUUID id; |
1929 | LLAssetType::EType preferred_type; | 1927 | LLAssetType::EType preferred_type; |
1930 | bool rv = true; | 1928 | bool rv = true; |
1931 | for(options_t::const_iterator it = options.begin(); it < options.end(); ++it) | 1929 | bool clean_cat = false; |
1930 | |||
1931 | for (options_t::const_iterator it = options.begin(); it < options.end(); ++it) | ||
1932 | { | 1932 | { |
1933 | LLPointer<LLViewerInventoryCategory> cat = new LLViewerInventoryCategory(owner_id); | 1933 | LLPointer<LLViewerInventoryCategory> cat = new LLViewerInventoryCategory(owner_id); |
1934 | |||
1934 | response_t::const_iterator no_response = (*it).end(); | 1935 | response_t::const_iterator no_response = (*it).end(); |
1935 | response_t::const_iterator skel; | 1936 | response_t::const_iterator skel; |
1937 | |||
1938 | clean_cat = false; | ||
1939 | |||
1936 | skel = (*it).find("name"); | 1940 | skel = (*it).find("name"); |
1937 | if(skel == no_response) goto clean_cat; | 1941 | if (skel == no_response) |
1938 | cat->rename(std::string((*skel).second)); | 1942 | { |
1943 | clean_cat = true; | ||
1944 | } | ||
1945 | else | ||
1946 | { | ||
1947 | cat->rename(std::string((*skel).second)); | ||
1948 | } | ||
1949 | |||
1939 | skel = (*it).find("folder_id"); | 1950 | skel = (*it).find("folder_id"); |
1940 | if(skel == no_response) goto clean_cat; | 1951 | if (skel == no_response) |
1941 | id.set((*skel).second); | 1952 | { |
1953 | clean_cat = true; | ||
1954 | } | ||
1955 | else | ||
1956 | { | ||
1957 | id.set((*skel).second); | ||
1958 | } | ||
1959 | |||
1942 | // if an id is null, it locks the viewer. | 1960 | // if an id is null, it locks the viewer. |
1943 | if(id.isNull()) goto clean_cat; | 1961 | if (id.isNull()) |
1944 | cat->setUUID(id); | 1962 | { |
1963 | clean_cat = true; | ||
1964 | } | ||
1965 | else | ||
1966 | { | ||
1967 | cat->setUUID(id); | ||
1968 | } | ||
1969 | |||
1945 | skel = (*it).find("parent_id"); | 1970 | skel = (*it).find("parent_id"); |
1946 | if(skel == no_response) goto clean_cat; | 1971 | if (skel == no_response) |
1947 | id.set((*skel).second); | 1972 | { |
1948 | cat->setParent(id); | 1973 | clean_cat = true; |
1974 | } | ||
1975 | else | ||
1976 | { | ||
1977 | id.set((*skel).second); | ||
1978 | cat->setParent(id); | ||
1979 | } | ||
1980 | |||
1949 | skel = (*it).find("type_default"); | 1981 | skel = (*it).find("type_default"); |
1950 | if(skel == no_response) | 1982 | if (skel == no_response) |
1951 | { | 1983 | { |
1952 | preferred_type = LLAssetType::AT_NONE; | 1984 | preferred_type = LLAssetType::AT_NONE; |
1953 | } | 1985 | } |
@@ -1957,38 +1989,62 @@ bool LLInventoryModel::loadSkeleton( | |||
1957 | preferred_type = (LLAssetType::EType)t; | 1989 | preferred_type = (LLAssetType::EType)t; |
1958 | } | 1990 | } |
1959 | cat->setPreferredType(preferred_type); | 1991 | cat->setPreferredType(preferred_type); |
1992 | |||
1960 | skel = (*it).find("version"); | 1993 | skel = (*it).find("version"); |
1961 | if(skel == no_response) goto clean_cat; | 1994 | if (skel == no_response) |
1962 | cat->setVersion(atoi((*skel).second.c_str())); | 1995 | { |
1963 | temp_cats.insert(cat); | 1996 | clean_cat = true; |
1964 | continue; | 1997 | } |
1965 | clean_cat: | 1998 | else |
1966 | llwarns << "Unable to import near " << cat->getName() << llendl; | 1999 | { |
1967 | rv = false; | 2000 | cat->setVersion(atoi((*skel).second.c_str())); |
1968 | //delete cat; // automatic when cat is reasigned or destroyed | 2001 | } |
2002 | |||
2003 | if (clean_cat) | ||
2004 | { | ||
2005 | llwarns << "Unable to import near " << cat->getName() << llendl; | ||
2006 | rv = false; | ||
2007 | //delete cat; // automatic when cat is reasigned or destroyed | ||
2008 | temp_cats.clear(); | ||
2009 | break; | ||
2010 | } | ||
2011 | else | ||
2012 | { | ||
2013 | temp_cats.insert(cat); | ||
2014 | } | ||
1969 | } | 2015 | } |
1970 | 2016 | ||
1971 | S32 cached_category_count = 0; | 2017 | S32 cached_category_count = 0; |
1972 | S32 cached_item_count = 0; | 2018 | S32 cached_item_count = 0; |
1973 | if(!temp_cats.empty()) | 2019 | if (temp_cats.empty()) |
2020 | { | ||
2021 | LL_WARNS("Inventory") << "No categories found! Cannot continue!" << LL_ENDL; | ||
2022 | } | ||
2023 | else | ||
1974 | { | 2024 | { |
1975 | cat_array_t categories; | 2025 | cat_array_t categories; |
1976 | item_array_t items; | 2026 | item_array_t items; |
1977 | std::string owner_id_str; | 2027 | std::string owner_id_str; |
1978 | owner_id.toString(owner_id_str); | 2028 | owner_id.toString(owner_id_str); |
2029 | |||
1979 | std::string path(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, owner_id_str)); | 2030 | std::string path(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, owner_id_str)); |
1980 | std::string inventory_filename; | 2031 | std::string inventory_filename; |
1981 | inventory_filename = llformat(CACHE_FORMAT_STRING, path.c_str()); | 2032 | inventory_filename = llformat(CACHE_FORMAT_STRING, path.c_str()); |
2033 | |||
1982 | const S32 NO_VERSION = LLViewerInventoryCategory::VERSION_UNKNOWN; | 2034 | const S32 NO_VERSION = LLViewerInventoryCategory::VERSION_UNKNOWN; |
2035 | |||
1983 | std::string gzip_filename(inventory_filename); | 2036 | std::string gzip_filename(inventory_filename); |
1984 | gzip_filename.append(".gz"); | 2037 | gzip_filename.append(".gz"); |
1985 | LLFILE* fp = LLFile::fopen(gzip_filename, "rb"); | 2038 | LLFILE* fp = LLFile::fopen(gzip_filename, "rb"); |
2039 | |||
1986 | bool remove_inventory_file = false; | 2040 | bool remove_inventory_file = false; |
1987 | if(fp) | 2041 | |
2042 | // try to ungzip the inventory -- MC | ||
2043 | if (fp) | ||
1988 | { | 2044 | { |
1989 | fclose(fp); | 2045 | fclose(fp); |
1990 | fp = NULL; | 2046 | fp = NULL; |
1991 | if(gunzip_file(gzip_filename, inventory_filename)) | 2047 | if (gunzip_file(gzip_filename, inventory_filename)) |
1992 | { | 2048 | { |
1993 | // we only want to remove the inventory file if it was | 2049 | // we only want to remove the inventory file if it was |
1994 | // gzipped before we loaded, and we successfully | 2050 | // gzipped before we loaded, and we successfully |
@@ -2000,7 +2056,9 @@ bool LLInventoryModel::loadSkeleton( | |||
2000 | llinfos << "Unable to gunzip " << gzip_filename << llendl; | 2056 | llinfos << "Unable to gunzip " << gzip_filename << llendl; |
2001 | } | 2057 | } |
2002 | } | 2058 | } |
2003 | if(loadFromFile(inventory_filename, categories, items)) | 2059 | |
2060 | // begin cache loading -- MC | ||
2061 | if (loadFromFile(inventory_filename, categories, items)) | ||
2004 | { | 2062 | { |
2005 | // We were able to find a cache of files. So, use what we | 2063 | // We were able to find a cache of files. So, use what we |
2006 | // found to generate a set of categories we should add. We | 2064 | // found to generate a set of categories we should add. We |
@@ -2009,10 +2067,11 @@ bool LLInventoryModel::loadSkeleton( | |||
2009 | S32 count = categories.count(); | 2067 | S32 count = categories.count(); |
2010 | cat_set_t::iterator not_cached = temp_cats.end(); | 2068 | cat_set_t::iterator not_cached = temp_cats.end(); |
2011 | std::set<LLUUID> cached_ids; | 2069 | std::set<LLUUID> cached_ids; |
2012 | for(S32 i = 0; i < count; ++i) | 2070 | for (S32 i = 0; i < count; ++i) |
2013 | { | 2071 | { |
2014 | LLViewerInventoryCategory* cat = categories[i]; | 2072 | LLViewerInventoryCategory* cat = categories[i]; |
2015 | cat_set_t::iterator cit = temp_cats.find(cat); | 2073 | cat_set_t::iterator cit = temp_cats.find(cat); |
2074 | |||
2016 | if (cit == temp_cats.end()) | 2075 | if (cit == temp_cats.end()) |
2017 | { | 2076 | { |
2018 | continue; // cache corruption?? not sure why this happens -SJB | 2077 | continue; // cache corruption?? not sure why this happens -SJB |
@@ -2021,11 +2080,12 @@ bool LLInventoryModel::loadSkeleton( | |||
2021 | 2080 | ||
2022 | // we can safely ignore anything loaded from file, but | 2081 | // we can safely ignore anything loaded from file, but |
2023 | // not sent down in the skeleton. | 2082 | // not sent down in the skeleton. |
2024 | if(cit == not_cached) | 2083 | if (cit == not_cached) |
2025 | { | 2084 | { |
2026 | continue; | 2085 | continue; |
2027 | } | 2086 | } |
2028 | if(cat->getVersion() != tcat->getVersion()) | 2087 | |
2088 | if (cat->getVersion() != tcat->getVersion()) | ||
2029 | { | 2089 | { |
2030 | // if the cached version does not match the server version, | 2090 | // if the cached version does not match the server version, |
2031 | // throw away the version we have so we can fetch the | 2091 | // throw away the version we have so we can fetch the |
@@ -2041,9 +2101,9 @@ bool LLInventoryModel::loadSkeleton( | |||
2041 | // go ahead and add the cats returned during the download | 2101 | // go ahead and add the cats returned during the download |
2042 | std::set<LLUUID>::iterator not_cached_id = cached_ids.end(); | 2102 | std::set<LLUUID>::iterator not_cached_id = cached_ids.end(); |
2043 | cached_category_count = cached_ids.size(); | 2103 | cached_category_count = cached_ids.size(); |
2044 | for(cat_set_t::iterator it = temp_cats.begin(); it != temp_cats.end(); ++it) | 2104 | for (cat_set_t::iterator it = temp_cats.begin(); it != temp_cats.end(); ++it) |
2045 | { | 2105 | { |
2046 | if(cached_ids.find((*it)->getUUID()) == not_cached_id) | 2106 | if (cached_ids.find((*it)->getUUID()) == not_cached_id) |
2047 | { | 2107 | { |
2048 | // this check is performed so that we do not | 2108 | // this check is performed so that we do not |
2049 | // mark new folders in the skeleton (and not in cache) | 2109 | // mark new folders in the skeleton (and not in cache) |
@@ -2059,14 +2119,14 @@ bool LLInventoryModel::loadSkeleton( | |||
2059 | // category with a correctly cached parent | 2119 | // category with a correctly cached parent |
2060 | count = items.count(); | 2120 | count = items.count(); |
2061 | cat_map_t::iterator unparented = mCategoryMap.end(); | 2121 | cat_map_t::iterator unparented = mCategoryMap.end(); |
2062 | for(int i = 0; i < count; ++i) | 2122 | for (int i = 0; i < count; ++i) |
2063 | { | 2123 | { |
2064 | cat_map_t::iterator cit = mCategoryMap.find(items[i]->getParentUUID()); | 2124 | cat_map_t::iterator cit = mCategoryMap.find(items[i]->getParentUUID()); |
2065 | 2125 | ||
2066 | if(cit != unparented) | 2126 | if (cit != unparented) |
2067 | { | 2127 | { |
2068 | LLViewerInventoryCategory* cat = cit->second; | 2128 | LLViewerInventoryCategory* cat = cit->second; |
2069 | if(cat->getVersion() != NO_VERSION) | 2129 | if (cat->getVersion() != NO_VERSION) |
2070 | { | 2130 | { |
2071 | addItem(items[i]); | 2131 | addItem(items[i]); |
2072 | cached_item_count += 1; | 2132 | cached_item_count += 1; |
@@ -2079,7 +2139,7 @@ bool LLInventoryModel::loadSkeleton( | |||
2079 | { | 2139 | { |
2080 | // go ahead and add everything after stripping the version | 2140 | // go ahead and add everything after stripping the version |
2081 | // information. | 2141 | // information. |
2082 | for(cat_set_t::iterator it = temp_cats.begin(); it != temp_cats.end(); ++it) | 2142 | for (cat_set_t::iterator it = temp_cats.begin(); it != temp_cats.end(); ++it) |
2083 | { | 2143 | { |
2084 | LLViewerInventoryCategory *llvic = (*it); | 2144 | LLViewerInventoryCategory *llvic = (*it); |
2085 | llvic->setVersion(NO_VERSION); | 2145 | llvic->setVersion(NO_VERSION); |
@@ -2092,13 +2152,13 @@ bool LLInventoryModel::loadSkeleton( | |||
2092 | // needlessly fetch descendents for categories which we have. | 2152 | // needlessly fetch descendents for categories which we have. |
2093 | update_map_t::iterator no_child_counts = child_counts.end(); | 2153 | update_map_t::iterator no_child_counts = child_counts.end(); |
2094 | update_map_t::iterator the_count; | 2154 | update_map_t::iterator the_count; |
2095 | for(cat_set_t::iterator it = temp_cats.begin(); it != temp_cats.end(); ++it) | 2155 | for (cat_set_t::iterator it = temp_cats.begin(); it != temp_cats.end(); ++it) |
2096 | { | 2156 | { |
2097 | LLViewerInventoryCategory* cat = (*it); | 2157 | LLViewerInventoryCategory* cat = (*it); |
2098 | if(cat->getVersion() != NO_VERSION) | 2158 | if (cat->getVersion() != NO_VERSION) |
2099 | { | 2159 | { |
2100 | the_count = child_counts.find(cat->getUUID()); | 2160 | the_count = child_counts.find(cat->getUUID()); |
2101 | if(the_count != no_child_counts) | 2161 | if (the_count != no_child_counts) |
2102 | { | 2162 | { |
2103 | cat->setDescendentCount((*the_count).second.mValue); | 2163 | cat->setDescendentCount((*the_count).second.mValue); |
2104 | } | 2164 | } |
@@ -2109,7 +2169,7 @@ bool LLInventoryModel::loadSkeleton( | |||
2109 | } | 2169 | } |
2110 | } | 2170 | } |
2111 | 2171 | ||
2112 | if(remove_inventory_file) | 2172 | if (remove_inventory_file) |
2113 | { | 2173 | { |
2114 | // clean up the gunzipped file. | 2174 | // clean up the gunzipped file. |
2115 | LLFile::remove(inventory_filename); | 2175 | LLFile::remove(inventory_filename); |
@@ -2118,53 +2178,98 @@ bool LLInventoryModel::loadSkeleton( | |||
2118 | } | 2178 | } |
2119 | 2179 | ||
2120 | LL_DEBUGS("Inventory") << "Successfully loaded " << cached_category_count | 2180 | LL_DEBUGS("Inventory") << "Successfully loaded " << cached_category_count |
2121 | << " categories and " << cached_item_count << " items from cache." | 2181 | << " categories and " << cached_item_count << " items from cache skeleton." |
2122 | << LL_ENDL; | 2182 | << LL_ENDL; |
2123 | 2183 | ||
2124 | return rv; | 2184 | return rv; |
2125 | } | 2185 | } |
2126 | 2186 | ||
2127 | bool LLInventoryModel::loadMeat( | 2187 | bool LLInventoryModel::loadMeat(const LLInventoryModel::options_t& options, |
2128 | const LLInventoryModel::options_t& options, const LLUUID& owner_id) | 2188 | const LLUUID& owner_id) |
2129 | { | 2189 | { |
2130 | llinfos << "importing inventory for " << owner_id << llendl; | 2190 | llinfos << "importing inventory for " << owner_id << llendl; |
2131 | LLPermissions default_perm; | 2191 | LLPermissions default_perm; |
2132 | default_perm.init(LLUUID::null, owner_id, LLUUID::null, LLUUID::null); | 2192 | default_perm.init(LLUUID::null, owner_id, LLUUID::null, LLUUID::null); |
2133 | LLPointer<LLViewerInventoryItem> item; | 2193 | LLPointer<LLViewerInventoryItem> item; |
2134 | LLUUID id; | 2194 | LLUUID id; |
2135 | LLAssetType::EType type; | 2195 | LLAssetType::EType type = LLAssetType::AT_NONE; |
2136 | LLInventoryType::EType inv_type; | 2196 | LLInventoryType::EType inv_type; |
2197 | |||
2137 | bool rv = true; | 2198 | bool rv = true; |
2138 | for(options_t::const_iterator it = options.begin(); it < options.end(); ++it) | 2199 | bool clean_item = false; |
2200 | static S32 cached_meat_count = 0; | ||
2201 | |||
2202 | for (options_t::const_iterator it = options.begin(); it < options.end(); ++it) | ||
2139 | { | 2203 | { |
2140 | item = new LLViewerInventoryItem; | 2204 | item = new LLViewerInventoryItem; |
2205 | |||
2141 | response_t::const_iterator no_response = (*it).end(); | 2206 | response_t::const_iterator no_response = (*it).end(); |
2142 | response_t::const_iterator meat; | 2207 | response_t::const_iterator meat; |
2208 | |||
2209 | clean_item = false; | ||
2210 | |||
2143 | meat = (*it).find("name"); | 2211 | meat = (*it).find("name"); |
2144 | if(meat == no_response) goto clean_item; | 2212 | if (meat == no_response) |
2145 | item->rename(std::string((*meat).second)); | 2213 | { |
2214 | clean_item = true; | ||
2215 | } | ||
2216 | else | ||
2217 | { | ||
2218 | item->rename(std::string((*meat).second)); | ||
2219 | } | ||
2220 | |||
2146 | meat = (*it).find("item_id"); | 2221 | meat = (*it).find("item_id"); |
2147 | if(meat == no_response) goto clean_item; | 2222 | if (meat == no_response) |
2148 | id.set((*meat).second); | 2223 | { |
2149 | item->setUUID(id); | 2224 | clean_item = true; |
2225 | } | ||
2226 | else | ||
2227 | { | ||
2228 | id.set((*meat).second); | ||
2229 | item->setUUID(id); | ||
2230 | } | ||
2231 | |||
2150 | meat = (*it).find("parent_id"); | 2232 | meat = (*it).find("parent_id"); |
2151 | if(meat == no_response) goto clean_item; | 2233 | if (meat == no_response) |
2152 | id.set((*meat).second); | 2234 | { |
2153 | item->setParent(id); | 2235 | clean_item = true; |
2236 | } | ||
2237 | else | ||
2238 | { | ||
2239 | id.set((*meat).second); | ||
2240 | item->setParent(id); | ||
2241 | } | ||
2242 | |||
2154 | meat = (*it).find("type"); | 2243 | meat = (*it).find("type"); |
2155 | if(meat == no_response) goto clean_item; | 2244 | if (meat == no_response) |
2156 | type = (LLAssetType::EType)atoi((*meat).second.c_str()); | 2245 | { |
2157 | item->setType(type); | 2246 | clean_item = true; |
2247 | } | ||
2248 | else | ||
2249 | { | ||
2250 | type = (LLAssetType::EType)atoi((*meat).second.c_str()); | ||
2251 | item->setType(type); | ||
2252 | } | ||
2253 | |||
2254 | // Do we want to clean if there's no inv_type too? -- MC | ||
2158 | meat = (*it).find("inv_type"); | 2255 | meat = (*it).find("inv_type"); |
2159 | if(meat != no_response) | 2256 | if (meat != no_response) |
2160 | { | 2257 | { |
2161 | inv_type = (LLInventoryType::EType)atoi((*meat).second.c_str()); | 2258 | inv_type = (LLInventoryType::EType)atoi((*meat).second.c_str()); |
2162 | item->setInventoryType(inv_type); | 2259 | item->setInventoryType(inv_type); |
2163 | } | 2260 | } |
2261 | |||
2164 | meat = (*it).find("data_id"); | 2262 | meat = (*it).find("data_id"); |
2165 | if(meat == no_response) goto clean_item; | 2263 | if (meat == no_response) |
2166 | id.set((*meat).second); | 2264 | { |
2167 | if(LLAssetType::AT_CALLINGCARD == type) | 2265 | clean_item = true; |
2266 | } | ||
2267 | else | ||
2268 | { | ||
2269 | id.set((*meat).second); | ||
2270 | } | ||
2271 | |||
2272 | if (LLAssetType::AT_CALLINGCARD == type) | ||
2168 | { | 2273 | { |
2169 | LLPermissions perm; | 2274 | LLPermissions perm; |
2170 | perm.init(id, owner_id, LLUUID::null, LLUUID::null); | 2275 | perm.init(id, owner_id, LLUUID::null, LLUUID::null); |
@@ -2173,37 +2278,48 @@ bool LLInventoryModel::loadMeat( | |||
2173 | else | 2278 | else |
2174 | { | 2279 | { |
2175 | meat = (*it).find("perm_mask"); | 2280 | meat = (*it).find("perm_mask"); |
2176 | if(meat != no_response) | 2281 | if (meat != no_response) |
2177 | { | 2282 | { |
2178 | PermissionMask perm_mask = atoi((*meat).second.c_str()); | 2283 | PermissionMask perm_mask = atoi((*meat).second.c_str()); |
2179 | default_perm.initMasks( | 2284 | default_perm.initMasks(perm_mask, perm_mask, perm_mask, perm_mask, perm_mask); |
2180 | perm_mask, perm_mask, perm_mask, perm_mask, perm_mask); | ||
2181 | } | 2285 | } |
2182 | else | 2286 | else |
2183 | { | 2287 | { |
2184 | default_perm.initMasks( | 2288 | default_perm.initMasks(PERM_NONE, PERM_NONE, PERM_NONE, PERM_NONE, PERM_NONE); |
2185 | PERM_NONE, PERM_NONE, PERM_NONE, PERM_NONE, PERM_NONE); | ||
2186 | } | 2289 | } |
2187 | item->setPermissions(default_perm); | 2290 | item->setPermissions(default_perm); |
2188 | item->setAssetUUID(id); | 2291 | item->setAssetUUID(id); |
2189 | } | 2292 | } |
2293 | |||
2190 | meat = (*it).find("flags"); | 2294 | meat = (*it).find("flags"); |
2191 | if(meat != no_response) | 2295 | if (meat != no_response) |
2192 | { | 2296 | { |
2193 | item->setFlags(strtoul((*meat).second.c_str(), NULL, 0)); | 2297 | item->setFlags(strtoul((*meat).second.c_str(), NULL, 0)); |
2194 | } | 2298 | } |
2299 | |||
2195 | meat = (*it).find("time"); | 2300 | meat = (*it).find("time"); |
2196 | if(meat != no_response) | 2301 | if (meat != no_response) |
2197 | { | 2302 | { |
2198 | item->setCreationDate(atoi((*meat).second.c_str())); | 2303 | item->setCreationDate(atoi((*meat).second.c_str())); |
2199 | } | 2304 | } |
2200 | addItem(item); | 2305 | |
2201 | continue; | 2306 | if (clean_item) |
2202 | clean_item: | 2307 | { |
2203 | llwarns << "Unable to import near " << item->getName() << llendl; | 2308 | llwarns << "Unable to import near " << item->getName() << llendl; |
2204 | rv = false; | 2309 | rv = false; |
2205 | //delete item; // automatic when item is reassigned or destroyed | 2310 | //delete item; // automatic when item is reassigned or destroyed |
2311 | break; | ||
2312 | } | ||
2313 | else | ||
2314 | { | ||
2315 | addItem(item); | ||
2316 | cached_meat_count++; | ||
2317 | } | ||
2206 | } | 2318 | } |
2319 | |||
2320 | LL_DEBUGS("Inventory") << "Successfully added " << cached_meat_count << " items from cache." | ||
2321 | << LL_ENDL; | ||
2322 | |||
2207 | return rv; | 2323 | return rv; |
2208 | } | 2324 | } |
2209 | 2325 | ||
@@ -2553,14 +2669,14 @@ bool LLInventoryModel::loadFromFile(const std::string& filename, | |||
2553 | // *FIX: Need a better solution, this prevents the | 2669 | // *FIX: Need a better solution, this prevents the |
2554 | // application from freezing, but breaks inventory | 2670 | // application from freezing, but breaks inventory |
2555 | // caching. | 2671 | // caching. |
2556 | //if(inv_item->getUUID().isNull())MCCABE | 2672 | if(inv_item->getUUID().isNull()) |
2557 | //{ | 2673 | { |
2558 | // //delete inv_item; // automatic when inv_cat is reassigned or destroyed | 2674 | //delete inv_item; // automatic when inv_cat is reassigned or destroyed |
2559 | // llwarns << "Ignoring inventory with null item id: " | 2675 | llwarns << "Ignoring inventory with null item id: " |
2560 | // << inv_item->getName() << llendl; | 2676 | << inv_item->getName() << llendl; |
2561 | // | 2677 | |
2562 | //} | 2678 | } |
2563 | //else | 2679 | else |
2564 | { | 2680 | { |
2565 | items.put(inv_item); | 2681 | items.put(inv_item); |
2566 | item_count_total++; | 2682 | item_count_total++; |