silence a small handful of minor gcc compiler warnings in libtransmission

This commit is contained in:
Jordan Lee 2013-08-17 16:31:03 +00:00
parent d89e859535
commit ba688e2811
4 changed files with 31 additions and 22 deletions

View File

@ -93,9 +93,8 @@ create_file_with_contents (const char * path, const char * str)
dir = tr_dirname (path);
errno = 0;
rv = tr_mkdirp (dir, 0700);
tr_mkdirp (dir, 0700);
assert (errno == 0);
assert (rv == 0);
tr_free (dir);
tr_remove (path);

View File

@ -1587,17 +1587,17 @@ addTorrentImpl (struct tr_rpc_idle_data * data, tr_ctor * ctor)
key = TR_KEY_torrent_added;
result = NULL;
}
else if (err == TR_PARSE_ERR)
{
key = 0;
result = "invalid or corrupt torrent file";
}
else if (err == TR_PARSE_DUPLICATE)
{
tor = tr_torrentFindFromId (data->session, duplicate_id);
key = TR_KEY_torrent_duplicate;
result = "duplicate torrent";
}
else /* err == TR_PARSE_ERR */
{
key = 0;
result = "invalid or corrupt torrent file";
}
if (tor && key)
{

View File

@ -305,25 +305,35 @@ void
tr_runInEventThread (tr_session * session,
void func (void*), void * user_data)
{
assert (tr_isSession (session));
assert (session->events != NULL);
assert (tr_isSession (session));
assert (session->events != NULL);
if (tr_amInThread (session->events->thread))
if (tr_amInThread (session->events->thread))
{
(func)(user_data);
}
else
else
{
const char ch = 'r';
int fd = session->events->fds[1];
tr_lock * lock = session->events->lock;
struct tr_run_data data;
int fd;
char ch;
ssize_t res_1;
ssize_t res_2;
tr_event_handle * e = session->events;
struct tr_run_data data;
tr_lockLock (lock);
pipewrite (fd, &ch, 1);
data.func = func;
data.user_data = user_data;
pipewrite (fd, &data, sizeof (data));
tr_lockUnlock (lock);
tr_lockLock (e->lock);
fd = e->fds[1];
ch = 'r';
res_1 = pipewrite (fd, &ch, 1);
data.func = func;
data.user_data = user_data;
res_2 = pipewrite (fd, &data, sizeof (data));
tr_lockUnlock (e->lock);
if ((res_1 == -1) || (res_2 == -1))
tr_logAddError ("Unable to write to libtransmisison event queue: %s", tr_strerror(errno));
}
}

View File

@ -1283,7 +1283,7 @@ tr_variantFromBuf (tr_variant * setme,
err = tr_jsonParse (optional_source, buf, buflen, setme, setme_end);
break;
case TR_VARIANT_FMT_BENC:
default /* TR_VARIANT_FMT_BENC */:
err = tr_variantParseBenc (buf, ((const char*)buf)+buflen, setme, setme_end);
break;
}