Skip to content

Commit

Permalink
Fix some clang compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
pstorz committed Mar 7, 2018
1 parent ed4ce5e commit ae715e4
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/console/console.cc
Expand Up @@ -1114,7 +1114,7 @@ static int dir_psk_client_callback(char *identity,
} else {
static char *psk_identity = (char *)"Nasenbaer";

unsigned int ret = snprintf(identity, max_identity_len, "%s", psk_identity);
int ret = bsnprintf(identity, max_identity_len, "%s", psk_identity);
if (ret < 0 || (unsigned int)ret > max_identity_len) {
Dmsg0(100, "Error, psk_identify too long\n");
result = 0;
Expand Down
5 changes: 0 additions & 5 deletions src/dird/ndmp_dma_backup_NDMP_NATIVE.cc
Expand Up @@ -117,11 +117,6 @@ int ndmp_load_next(struct ndm_session *sess) {
goto bail_out;
}

if ( media->slot_addr < 0 ) {
Jmsg(jcr, M_FATAL, 0, _("lookup_storage_mapping failed\n"));
goto bail_out;
}

slot_number_t slotnumber = lookup_storage_mapping(store, slot_type_normal, LOGICAL_TO_PHYSICAL, mr.Slot);
/*
* check if lookup_storage_mapping was successful
Expand Down
2 changes: 1 addition & 1 deletion src/filed/fd_plugins.cc
Expand Up @@ -1763,7 +1763,7 @@ static inline bpContext *instantiate_plugin(JCR *jcr, Plugin *plugin, char insta
b_plugin_ctx *b_ctx;

b_ctx = (b_plugin_ctx *)malloc(sizeof(b_plugin_ctx));
(b_plugin_ctx *)memset(b_ctx, 0, sizeof(b_plugin_ctx));
b_ctx = (b_plugin_ctx *)memset(b_ctx, 0, sizeof(b_plugin_ctx));
b_ctx->jcr = jcr;
b_ctx->plugin = plugin;

Expand Down
10 changes: 5 additions & 5 deletions src/lib/tls_openssl.cc
Expand Up @@ -523,7 +523,7 @@ static unsigned int psk_client_cb(SSL *ssl,
* Now let's check if the given identity is the same and
* provide the psk.
*/
unsigned int ret =
int ret =
bsnprintf(identity, max_identity_len, "%s", credentials->get_identity().c_str());

if (ret < 0 || (unsigned int)ret > max_identity_len) {
Expand Down Expand Up @@ -828,19 +828,19 @@ std::shared_ptr<TLS_CONTEXT> tls_cert_t::CreateServerContext(
}

bool tls_cert_t::enabled(u_int32_t policy) {
return (policy >> tls_cert_t::policy_offset) & BNET_TLS_ENABLED == BNET_TLS_ENABLED;
return ((policy >> tls_cert_t::policy_offset) & BNET_TLS_ENABLED) == BNET_TLS_ENABLED;
}

bool tls_cert_t::required(u_int32_t policy) {
return (policy >> tls_cert_t::policy_offset) & BNET_TLS_REQUIRED == BNET_TLS_REQUIRED;
return ((policy >> tls_cert_t::policy_offset) & BNET_TLS_REQUIRED) == BNET_TLS_REQUIRED;
}

bool tls_psk_t::enabled(u_int32_t policy) {
return (policy >> tls_psk_t::policy_offset) & BNET_TLS_ENABLED == BNET_TLS_ENABLED;
return ((policy >> tls_psk_t::policy_offset) & BNET_TLS_ENABLED) == BNET_TLS_ENABLED;
}

bool tls_psk_t::required(u_int32_t policy) {
return (policy >> tls_psk_t::policy_offset) & BNET_TLS_REQUIRED == BNET_TLS_REQUIRED;
return ((policy >> tls_psk_t::policy_offset) & BNET_TLS_REQUIRED) == BNET_TLS_REQUIRED;
}

std::shared_ptr<TLS_CONTEXT> tls_psk_t::CreateClientContext(
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/filed/example-plugin-fd.cc
Expand Up @@ -199,10 +199,10 @@ static bRC handlePluginEvent(bpContext *ctx, bEvent *event, void *value)
printf("plugin: BackupEnd\n");
break;
case bEventLevel:
printf("plugin: JobLevel=%c %d\n", (int64_t)value, (int64_t)value);
printf("plugin: JobLevel=%c %ld\n", (int64_t)value, (int64_t)value);
break;
case bEventSince:
printf("plugin: since=%d\n", (int64_t)value);
printf("plugin: since=%ld\n", (int64_t)value);
break;
case bEventStartRestoreJob:
printf("plugin: StartRestoreJob\n");
Expand Down
12 changes: 6 additions & 6 deletions src/plugins/filed/fd_common.h
Expand Up @@ -66,28 +66,28 @@ DLL_IMP_EXP void reallyfree(const char *file, int line, void *fp);
DLL_IMP_EXP void *sm_malloc(const char *fname, int lineno, unsigned int nbytes);
DLL_IMP_EXP void sm_free(const char *file, int line, void *fp);

inline void *operator new(size_t size, char const * file, int line)
void *operator new(size_t size, char const * file, int line)
{
void *pnew = sm_malloc(file,line, size);
memset((char *)pnew, 0, size);
return pnew;
}

inline void *operator new[](size_t size, char const * file, int line)
void *operator new[](size_t size, char const * file, int line)
{
void *pnew = sm_malloc(file, line, size);
memset((char *)pnew, 0, size);
return pnew;
}

inline void *operator new(size_t size)
void *operator new(size_t size)
{
void *pnew = sm_malloc(__FILE__, __LINE__, size);
memset((char *)pnew, 0, size);
return pnew;
}

inline void *operator new[](size_t size)
void *operator new[](size_t size)
{
void *pnew = sm_malloc(__FILE__, __LINE__, size);
memset((char *)pnew, 0, size);
Expand All @@ -96,12 +96,12 @@ inline void *operator new[](size_t size)

#define new new(__FILE__, __LINE__)

inline void operator delete(void *buf)
void operator delete(void *buf) noexcept
{
sm_free( __FILE__, __LINE__, buf);
}

inline void operator delete[] (void *buf)
void operator delete[] (void *buf) noexcept
{
sm_free(__FILE__, __LINE__, buf);
}
Expand Down

0 comments on commit ae715e4

Please sign in to comment.