mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2024-11-18 02:05:13 +00:00
Merge pull request #1074 from gaul/clang-tidy
Configure clang-tidy target
This commit is contained in:
commit
6bd1a7eac0
@ -1,6 +1,7 @@
|
|||||||
Checks: '
|
Checks: '
|
||||||
-*,
|
-*,
|
||||||
bugprone-*,
|
bugprone-*,
|
||||||
|
-bugprone-macro-parentheses,
|
||||||
google-*,
|
google-*,
|
||||||
-google-build-using-namespace,
|
-google-build-using-namespace,
|
||||||
-google-readability-casting,
|
-google-readability-casting,
|
||||||
@ -12,6 +13,7 @@ Checks: '
|
|||||||
-misc-redundant-expression,
|
-misc-redundant-expression,
|
||||||
-misc-unused-parameters,
|
-misc-unused-parameters,
|
||||||
modernize-*,
|
modernize-*,
|
||||||
|
-modernize-avoid-c-arrays,
|
||||||
-modernize-deprecated-headers,
|
-modernize-deprecated-headers,
|
||||||
-modernize-loop-convert,
|
-modernize-loop-convert,
|
||||||
-modernize-use-auto,
|
-modernize-use-auto,
|
||||||
@ -22,5 +24,7 @@ Checks: '
|
|||||||
readability-*,
|
readability-*,
|
||||||
-readability-else-after-return,
|
-readability-else-after-return,
|
||||||
-readability-implicit-bool-conversion,
|
-readability-implicit-bool-conversion,
|
||||||
|
-readability-isolate-declaration,
|
||||||
|
-readability-magic-numbers,
|
||||||
-readability-named-parameter,
|
-readability-named-parameter,
|
||||||
-readability-simplify-boolean-expr'
|
-readability-simplify-boolean-expr'
|
||||||
|
@ -24,7 +24,15 @@ if USE_GNUTLS_NETTLE
|
|||||||
AM_CPPFLAGS += -DUSE_GNUTLS_NETTLE
|
AM_CPPFLAGS += -DUSE_GNUTLS_NETTLE
|
||||||
endif
|
endif
|
||||||
|
|
||||||
s3fs_SOURCES = s3fs.cpp s3fs.h curl.cpp curl.h cache.cpp cache.h string_util.cpp string_util.h s3fs_util.cpp s3fs_util.h fdcache.cpp fdcache.h common_auth.cpp s3fs_auth.h addhead.cpp addhead.h common.h
|
s3fs_SOURCES = \
|
||||||
|
s3fs.cpp \
|
||||||
|
curl.cpp \
|
||||||
|
cache.cpp \
|
||||||
|
string_util.cpp \
|
||||||
|
s3fs_util.cpp \
|
||||||
|
fdcache.cpp \
|
||||||
|
common_auth.cpp \
|
||||||
|
addhead.cpp
|
||||||
if USE_SSL_OPENSSL
|
if USE_SSL_OPENSSL
|
||||||
s3fs_SOURCES += openssl_auth.cpp
|
s3fs_SOURCES += openssl_auth.cpp
|
||||||
endif
|
endif
|
||||||
@ -39,6 +47,9 @@ s3fs_LDADD = $(DEPS_LIBS)
|
|||||||
|
|
||||||
noinst_PROGRAMS = test_string_util
|
noinst_PROGRAMS = test_string_util
|
||||||
|
|
||||||
test_string_util_SOURCES = string_util.cpp test_string_util.cpp test_util.h
|
test_string_util_SOURCES = string_util.cpp test_string_util.cpp
|
||||||
|
|
||||||
TESTS = test_string_util
|
TESTS = test_string_util
|
||||||
|
|
||||||
|
clang-tidy:
|
||||||
|
clang-tidy $(s3fs_SOURCES) -- $(DEPS_CFLAGS) $(CPPFLAGS)
|
||||||
|
@ -3853,7 +3853,7 @@ int S3fsCurl::MultipartHeadRequest(const char* tpath, off_t size, headers_t& met
|
|||||||
strrange.str("");
|
strrange.str("");
|
||||||
strrange.clear(stringstream::goodbit);
|
strrange.clear(stringstream::goodbit);
|
||||||
|
|
||||||
if(0 != (result = CopyMultipartPostSetup(tpath, tpath, (list.size() + 1), upload_id, meta))){
|
if(0 != (result = CopyMultipartPostSetup(tpath, tpath, static_cast<int>(list.size() + 1), upload_id, meta))){
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
list.push_back(partdata.etag);
|
list.push_back(partdata.etag);
|
||||||
|
@ -937,7 +937,7 @@ static int s3fs_readlink(const char* _path, char* buf, size_t size)
|
|||||||
if(use_wtf8){
|
if(use_wtf8){
|
||||||
strTmp = s3fs_wtf8_decode(strTmp);
|
strTmp = s3fs_wtf8_decode(strTmp);
|
||||||
}
|
}
|
||||||
strcpy(buf, strTmp.c_str());
|
strncpy(buf, strTmp.c_str(), size);
|
||||||
|
|
||||||
FdManager::get()->Close(ent);
|
FdManager::get()->Close(ent);
|
||||||
S3FS_MALLOCTRIM(0);
|
S3FS_MALLOCTRIM(0);
|
||||||
@ -973,7 +973,7 @@ static int do_create_bucket()
|
|||||||
headers_t meta;
|
headers_t meta;
|
||||||
|
|
||||||
S3fsCurl s3fscurl(true);
|
S3fsCurl s3fscurl(true);
|
||||||
long res = s3fscurl.PutRequest("/", meta, tmpfd);
|
int res = s3fscurl.PutRequest("/", meta, tmpfd);
|
||||||
if(res < 0){
|
if(res < 0){
|
||||||
long responseCode = s3fscurl.GetLastResponseCode();
|
long responseCode = s3fscurl.GetLastResponseCode();
|
||||||
if((responseCode == 400 || responseCode == 403) && S3fsCurl::IsSignatureV4()){
|
if((responseCode == 400 || responseCode == 403) && S3fsCurl::IsSignatureV4()){
|
||||||
@ -4558,7 +4558,7 @@ static int my_fuse_opt_proc(void* data, const char* arg, int key, struct fuse_ar
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if(0 == STR2NCMP(arg, "multireq_max=")){
|
if(0 == STR2NCMP(arg, "multireq_max=")){
|
||||||
long maxreq = static_cast<long>(s3fs_strtoofft(strchr(arg, '=') + sizeof(char)));
|
int maxreq = static_cast<int>(s3fs_strtoofft(strchr(arg, '=') + sizeof(char)));
|
||||||
S3fsCurl::SetMaxMultiRequest(maxreq);
|
S3fsCurl::SetMaxMultiRequest(maxreq);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ off_t s3fs_strtoofft(const char* str, bool is_base_16)
|
|||||||
string lower(string s)
|
string lower(string s)
|
||||||
{
|
{
|
||||||
// change each character of the string to lower case
|
// change each character of the string to lower case
|
||||||
for(unsigned int i = 0; i < s.length(); i++){
|
for(size_t i = 0; i < s.length(); i++){
|
||||||
s[i] = tolower(s[i]);
|
s[i] = tolower(s[i]);
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
@ -132,7 +132,7 @@ string trim(const string &s, const string &t /* = SPACES */)
|
|||||||
string urlEncode(const string &s)
|
string urlEncode(const string &s)
|
||||||
{
|
{
|
||||||
string result;
|
string result;
|
||||||
for (unsigned i = 0; i < s.length(); ++i) {
|
for (size_t i = 0; i < s.length(); ++i) {
|
||||||
char c = s[i];
|
char c = s[i];
|
||||||
if (c == '/' // Note- special case for fuse paths...
|
if (c == '/' // Note- special case for fuse paths...
|
||||||
|| c == '.'
|
|| c == '.'
|
||||||
@ -160,7 +160,7 @@ string urlEncode(const string &s)
|
|||||||
string urlEncode2(const string &s)
|
string urlEncode2(const string &s)
|
||||||
{
|
{
|
||||||
string result;
|
string result;
|
||||||
for (unsigned i = 0; i < s.length(); ++i) {
|
for (size_t i = 0; i < s.length(); ++i) {
|
||||||
char c = s[i];
|
char c = s[i];
|
||||||
if (c == '=' // Note- special case for fuse paths...
|
if (c == '=' // Note- special case for fuse paths...
|
||||||
|| c == '&' // Note- special case for s3...
|
|| c == '&' // Note- special case for s3...
|
||||||
@ -185,11 +185,11 @@ string urlEncode2(const string &s)
|
|||||||
string urlDecode(const string& s)
|
string urlDecode(const string& s)
|
||||||
{
|
{
|
||||||
string result;
|
string result;
|
||||||
for(unsigned i = 0; i < s.length(); ++i){
|
for(size_t i = 0; i < s.length(); ++i){
|
||||||
if(s[i] != '%'){
|
if(s[i] != '%'){
|
||||||
result += s[i];
|
result += s[i];
|
||||||
}else{
|
}else{
|
||||||
char ch = 0;
|
int ch = 0;
|
||||||
if(s.length() <= ++i){
|
if(s.length() <= ++i){
|
||||||
break; // wrong format.
|
break; // wrong format.
|
||||||
}
|
}
|
||||||
@ -199,7 +199,7 @@ string urlDecode(const string& s)
|
|||||||
}
|
}
|
||||||
ch *= 16;
|
ch *= 16;
|
||||||
ch += ('0' <= s[i] && s[i] <= '9') ? (s[i] - '0') : ('A' <= s[i] && s[i] <= 'F') ? (s[i] - 'A' + 0x0a) : ('a' <= s[i] && s[i] <= 'f') ? (s[i] - 'a' + 0x0a) : 0x00;
|
ch += ('0' <= s[i] && s[i] <= '9') ? (s[i] - '0') : ('A' <= s[i] && s[i] <= 'F') ? (s[i] - 'A' + 0x0a) : ('a' <= s[i] && s[i] <= 'f') ? (s[i] - 'a' + 0x0a) : 0x00;
|
||||||
result += ch;
|
result += static_cast<char>(ch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -525,9 +525,9 @@ bool s3fs_wtf8_encode(const char *s, string *result)
|
|||||||
invalid = true;
|
invalid = true;
|
||||||
if (result) {
|
if (result) {
|
||||||
unsigned escape = escape_base + c;
|
unsigned escape = escape_base + c;
|
||||||
*result += 0xe0 | ((escape >> 12) & 0x0f);
|
*result += static_cast<char>(0xe0 | ((escape >> 12) & 0x0f));
|
||||||
*result += 0x80 | ((escape >> 06) & 0x3f);
|
*result += static_cast<char>(0x80 | ((escape >> 06) & 0x3f));
|
||||||
*result += 0x80 | ((escape >> 00) & 0x3f);
|
*result += static_cast<char>(0x80 | ((escape >> 00) & 0x3f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return invalid;
|
return invalid;
|
||||||
@ -556,7 +556,7 @@ bool s3fs_wtf8_decode(const char *s, string *result)
|
|||||||
// convert back
|
// convert back
|
||||||
encoded = true;
|
encoded = true;
|
||||||
if(result){
|
if(result){
|
||||||
*result += code - escape_base;
|
*result += static_cast<char>(code - escape_base);
|
||||||
}
|
}
|
||||||
s+=2;
|
s+=2;
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user