mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2024-11-14 00:14:07 +00:00
Fix a few nits (#1645)
Make some strings more const, initialize members, and abort if lock initialization fails. Partially found via clang-tidy.
This commit is contained in:
parent
cb9148f6cd
commit
8ef01d37a9
@ -106,7 +106,7 @@ bool BodyData::Append(void* ptr, size_t bytes)
|
|||||||
const char* BodyData::str() const
|
const char* BodyData::str() const
|
||||||
{
|
{
|
||||||
if(!text){
|
if(!text){
|
||||||
static const char* strnull = "";
|
static const char strnull[] = "";
|
||||||
return strnull;
|
return strnull;
|
||||||
}
|
}
|
||||||
return text;
|
return text;
|
||||||
|
@ -29,8 +29,9 @@
|
|||||||
// Global variables
|
// Global variables
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// TODO: namespace these
|
// TODO: namespace these
|
||||||
extern int64_t FIVE_GB;
|
static const int64_t FIVE_GB = 5LL * 1024LL * 1024LL * 1024LL;
|
||||||
extern off_t MIN_MULTIPART_SIZE;
|
static const off_t MIN_MULTIPART_SIZE = 5 * 1024 * 1024;
|
||||||
|
|
||||||
extern bool foreground;
|
extern bool foreground;
|
||||||
extern bool nomultipart;
|
extern bool nomultipart;
|
||||||
extern bool pathrequeststyle;
|
extern bool pathrequeststyle;
|
||||||
|
@ -64,8 +64,8 @@ static const std::string IAMCRED_ROLEARN = "RoleArn";
|
|||||||
// If the mime.types file is not found, s3fs will exit with an
|
// If the mime.types file is not found, s3fs will exit with an
|
||||||
// error.
|
// error.
|
||||||
//
|
//
|
||||||
static const char* DEFAULT_MIME_FILE = "/etc/mime.types";
|
static const char DEFAULT_MIME_FILE[] = "/etc/mime.types";
|
||||||
static const char* SPECIAL_DARWIN_MIME_FILE = "/etc/apache2/mime.types";
|
static const char SPECIAL_DARWIN_MIME_FILE[] = "/etc/apache2/mime.types";
|
||||||
|
|
||||||
// [NOTICE]
|
// [NOTICE]
|
||||||
// This symbol is for libcurl under 7.23.0
|
// This symbol is for libcurl under 7.23.0
|
||||||
@ -1910,7 +1910,7 @@ S3fsCurl::S3fsCurl(bool ahbe) :
|
|||||||
LastResponseCode(S3FSCURL_RESPONSECODE_NOTSET), postdata(NULL), postdata_remaining(0), is_use_ahbe(ahbe),
|
LastResponseCode(S3FSCURL_RESPONSECODE_NOTSET), postdata(NULL), postdata_remaining(0), is_use_ahbe(ahbe),
|
||||||
retry_count(0), b_infile(NULL), b_postdata(NULL), b_postdata_remaining(0), b_partdata_startpos(0), b_partdata_size(0),
|
retry_count(0), b_infile(NULL), b_postdata(NULL), b_postdata_remaining(0), b_partdata_startpos(0), b_partdata_size(0),
|
||||||
b_ssekey_pos(-1), b_ssetype(sse_type_t::SSE_DISABLE),
|
b_ssekey_pos(-1), b_ssetype(sse_type_t::SSE_DISABLE),
|
||||||
sem(NULL), completed_tids_lock(NULL), completed_tids(NULL), fpLazySetup(NULL)
|
sem(NULL), completed_tids_lock(NULL), completed_tids(NULL), fpLazySetup(NULL), curlCode(CURLE_OK)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,6 +41,7 @@ S3fsMultiCurl::S3fsMultiCurl(int maxParallelism) : maxParallelism(maxParallelism
|
|||||||
#endif
|
#endif
|
||||||
if (0 != (result = pthread_mutex_init(&completed_tids_lock, &attr))) {
|
if (0 != (result = pthread_mutex_init(&completed_tids_lock, &attr))) {
|
||||||
S3FS_PRN_ERR("could not initialize completed_tids_lock: %i", result);
|
S3FS_PRN_ERR("could not initialize completed_tids_lock: %i", result);
|
||||||
|
abort();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,9 +24,6 @@
|
|||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// Global variables
|
// Global variables
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
int64_t FIVE_GB = 5LL * 1024LL * 1024LL * 1024LL;
|
|
||||||
off_t MIN_MULTIPART_SIZE = 5 * 1024 * 1024;
|
|
||||||
|
|
||||||
bool foreground = false;
|
bool foreground = false;
|
||||||
bool nomultipart = false;
|
bool nomultipart = false;
|
||||||
bool pathrequeststyle = false;
|
bool pathrequeststyle = false;
|
||||||
|
@ -28,9 +28,9 @@
|
|||||||
// S3fsLog class : variables
|
// S3fsLog class : variables
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
const int S3fsLog::NEST_MAX;
|
const int S3fsLog::NEST_MAX;
|
||||||
const char* S3fsLog::nest_spaces[S3fsLog::NEST_MAX] = {"", " ", " ", " "};
|
const char* const S3fsLog::nest_spaces[S3fsLog::NEST_MAX] = {"", " ", " ", " "};
|
||||||
const char* S3fsLog::LOGFILEENV = "S3FS_LOGFILE";
|
const char S3fsLog::LOGFILEENV[] = "S3FS_LOGFILE";
|
||||||
const char* S3fsLog::MSGTIMESTAMP = "S3FS_MSGTIMESTAMP";
|
const char S3fsLog::MSGTIMESTAMP[] = "S3FS_MSGTIMESTAMP";
|
||||||
S3fsLog* S3fsLog::pSingleton = NULL;
|
S3fsLog* S3fsLog::pSingleton = NULL;
|
||||||
S3fsLog::s3fs_log_level S3fsLog::debug_level = S3fsLog::LEVEL_CRIT;
|
S3fsLog::s3fs_log_level S3fsLog::debug_level = S3fsLog::LEVEL_CRIT;
|
||||||
FILE* S3fsLog::logfp = NULL;
|
FILE* S3fsLog::logfp = NULL;
|
||||||
|
@ -53,10 +53,11 @@ class S3fsLog
|
|||||||
};
|
};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static const int NEST_MAX = 4;
|
static const int NEST_MAX = 4;
|
||||||
static const char* nest_spaces[NEST_MAX];
|
static const char* const nest_spaces[NEST_MAX];
|
||||||
static const char* LOGFILEENV;
|
static const char LOGFILEENV[];
|
||||||
static const char* MSGTIMESTAMP;
|
static const char MSGTIMESTAMP[];
|
||||||
|
|
||||||
static S3fsLog* pSingleton;
|
static S3fsLog* pSingleton;
|
||||||
static s3fs_log_level debug_level;
|
static s3fs_log_level debug_level;
|
||||||
static FILE* logfp;
|
static FILE* logfp;
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// Variables
|
// Variables
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
static const char* c_strErrorObjectName = "FILE or SUBDIR in DIR";
|
static const char c_strErrorObjectName[] = "FILE or SUBDIR in DIR";
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// Functions
|
// Functions
|
||||||
|
@ -379,7 +379,7 @@ std::string s3fs_hex(const unsigned char* input, size_t length, bool lower)
|
|||||||
|
|
||||||
char* s3fs_base64(const unsigned char* input, size_t length)
|
char* s3fs_base64(const unsigned char* input, size_t length)
|
||||||
{
|
{
|
||||||
static const char* base = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
static const char base[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
||||||
char* result;
|
char* result;
|
||||||
|
|
||||||
if(!input || 0 == length){
|
if(!input || 0 == length){
|
||||||
|
Loading…
Reference in New Issue
Block a user