Update file_system.cc

This commit is contained in:
tg-at-google 2020-06-04 15:34:14 +00:00 committed by GitHub
parent 7581d2a338
commit ffe19213d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -308,8 +308,8 @@ StringPiece FileSystem::Basename(StringPiece path) const {
StringPiece FileSystem::Extension(StringPiece path) const {
StringPiece basename = this->Basename(path);
int pos = basename.rfind('.');
if (static_cast<size_t>(pos) == StringPiece::npos) {
size_t pos = basename.rfind('.');
if (pos == StringPiece::npos) {
return StringPiece(path.data() + path.size(), 0);
} else {
return StringPiece(path.data() + pos + 1, path.size() - (pos + 1));