fix coverity issues
This commit is contained in:
parent
42120014d0
commit
8aa3c22796
|
@ -902,14 +902,10 @@ int save_file(std::string const& filename, std::vector<char>& v)
|
|||
return -1;
|
||||
|
||||
int w = fwrite(&v[0], 1, v.size(), f);
|
||||
if (w < 0)
|
||||
{
|
||||
fclose(f);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (w != int(v.size())) return -3;
|
||||
fclose(f);
|
||||
|
||||
if (w < 0) return -1;
|
||||
if (w != int(v.size())) return -3;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1416,7 +1416,7 @@ namespace libtorrent {
|
|||
};
|
||||
|
||||
int op = operation;
|
||||
if (op < 0 || op > int(sizeof(operation_names)/sizeof(operation_names[0])))
|
||||
if (op < 0 || op >= int(sizeof(operation_names)/sizeof(operation_names[0])))
|
||||
op = 0;
|
||||
|
||||
char msg[600];
|
||||
|
|
|
@ -202,6 +202,7 @@ const char* const job_action_name[] =
|
|||
"load_torrent",
|
||||
"clear_piece",
|
||||
"tick_storage",
|
||||
"resolve_links"
|
||||
};
|
||||
|
||||
#if TORRENT_USE_ASSERTS
|
||||
|
@ -341,7 +342,11 @@ block_cache::block_cache(int block_size, io_service& ios
|
|||
, m_write_cache_size(0)
|
||||
, m_send_buffer_blocks(0)
|
||||
, m_pinned_blocks(0)
|
||||
{}
|
||||
{
|
||||
// make sure the job names array covers all the job IDs
|
||||
TORRENT_ASSERT(sizeof(job_action_name)/sizeof(job_action_name[0])
|
||||
== disk_io_job::num_job_ids);
|
||||
}
|
||||
|
||||
// returns:
|
||||
// -1: not in cache
|
||||
|
|
Loading…
Reference in New Issue