Merge pull request #1001 from gaul/missing-braces

Add missing braces
This commit is contained in:
Takeshi Nakatani 2019-04-08 23:55:02 +09:00 committed by GitHub
commit cd280d8702
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 7 deletions

View File

@ -933,8 +933,9 @@ static int s3fs_readlink(const char* _path, char* buf, size_t size)
// check buf if it has space words. // check buf if it has space words.
string strTmp = trim(string(buf)); string strTmp = trim(string(buf));
// decode wtf8. This will always be shorter // decode wtf8. This will always be shorter
if (use_wtf8) if(use_wtf8){
strTmp = s3fs_wtf8_decode(strTmp); strTmp = s3fs_wtf8_decode(strTmp);
}
strcpy(buf, strTmp.c_str()); strcpy(buf, strTmp.c_str());
FdManager::get()->Close(ent); FdManager::get()->Close(ent);
@ -2489,8 +2490,9 @@ static int readdir_multi_head(const char* path, S3ObjList& head, void* buf, fuse
struct stat st; struct stat st;
bool in_cache = StatCache::getStatCacheData()->GetStat((*iter), &st); bool in_cache = StatCache::getStatCacheData()->GetStat((*iter), &st);
string bpath = mybasename((*iter)); string bpath = mybasename((*iter));
if (use_wtf8) if(use_wtf8){
bpath = s3fs_wtf8_decode(bpath); bpath = s3fs_wtf8_decode(bpath);
}
if(in_cache){ if(in_cache){
filler(buf, bpath.c_str(), &st, 0); filler(buf, bpath.c_str(), &st, 0);
}else{ }else{

View File

@ -472,8 +472,9 @@ bool s3fs_wtf8_encode(const char *s, string *result)
// single byte encoding // single byte encoding
if (c <= 0x7f) { if (c <= 0x7f) {
if (result) if (result) {
*result += c; *result += c;
}
continue; continue;
} }
@ -554,14 +555,16 @@ bool s3fs_wtf8_decode(const char *s, string *result)
if (code >= escape_base && code <= escape_base + 0xff) { if (code >= escape_base && code <= escape_base + 0xff) {
// convert back // convert back
encoded = true; encoded = true;
if (result) if(result){
*result += code - escape_base; *result += code - escape_base;
}
s+=2; s+=2;
continue; continue;
} }
} }
if (result) if (result) {
*result += c; *result += c;
}
} }
return encoded; return encoded;
} }