Fix comparison of String8 to char* literal

Clang (correctly) interprets

if ("." == sName)

as

if ("." == (const char*)sName)

and recognizes that comparing the pointers isn't what was meant.

With

if (sName == ".")

both clang and gcc see and use String8::operator==(const char *),
ensuring we get the wanted behavior.

Change-Id: Ide240e13214a56f6899f72de3db75dac647e6d4b
Signed-off-by: Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>
This commit is contained in:
Bernhard Rosenkraenzer
2014-09-18 21:17:29 +02:00
parent 14fc930d5d
commit f129e84add

View File

@@ -238,7 +238,7 @@ private:
*/
bool isDotOrDDot(const struct dirent* pEntry) const {
String8 sName(pEntry->d_name);
return "." == sName || ".." == sName;
return sName == "." || sName == "..";
}
/**