Enable all cppcheck rules

This commit is contained in:
Andrew Gaul 2015-08-16 17:02:05 -07:00
parent 2e344bb48f
commit c0b21d8808
5 changed files with 8 additions and 14 deletions

View File

@ -31,10 +31,9 @@ release : dist ../utils/release.sh
cppcheck:
cppcheck --quiet --error-exitcode=1 \
-U CURLE_PEER_FAILED_VERIFICATION \
--enable=warning \
--enable=performance \
--enable=portability \
--enable=information \
--enable=missingInclude \
--enable=all \
--suppress=missingIncludeSystem \
--suppress=unsignedLessThanZero \
--suppress=unusedFunction \
--suppress=variableScope \
src/ test/

View File

@ -18,6 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -77,7 +78,7 @@ inline unsigned char char_decode64(const char ch)
}else if('=' == ch){ // =
by = 64;
}else{ // something wrong
by = 64;
by = UCHAR_MAX;
}
return by;
}

View File

@ -619,7 +619,7 @@ bool S3fsCurl::LocateBundle(void)
size_t S3fsCurl::WriteMemoryCallback(void* ptr, size_t blockSize, size_t numBlocks, void* data)
{
BodyData* body = (BodyData*)data;
BodyData* body = static_cast<BodyData*>(data);
if(!body->Append(ptr, blockSize, numBlocks)){
DPRNCRIT("BodyData.Append() returned false.");

View File

@ -844,7 +844,6 @@ static int create_file_object(const char* path, mode_t mode, uid_t uid, gid_t gi
static int s3fs_mknod(const char *path, mode_t mode, dev_t rdev)
{
int result;
headers_t meta;
struct fuse_context* pcxt;
FPRN("[path=%s][mode=%04o][dev=%ju]", path, mode, (uintmax_t)rdev);
@ -866,7 +865,6 @@ static int s3fs_mknod(const char *path, mode_t mode, dev_t rdev)
static int s3fs_create(const char* path, mode_t mode, struct fuse_file_info* fi)
{
int result;
headers_t meta;
struct fuse_context* pcxt;
FPRN("[path=%s][mode=%04o][flags=%d]", path, mode, fi->flags);
@ -1937,7 +1935,6 @@ static int s3fs_truncate(const char* path, off_t size)
static int s3fs_open(const char* path, struct fuse_file_info* fi)
{
int result;
headers_t meta;
struct stat st;
FPRN("[path=%s][flags=%d]", path, fi->flags);
@ -2301,7 +2298,6 @@ static int readdir_multi_head(const char* path, S3ObjList& head, void* buf, fuse
static int s3fs_readdir(const char* path, void* buf, fuse_fill_dir_t filler, off_t offset, struct fuse_file_info* fi)
{
S3ObjList head;
s3obj_list_t headlist;
int result;
FPRN("[path=%s]", path);
@ -2672,7 +2668,6 @@ static char* get_object_name(xmlDocPtr doc, xmlNodePtr node, const char* path)
}
// Make dir path and filename
string strfullpath= (char*)fullpath;
string strdirpath = mydirname(string((char*)fullpath));
string strmybpath = mybasename(string((char*)fullpath));
const char* dirpath = strdirpath.c_str();

View File

@ -479,7 +479,6 @@ bool AutoLock::Unlock(void)
string get_username(uid_t uid)
{
static size_t maxlen = 0; // set onece
int result;
char* pbuf;
struct passwd pwinfo;
struct passwd* ppwinfo = NULL;
@ -499,7 +498,7 @@ string get_username(uid_t uid)
return string("");
}
// get group information
if(0 != (result = getpwuid_r(uid, &pwinfo, pbuf, maxlen, &ppwinfo))){
if(0 != getpwuid_r(uid, &pwinfo, pbuf, maxlen, &ppwinfo)){
DPRNNN("could not get pw information.");
free(pbuf);
return string("");