Merge "Stop using namespace std."

This commit is contained in:
Dan Albert
2015-03-05 23:31:41 +00:00
committed by Gerrit Code Review
3 changed files with 19 additions and 26 deletions

View File

@@ -481,7 +481,8 @@ static void get_outline(image_info* image)
// assuming the image is a round rect, compute the radius by marching // assuming the image is a round rect, compute the radius by marching
// diagonally from the top left corner towards the center // diagonally from the top left corner towards the center
image->outlineAlpha = max(max_alpha_over_row(image->rows[innerMidY], innerStartX, innerEndX), image->outlineAlpha = std::max(
max_alpha_over_row(image->rows[innerMidY], innerStartX, innerEndX),
max_alpha_over_col(image->rows, innerMidX, innerStartY, innerStartY)); max_alpha_over_col(image->rows, innerMidX, innerStartY, innerStartY));
int diagonalInset = 0; int diagonalInset = 0;

View File

@@ -1802,7 +1802,7 @@ status_t ResourceTable::addIncludedResources(Bundle* bundle, const sp<AaptAssets
} }
const ResTable& featureTable = featureAssetManager.getResources(false); const ResTable& featureTable = featureAssetManager.getResources(false);
mTypeIdOffset = max(mTypeIdOffset, mTypeIdOffset = std::max(mTypeIdOffset,
findLargestTypeIdForPackage(featureTable, mAssetsPackage)); findLargestTypeIdForPackage(featureTable, mAssetsPackage));
} }
@@ -2667,20 +2667,16 @@ ResourceTable::validateLocalizations(void)
const String8 defaultLocale; const String8 defaultLocale;
// For all strings... // For all strings...
for (map<String16, map<String8, SourcePos> >::iterator nameIter = mLocalizations.begin(); for (const auto& nameIter : mLocalizations) {
nameIter != mLocalizations.end(); const std::map<String8, SourcePos>& configSrcMap = nameIter.second;
nameIter++) {
const map<String8, SourcePos>& configSrcMap = nameIter->second;
// Look for strings with no default localization // Look for strings with no default localization
if (configSrcMap.count(defaultLocale) == 0) { if (configSrcMap.count(defaultLocale) == 0) {
SourcePos().warning("string '%s' has no default translation.", SourcePos().warning("string '%s' has no default translation.",
String8(nameIter->first).string()); String8(nameIter.first).string());
if (mBundle->getVerbose()) { if (mBundle->getVerbose()) {
for (map<String8, SourcePos>::const_iterator locales = configSrcMap.begin(); for (const auto& locale : configSrcMap) {
locales != configSrcMap.end(); locale.second.printf("locale %s found", locale.first.string());
locales++) {
locales->second.printf("locale %s found", locales->first.string());
} }
} }
// !!! TODO: throw an error here in some circumstances // !!! TODO: throw an error here in some circumstances
@@ -2692,7 +2688,7 @@ ResourceTable::validateLocalizations(void)
const char* start = allConfigs; const char* start = allConfigs;
const char* comma; const char* comma;
set<String8> missingConfigs; std::set<String8> missingConfigs;
AaptLocaleValue locale; AaptLocaleValue locale;
do { do {
String8 config; String8 config;
@@ -2726,13 +2722,11 @@ ResourceTable::validateLocalizations(void)
if (!missingConfigs.empty()) { if (!missingConfigs.empty()) {
String8 configStr; String8 configStr;
for (set<String8>::iterator iter = missingConfigs.begin(); for (const auto& iter : missingConfigs) {
iter != missingConfigs.end(); configStr.appendFormat(" %s", iter.string());
iter++) {
configStr.appendFormat(" %s", iter->string());
} }
SourcePos().warning("string '%s' is missing %u required localizations:%s", SourcePos().warning("string '%s' is missing %u required localizations:%s",
String8(nameIter->first).string(), String8(nameIter.first).string(),
(unsigned int)missingConfigs.size(), (unsigned int)missingConfigs.size(),
configStr.string()); configStr.string());
} }

View File

@@ -16,8 +16,6 @@
#include <queue> #include <queue>
#include <set> #include <set>
using namespace std;
class XMLNode; class XMLNode;
class ResourceTable; class ResourceTable;
@@ -115,7 +113,7 @@ public:
* and would mess up iteration order for the existing * and would mess up iteration order for the existing
* resources. * resources.
*/ */
queue<CompileResourceWorkItem>& getWorkQueue() { std::queue<CompileResourceWorkItem>& getWorkQueue() {
return mWorkQueue; return mWorkQueue;
} }
@@ -579,8 +577,8 @@ private:
Bundle* mBundle; Bundle* mBundle;
// key = string resource name, value = set of locales in which that name is defined // key = string resource name, value = set of locales in which that name is defined
map<String16, map<String8, SourcePos> > mLocalizations; std::map<String16, std::map<String8, SourcePos>> mLocalizations;
queue<CompileResourceWorkItem> mWorkQueue; std::queue<CompileResourceWorkItem> mWorkQueue;
}; };
#endif #endif