mirror of
https://github.com/transmission/transmission
synced 2025-03-10 14:13:23 +00:00
Wrap sizeof arguments in braces
This commit is contained in:
parent
6303bb2247
commit
8f3cb1c68d
4 changed files with 15 additions and 15 deletions
|
@ -208,7 +208,7 @@ static gboolean refreshFilesForeach(GtkTreeModel* model, GtkTreePath* path UNUSE
|
|||
if (size != sub_size || have != old_have || priority != old_priority || enabled != old_enabled || prog != old_prog)
|
||||
{
|
||||
char size_str[64];
|
||||
tr_strlsize(size_str, sub_size, sizeof size_str);
|
||||
tr_strlsize(size_str, sub_size, sizeof(size_str));
|
||||
gtk_tree_store_set(data->store, iter,
|
||||
FC_SIZE, sub_size,
|
||||
FC_SIZE_STR, size_str,
|
||||
|
@ -448,7 +448,7 @@ static void buildTree(GNode* node, gpointer gdata)
|
|||
gboolean const enabled = isLeaf ? !inf->files[child_data->index].dnd : TRUE;
|
||||
char* name_esc = g_markup_escape_text(child_data->name, -1);
|
||||
|
||||
tr_strlsize(size_str, child_data->length, sizeof size_str);
|
||||
tr_strlsize(size_str, child_data->length, sizeof(size_str));
|
||||
|
||||
gtk_tree_store_insert_with_values(build->store, &child_iter, build->iter, INT_MAX,
|
||||
FC_INDEX, child_data->index,
|
||||
|
|
|
@ -330,12 +330,12 @@ int tr_lpdInit(tr_session* ss, tr_address* tr_addr UNUSED)
|
|||
goto fail;
|
||||
}
|
||||
|
||||
if (setsockopt(lpd_socket, SOL_SOCKET, SO_REUSEADDR, (void const*)&opt_on, sizeof opt_on) == -1)
|
||||
if (setsockopt(lpd_socket, SOL_SOCKET, SO_REUSEADDR, (void const*)&opt_on, sizeof(opt_on)) == -1)
|
||||
{
|
||||
goto fail;
|
||||
}
|
||||
|
||||
memset(&lpd_mcastAddr, 0, sizeof lpd_mcastAddr);
|
||||
memset(&lpd_mcastAddr, 0, sizeof(lpd_mcastAddr));
|
||||
lpd_mcastAddr.sin_family = AF_INET;
|
||||
lpd_mcastAddr.sin_port = htons(lpd_mcastPort);
|
||||
|
||||
|
@ -344,22 +344,22 @@ int tr_lpdInit(tr_session* ss, tr_address* tr_addr UNUSED)
|
|||
goto fail;
|
||||
}
|
||||
|
||||
if (bind(lpd_socket, (struct sockaddr*)&lpd_mcastAddr, sizeof lpd_mcastAddr) == -1)
|
||||
if (bind(lpd_socket, (struct sockaddr*)&lpd_mcastAddr, sizeof(lpd_mcastAddr)) == -1)
|
||||
{
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* we want to join that LPD multicast group */
|
||||
memset(&mcastReq, 0, sizeof mcastReq);
|
||||
memset(&mcastReq, 0, sizeof(mcastReq));
|
||||
mcastReq.imr_multiaddr = lpd_mcastAddr.sin_addr;
|
||||
mcastReq.imr_interface.s_addr = htonl(INADDR_ANY);
|
||||
|
||||
if (setsockopt(lpd_socket, IPPROTO_IP, IP_ADD_MEMBERSHIP, (void const*)&mcastReq, sizeof mcastReq) == -1)
|
||||
if (setsockopt(lpd_socket, IPPROTO_IP, IP_ADD_MEMBERSHIP, (void const*)&mcastReq, sizeof(mcastReq)) == -1)
|
||||
{
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (setsockopt(lpd_socket, IPPROTO_IP, IP_MULTICAST_LOOP, (void const*)&opt_off, sizeof opt_off) == -1)
|
||||
if (setsockopt(lpd_socket, IPPROTO_IP, IP_MULTICAST_LOOP, (void const*)&opt_off, sizeof(opt_off)) == -1)
|
||||
{
|
||||
goto fail;
|
||||
}
|
||||
|
@ -382,12 +382,12 @@ int tr_lpdInit(tr_session* ss, tr_address* tr_addr UNUSED)
|
|||
}
|
||||
|
||||
/* configure outbound multicast TTL */
|
||||
if (setsockopt(lpd_socket2, IPPROTO_IP, IP_MULTICAST_TTL, (void const*)&scope, sizeof scope) == -1)
|
||||
if (setsockopt(lpd_socket2, IPPROTO_IP, IP_MULTICAST_TTL, (void const*)&scope, sizeof(scope)) == -1)
|
||||
{
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (setsockopt(lpd_socket2, IPPROTO_IP, IP_MULTICAST_LOOP, (void const*)&opt_off, sizeof opt_off) == -1)
|
||||
if (setsockopt(lpd_socket2, IPPROTO_IP, IP_MULTICAST_LOOP, (void const*)&opt_off, sizeof(opt_off)) == -1)
|
||||
{
|
||||
goto fail;
|
||||
}
|
||||
|
@ -515,7 +515,7 @@ bool tr_lpdSendAnnounce(tr_torrent const* t)
|
|||
|
||||
/* destination address info has already been set up in tr_lpdInit(),
|
||||
* so we refrain from preparing another sockaddr_in here */
|
||||
int res = sendto(lpd_socket2, (void const*)query, len, 0, (struct sockaddr const*)&lpd_mcastAddr, sizeof lpd_mcastAddr);
|
||||
int res = sendto(lpd_socket2, (void const*)query, len, 0, (struct sockaddr const*)&lpd_mcastAddr, sizeof(lpd_mcastAddr));
|
||||
|
||||
if (res != len)
|
||||
{
|
||||
|
|
|
@ -288,9 +288,9 @@ static int test_memmem(void)
|
|||
char const haystack[12] = "abcabcabcabc";
|
||||
char const needle[3] = "cab";
|
||||
|
||||
check(tr_memmem(haystack, sizeof haystack, haystack, sizeof haystack) == haystack);
|
||||
check(tr_memmem(haystack, sizeof haystack, needle, sizeof needle) == haystack + 2);
|
||||
check(tr_memmem(needle, sizeof needle, haystack, sizeof haystack) == NULL);
|
||||
check(tr_memmem(haystack, sizeof(haystack), haystack, sizeof(haystack)) == haystack);
|
||||
check(tr_memmem(haystack, sizeof(haystack), needle, sizeof(needle)) == haystack + 2);
|
||||
check(tr_memmem(needle, sizeof(needle), haystack, sizeof(haystack)) == NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -487,7 +487,7 @@ static void task_request_next_chunk(struct tr_webseed_task* t)
|
|||
urls[file_index] = evbuffer_free_to_str(make_url(t->webseed, file), NULL);
|
||||
}
|
||||
|
||||
tr_snprintf(range, sizeof range, "%" PRIu64 "-%" PRIu64, file_offset, file_offset + this_pass - 1);
|
||||
tr_snprintf(range, sizeof(range), "%" PRIu64 "-%" PRIu64, file_offset, file_offset + this_pass - 1);
|
||||
|
||||
t->web_task = tr_webRunWebseed(tor, urls[file_index], range, web_response_func, t, t->content);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue