Skip to content

Commit

Permalink
Make the compiler shut up
Browse files Browse the repository at this point in the history
  • Loading branch information
untergasser committed Aug 6, 2024
1 parent 027eb29 commit d2ba6db
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 25 deletions.
16 changes: 8 additions & 8 deletions src/format_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ print_seq(FILE *f,
i < h->start + h->length + sa->incl_s)
notes[i] |= INTL_OLIGO;
} else if (pa->primer_task == pick_sequencing_primers) {
if (pa->pick_right_primer && (&retval->rev) != NULL
if (pa->pick_right_primer && retval != NULL
&& retval->rev.num_elem > 0){
h2 = retval->rev.oligo;
for (j = 0; j < pa->num_return; j++) {
Expand All @@ -426,7 +426,7 @@ print_seq(FILE *f,
notes[i] |= RIGHT_OLIGO;
}
}
if (pa->pick_left_primer && (&retval->fwd) != NULL
if (pa->pick_left_primer && retval != NULL
&& retval->fwd.num_elem > 0){
h2 = retval->fwd.oligo;
for (j = 0; j < pa->num_return; j++) {
Expand Down Expand Up @@ -848,21 +848,21 @@ format_oligos(FILE *f,
print_oligo_header(f, "OLIGO", print_lib_sim, pa->thermodynamic_oligo_alignment);
}
/* Print out the first line with the best primers */
if ((pa->pick_left_primer) && ((&retval->fwd) != NULL )
if ((pa->pick_left_primer) && (retval != NULL )
&& (retval->fwd.num_elem > 0)){
print_oligo(f, "LEFT_PRIMER", sa, retval->fwd.oligo, FORWARD,
pa, pa->p_args.repeat_lib, print_lib_sim);
h = retval->fwd.oligo;
rest_count = 1;
}
if ((pa->pick_internal_oligo) && ((&retval->intl) != NULL )
if ((pa->pick_internal_oligo) && (retval != NULL )
&& (retval->intl.num_elem > 0)){
print_oligo(f, "INTERNAL_OLIGO", sa, retval->intl.oligo, FORWARD,
pa, pa->p_args.repeat_lib, print_lib_sim);
h = retval->intl.oligo;
rest_count = 1;
}
if ((pa->pick_right_primer) && ((&retval->rev) != NULL )
if ((pa->pick_right_primer) && (retval != NULL )
&& (retval->rev.num_elem > 0)) {
print_oligo(f, "RIGHT_PRIMER", sa, retval->rev.oligo, REVERSE,
pa, pa->p_args.repeat_lib, print_lib_sim);
Expand All @@ -885,7 +885,7 @@ format_oligos(FILE *f,
}
fprintf(f, "\n");
/* Print out the other primers */
if ((pa->pick_left_primer) && ((&retval->fwd) != NULL )
if ((pa->pick_left_primer) && (retval != NULL )
&& (retval->fwd.num_elem > rest_count)){
int n = retval->fwd.num_elem;
h = retval->fwd.oligo;
Expand All @@ -904,7 +904,7 @@ format_oligos(FILE *f,
fprintf(f, "\n ");
}
}
if ((pa->pick_internal_oligo) && ((&retval->intl) != NULL )
if ((pa->pick_internal_oligo) && (retval != NULL )
&& (retval->intl.num_elem > rest_count)){
int n = retval->intl.num_elem;
h = retval->intl.oligo;
Expand All @@ -923,7 +923,7 @@ format_oligos(FILE *f,
fprintf(f, "\n ");
}
}
if ((pa->pick_right_primer) && ((&retval->rev) != NULL )
if ((pa->pick_right_primer) && (retval != NULL )
&& (retval->rev.num_elem > rest_count)) {
int n = retval->rev.num_elem;
h = retval->rev.oligo;
Expand Down
24 changes: 12 additions & 12 deletions src/libprimer3.cc
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ static int primer_rec_comp(const void *, const void *);
static int print_list_header(FILE *, oligo_type, int, int, int);
static int print_oligo(FILE *, const seq_args *, int, const primer_rec *,
oligo_type, int, int,int);
static char *strstr_nocase(char *, char *);
static int strstr_nocase(char *, char *);

static double p_obj_fn(const p3_global_settings *, primer_rec *, int );

Expand Down Expand Up @@ -2704,11 +2704,11 @@ pick_only_best_primer(const int start,
pr_append_new_chunk(&retval->warnings, "No left primer found in range ");
}
temp_value = start + pa->first_base_index;
sprintf(p_number, "%d", temp_value);
snprintf(p_number, 20, "%d", temp_value);
pr_append(&retval->warnings, p_number);
pr_append(&retval->warnings, " - ");
temp_value = start + length + pa->first_base_index;
sprintf(p_number, "%d", temp_value);
snprintf(p_number, 20, "%d", temp_value);
pr_append(&retval->warnings, p_number);
}
if (oligo->num_elem == 0) return 1;
Expand Down Expand Up @@ -6145,14 +6145,14 @@ dna_to_upper(char * s, int ambiguity_code_ok)
return unrecognized_base;
}

static char *
static int
strstr_nocase(char *s1, char *s2) {
int n1, n2;
char *p, q, *tmp;

if(s1 == NULL || s2 == NULL) return NULL;
if(s1 == NULL || s2 == NULL) return 0;
n1 = strlen(s1); n2 = strlen(s2);
if(n1 < n2) return NULL;
if(n1 < n2) return 0;

tmp = (char *) pr_safe_malloc(n1 + 1);
strcpy(tmp, s1);
Expand All @@ -6164,13 +6164,13 @@ strstr_nocase(char *s1, char *s2) {
if(strcmp_nocase(p, s2)){
*(p + n2) = q; p++; continue;
}
else {free(tmp); return p;}
else {free(tmp); return 1;}
}
free(tmp); return NULL;
free(tmp); return 0;
}

#define CHECK if (r > bsize || r < 0) return "Internal error, not enough space for \"explain\" string"; bufp += r; bsize -= r
#define SP_AND_CHECK(FMT, VAL) { r = sprintf(bufp, FMT, VAL); CHECK; }
#define SP_AND_CHECK(FMT, VAL) { r = snprintf(bufp, bsize, FMT, VAL); CHECK; }
#define IF_SP_AND_CHECK(FMT, VAL) { if (VAL) { SP_AND_CHECK(FMT, VAL) } }
const char *
p3_pair_explain_string(const pair_stats *pair_expl)
Expand Down Expand Up @@ -7590,13 +7590,13 @@ _check_and_adjust_overlap_pos(seq_args *sa,
list[i] -= first_index;

if (list[i] >= seq_len) {
sprintf(buffer, "%s beyond end of sequence", tag);
snprintf(buffer, 255, "%s beyond end of sequence", tag);
pr_append_new_chunk(nonfatal_err, buffer);
return 1;
}

if (list[i] < 0) {
sprintf(buffer, "Negative %s length", tag);
snprintf(buffer, 255, "Negative %s length", tag);
pr_append_new_chunk(nonfatal_err, buffer);
return 1;
}
Expand All @@ -7608,7 +7608,7 @@ _check_and_adjust_overlap_pos(seq_args *sa,
if (list[i] < 0
|| list[i] > sa->incl_l) {
if (!outside_warning_issued) {
sprintf(buffer, "%s outside of INCLUDED_REGION", tag);
snprintf(buffer, 255, "%s outside of INCLUDED_REGION", tag);
pr_append_new_chunk(warning, buffer);
outside_warning_issued = 1;
}
Expand Down
2 changes: 1 addition & 1 deletion src/masker.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ create_formula_parameters_from_list_file_prefix (const char *list_name_prefix, c
{
char list_file_name[300];
formula_parameters *fp;
sprintf(list_file_name, "%s%s_%u.list", kmer_lists_path, list_name_prefix, word_length);
snprintf(list_file_name, 300, "%s%s_%u.list", kmer_lists_path, list_name_prefix, word_length);
if(0 != access(list_file_name,0)){
pr_append_new_chunk_external (parse_err, "Cannot find list file");
return NULL;
Expand Down
2 changes: 1 addition & 1 deletion src/print_boulder.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ print_boulder(int io_version,
}

/* Get the number for pimer counting in suffix[0] */
sprintf(suffix, "_%d", i);
snprintf(suffix, 100, "_%d", i);

/* Print out the Pair Penalties */
if (retval->output_type == primer_pairs) {
Expand Down
6 changes: 3 additions & 3 deletions src/thal.c
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ drawDimer(int* ps1, int* ps2, double H, double S, const thal_mode mode, double t
printf("Calculated thermodynamical parameters for dimer:\tdS = %g\tdH = %g\tdG = %g\tt = %g\n",
(double) S, (double) H, (double) G, (double) t);
} else {
sprintf(ret_para, "Tm: %.1f&deg;C dG: %.0f cal/mol dH: %.0f cal/mol dS: %.0f cal/mol*K\\n",
snprintf(ret_para, 400, "Tm: %.1f&deg;C dG: %.0f cal/mol dH: %.0f cal/mol dS: %.0f cal/mol*K\\n",
(double) t, (double) G, (double) H, (double) S);
}
} else {
Expand Down Expand Up @@ -1823,7 +1823,7 @@ drawHairpin(int* bp, double mh, double ms, const thal_mode mode, double temp, co
printf("Calculated thermodynamical parameters for dimer:\t%d\tdS = %g\tdH = %g\tdG = %g\tt = %g\n",
oligo1_len, (double) ms, (double) mh, (double) mg, (double) t);
} else {
sprintf(ret_para, "Tm: %.1f&deg;C dG: %.0f cal/mol dH: %.0f cal/mol dS: %.0f cal/mol*K\\n",
snprintf(ret_para, 400, "Tm: %.1f&deg;C dG: %.0f cal/mol dH: %.0f cal/mol dS: %.0f cal/mol*K\\n",
(double) t, (double) mg, (double) mh, (double) ms);
}
} else {
Expand Down Expand Up @@ -2494,7 +2494,7 @@ readParamFile(const char* dirname, const char* fname, jmp_buf _jmp_buf, thal_res
#endif
strcat(paramdir, fname);
if (!(file = fopen(paramdir, "r"))) {
sprintf(o->msg, "Unable to open file %s", paramdir);
snprintf(o->msg, 255, "Unable to open file %s", paramdir);
if (paramdir != NULL) {
free(paramdir);
paramdir = NULL;
Expand Down

0 comments on commit d2ba6db

Please sign in to comment.