Fix windows build of AAPT2
Change-Id: Ib8e1a4322510b582e9600a08d3118842c9abc73c
diff --git a/tools/aapt2/JavaClassGenerator.cpp b/tools/aapt2/JavaClassGenerator.cpp
index 7ec2848..779a346 100644
--- a/tools/aapt2/JavaClassGenerator.cpp
+++ b/tools/aapt2/JavaClassGenerator.cpp
@@ -20,6 +20,7 @@
#include "ResourceValues.h"
#include "StringPiece.h"
+#include <algorithm>
#include <ostream>
#include <set>
#include <sstream>
@@ -87,10 +88,11 @@
assert(id.isValid());
if (!isValidSymbol(entry->name)) {
- mError = (std::stringstream()
- << "invalid symbol name '"
- << StringPiece16(entry->name)
- << "'").str();
+ std::stringstream err;
+ err << "invalid symbol name '"
+ << StringPiece16(entry->name)
+ << "'";
+ mError = err.str();
return false;
}
@@ -164,10 +166,11 @@
for (const auto& entry : type->entries) {
assert(!entry->values.empty());
if (!isValidSymbol(entry->name)) {
- mError = (std::stringstream()
- << "invalid symbol name '"
- << StringPiece16(entry->name)
- << "'").str();
+ std::stringstream err;
+ err << "invalid symbol name '"
+ << StringPiece16(entry->name)
+ << "'";
+ mError = err.str();
return false;
}
entry->values.front().value->accept(*this, GenArgs{ out, *entry });