Skip to content

Commit fd7d51c

Browse files
committed
Resolve nonsense static analysis warnings
1 parent f0c5f92 commit fd7d51c

File tree

7 files changed

+15
-15
lines changed

7 files changed

+15
-15
lines changed

deps/jemalloc/include/jemalloc/internal/jemalloc_internal_inlines_c.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ iget_defrag_hint(tsdn_t *tsdn, void* ptr) {
235235
int free_in_slab = extent_nfree_get(slab);
236236
if (free_in_slab) {
237237
const bin_info_t *bin_info = &bin_infos[binind];
238-
int curslabs = bin->stats.curslabs;
238+
unsigned long curslabs = bin->stats.curslabs;
239239
size_t curregs = bin->stats.curregs;
240240
if (bin->slabcur) {
241241
/* remove slabcur from the overall utilization */

src/lolwut.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ lwCanvas *lwCreateCanvas(int width, int height, int bgcolor) {
9494
lwCanvas *canvas = zmalloc(sizeof(*canvas));
9595
canvas->width = width;
9696
canvas->height = height;
97-
canvas->pixels = zmalloc(width*height);
98-
memset(canvas->pixels,bgcolor,width*height);
97+
canvas->pixels = zmalloc((size_t)width*height);
98+
memset(canvas->pixels,bgcolor,(size_t)width*height);
9999
return canvas;
100100
}
101101

src/memtest.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ void memtest_progress_start(char *title, int pass) {
7171
printf("\x1b[H\x1b[2K"); /* Cursor home, clear current line. */
7272
printf("%s [%d]\n", title, pass); /* Print title. */
7373
progress_printed = 0;
74-
progress_full = ws.ws_col*(ws.ws_row-3);
74+
progress_full = (size_t)ws.ws_col*(ws.ws_row-3);
7575
fflush(stdout);
7676
}
7777

src/object.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,7 @@ size_t objectComputeSize(robj *o, size_t sample_size) {
836836
if (samples) asize += (double)elesize/samples*dictSize(d);
837837
} else if (o->encoding == OBJ_ENCODING_INTSET) {
838838
intset *is = o->ptr;
839-
asize = sizeof(*o)+sizeof(*is)+is->encoding*is->length;
839+
asize = sizeof(*o)+sizeof(*is)+(size_t)is->encoding*is->length;
840840
} else {
841841
serverPanic("Unknown set encoding");
842842
}

src/redis-check-rdb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ int redis_check_rdb(char *rdbfilename, FILE *fp) {
250250
rdbstate.doing = RDB_CHECK_DOING_READ_LEN;
251251
if ((dbid = rdbLoadLen(&rdb,NULL)) == RDB_LENERR)
252252
goto eoferr;
253-
rdbCheckInfo("Selecting DB ID %d", dbid);
253+
rdbCheckInfo("Selecting DB ID %llu", (unsigned long long)dbid);
254254
continue; /* Read type again. */
255255
} else if (type == RDB_OPCODE_RESIZEDB) {
256256
/* RESIZEDB: Hint about the size of the keys in the currently

src/redis-cli.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5476,7 +5476,7 @@ static void clusterManagerNodeArrayReset(clusterManagerNodeArray *array) {
54765476
static void clusterManagerNodeArrayShift(clusterManagerNodeArray *array,
54775477
clusterManagerNode **nodeptr)
54785478
{
5479-
assert(array->nodes < (array->nodes + array->len));
5479+
assert(array->len > 0);
54805480
/* If the first node to be shifted is not NULL, decrement count. */
54815481
if (*array->nodes != NULL) array->count--;
54825482
/* Store the first node to be shifted into 'nodeptr'. */
@@ -5489,7 +5489,7 @@ static void clusterManagerNodeArrayShift(clusterManagerNodeArray *array,
54895489
static void clusterManagerNodeArrayAdd(clusterManagerNodeArray *array,
54905490
clusterManagerNode *node)
54915491
{
5492-
assert(array->nodes < (array->nodes + array->len));
5492+
assert(array->len > 0);
54935493
assert(node != NULL);
54945494
assert(array->count < array->len);
54955495
array->nodes[array->count++] = node;
@@ -6866,7 +6866,7 @@ void showLatencyDistSamples(struct distsamples *samples, long long tot) {
68666866
printf("\033[38;5;0m"); /* Set foreground color to black. */
68676867
for (j = 0; ; j++) {
68686868
int coloridx =
6869-
ceil((float) samples[j].count / tot * (spectrum_palette_size-1));
6869+
ceil((double) samples[j].count / tot * (spectrum_palette_size-1));
68706870
int color = spectrum_palette[coloridx];
68716871
printf("\033[48;5;%dm%c", (int)color, samples[j].character);
68726872
samples[j].count = 0;

src/sentinel.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4119,16 +4119,16 @@ void sentinelSetCommand(client *c) {
41194119
int numargs = j-old_j+1;
41204120
switch(numargs) {
41214121
case 2:
4122-
sentinelEvent(LL_WARNING,"+set",ri,"%@ %s %s",c->argv[old_j]->ptr,
4123-
c->argv[old_j+1]->ptr);
4122+
sentinelEvent(LL_WARNING,"+set",ri,"%@ %s %s",(char*)c->argv[old_j]->ptr,
4123+
(char*)c->argv[old_j+1]->ptr);
41244124
break;
41254125
case 3:
4126-
sentinelEvent(LL_WARNING,"+set",ri,"%@ %s %s %s",c->argv[old_j]->ptr,
4127-
c->argv[old_j+1]->ptr,
4128-
c->argv[old_j+2]->ptr);
4126+
sentinelEvent(LL_WARNING,"+set",ri,"%@ %s %s %s",(char*)c->argv[old_j]->ptr,
4127+
(char*)c->argv[old_j+1]->ptr,
4128+
(char*)c->argv[old_j+2]->ptr);
41294129
break;
41304130
default:
4131-
sentinelEvent(LL_WARNING,"+set",ri,"%@ %s",c->argv[old_j]->ptr);
4131+
sentinelEvent(LL_WARNING,"+set",ri,"%@ %s",(char*)c->argv[old_j]->ptr);
41324132
break;
41334133
}
41344134
}

0 commit comments

Comments
 (0)