diff --git a/src/s3fs.cpp b/src/s3fs.cpp index 527a85a..8f48b82 100644 --- a/src/s3fs.cpp +++ b/src/s3fs.cpp @@ -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{ diff --git a/src/string_util.cpp b/src/string_util.cpp index 1849f8f..95190a5 100644 --- a/src/string_util.cpp +++ b/src/string_util.cpp @@ -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; }