Skip to content

Commit

Permalink
readability-implicit-bool-conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
frederic-mahe committed Jan 26, 2025
1 parent 4bfc87c commit 3034e0b
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/db.cc
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ auto db_read(const char * filename, int upcase) -> void
{
h = fastx_open(filename);

if (not h)
if (h == nullptr)
{
fatal("Unrecognized file type (not proper FASTA or FASTQ format)");
}
Expand Down Expand Up @@ -240,8 +240,8 @@ auto db_read(const char * filename, int upcase) -> void
seqindex = nullptr;

while (fastx_next(h,
not opt_notrunclabels,
upcase ? chrmap_upcase : chrmap_no_change))
opt_notrunclabels == 0,
(upcase != 0) ? chrmap_upcase : chrmap_no_change))
{
size_t const sequencelength = fastx_get_sequence_length(h);
int64_t const abundance = fastx_get_abundance(h);
Expand All @@ -254,7 +254,7 @@ auto db_read(const char * filename, int upcase) -> void
{
++discarded_long;
}
else if (opt_cluster_unoise && (abundance < opt_minsize))
else if ((opt_cluster_unoise != nullptr) && (abundance < opt_minsize))
{
++discarded_unoise;
}
Expand Down Expand Up @@ -297,7 +297,7 @@ auto db_read(const char * filename, int upcase) -> void
}
}

if (opt_log)
if (opt_log != nullptr)
{
if (sequences > 0)
{
Expand All @@ -321,15 +321,15 @@ auto db_read(const char * filename, int upcase) -> void

/* Warn about discarded sequences */

if (discarded_short)
if (discarded_short != 0)
{
fprintf(stderr,
"minseqlength %" PRId64 ": %" PRId64 " %s discarded.\n",
opt_minseqlength,
discarded_short,
(discarded_short == 1 ? "sequence" : "sequences"));

if (opt_log)
if (opt_log != nullptr)
{
fprintf(fp_log,
"minseqlength %" PRId64 ": %" PRId64 " %s discarded.\n\n",
Expand All @@ -339,15 +339,15 @@ auto db_read(const char * filename, int upcase) -> void
}
}

if (discarded_long)
if (discarded_long != 0)
{
fprintf(stderr,
"maxseqlength %" PRId64 ": %" PRId64 " %s discarded.\n",
opt_maxseqlength,
discarded_long,
(discarded_long == 1 ? "sequence" : "sequences"));

if (opt_log)
if (opt_log != nullptr)
{
fprintf(fp_log,
"maxseqlength %" PRId64 ": %" PRId64 " %s discarded.\n\n",
Expand All @@ -357,15 +357,15 @@ auto db_read(const char * filename, int upcase) -> void
}
}

if (discarded_unoise)
if (discarded_unoise != 0)
{
fprintf(stderr,
"minsize %" PRId64 ": %" PRId64 " %s discarded.\n",
opt_minsize,
discarded_unoise,
(discarded_unoise == 1 ? "sequence" : "sequences"));

if (opt_log)
if (opt_log != nullptr)
{
fprintf(fp_log,
"minsize %" PRId64 ": %" PRId64 " %s discarded.\n",
Expand Down Expand Up @@ -411,11 +411,11 @@ auto db_getshortestsequence() -> uint64_t

auto db_free() -> void
{
if (datap)
if (datap != nullptr)
{
xfree(datap);
}
if (seqindex)
if (seqindex != nullptr)
{
xfree(seqindex);
}
Expand Down

0 comments on commit 3034e0b

Please sign in to comment.