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

View File

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