mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-02-15 04:32:24 +00:00
dtsr: resolve all 12 compiler warnings.
This commit is contained in:
parent
466b8d0df5
commit
3fab71345b
6 changed files with 34 additions and 14 deletions
|
@ -691,6 +691,8 @@ static void copy_new_d99 (long keyfield)
|
|||
*/
|
||||
done = FALSE;
|
||||
while (!done) { /* loop on each block in this word */
|
||||
int ret = 0;
|
||||
|
||||
if (num_holes > MAX_REC_READ) {
|
||||
num_reads = MAX_REC_READ;
|
||||
num_holes -= MAX_REC_READ;
|
||||
|
@ -700,8 +702,8 @@ static void copy_new_d99 (long keyfield)
|
|||
num_reads = num_holes;
|
||||
}
|
||||
errno = 0;
|
||||
fread (word_addrs, sizeof(DB_ADDR), (size_t)num_reads, fp_d99_old);
|
||||
if (errno) {
|
||||
ret = fread (word_addrs, sizeof(DB_ADDR), (size_t)num_reads, fp_d99_old);
|
||||
if (errno || -1 == ret) {
|
||||
TERMINATE_LINE ();
|
||||
fprintf (aa_stderr, catgets(dtsearch_catd, MS_dtsrclean, 657,
|
||||
"%s Read error on %s: %s.\n"),
|
||||
|
@ -1138,7 +1140,10 @@ int main (int argc, char *argv[])
|
|||
aa_stderr);
|
||||
|
||||
*readbuf = '\0';
|
||||
fgets (readbuf, sizeof(readbuf), stdin);
|
||||
if(NULL == fgets (readbuf, sizeof(readbuf), stdin)) {
|
||||
fprintf (aa_stderr, "Failed to read from stdin\n");
|
||||
end_of_job (2, SHOW_EXITCODE);
|
||||
}
|
||||
if (strlen(readbuf) && readbuf[strlen(readbuf)-1] == '\n')
|
||||
readbuf[strlen(readbuf)-1] = '\0';
|
||||
|
||||
|
|
|
@ -578,9 +578,10 @@ void process_profile ()
|
|||
}
|
||||
/*-- Get next line --*/
|
||||
do {
|
||||
fgets (prof_line, 200, prof);
|
||||
char *ret = NULL;
|
||||
ret = fgets (prof_line, 200, prof);
|
||||
line_num++;
|
||||
if (feof (prof))
|
||||
if (ret == NULL || feof (prof) )
|
||||
break;
|
||||
if (prof_line[0] == '#' || is_blank (prof_line))
|
||||
continue;
|
||||
|
|
|
@ -1089,7 +1089,7 @@ void write_new_word_2_dtbs (void)
|
|||
got_word.or_hwoffset = ftell (dtbs_addr_fp);
|
||||
got_word.or_hwfree = 0;
|
||||
if (debugging & (DEBUG_n | DEBUG_N))
|
||||
printf ("APPEND ofs=%ld, fre=0\n", got_word.or_hwoffset);
|
||||
printf ("APPEND ofs=%ld, fre=0\n", (long int) got_word.or_hwoffset);
|
||||
}
|
||||
else {
|
||||
ret_fseek = fseek (dtbs_addr_fp,
|
||||
|
@ -1099,7 +1099,7 @@ void write_new_word_2_dtbs (void)
|
|||
num_addrs_for_word;
|
||||
if (debugging & (DEBUG_n | DEBUG_N))
|
||||
printf (" REUSE slot ofs=%ld, fre=%ld\n",
|
||||
got_word.or_hwoffset, got_word.or_hwfree);
|
||||
(long int) got_word.or_hwoffset, (long int) got_word.or_hwfree);
|
||||
}
|
||||
|
||||
/***** Write new database addresses to d99 file *********/
|
||||
|
|
|
@ -703,7 +703,7 @@ static void create_object (char *key)
|
|||
UPDATE_MAXDBA (objdba);
|
||||
if (debug_mode)
|
||||
printf ("---> new rec: inrecno %6ld, slot %6ld, key '%s'\n",
|
||||
input_reccount, objdba & 0xffffff, objrec.or_objkey);
|
||||
(long int) input_reccount, (long int) objdba & 0xffffff, objrec.or_objkey);
|
||||
|
||||
/* Make current object record the owner of all its sets */
|
||||
SETOR (PROGNAME "376", OR_OBJ_BLOBS, 0);
|
||||
|
@ -762,7 +762,7 @@ static void update_object (char *key)
|
|||
UPDATE_MAXDBA (objdba);
|
||||
if (debug_mode)
|
||||
printf ("----> update: inrecno %6ld, slot %6ld, key '%s'\n",
|
||||
input_reccount, objdba & 0xffffff, key);
|
||||
(long int) input_reccount, (long int) objdba & 0xffffff, key);
|
||||
|
||||
/* Reinit certain fields.
|
||||
* Objsize will be rewritten after new text size determined.
|
||||
|
|
|
@ -467,7 +467,10 @@ static void init_treebase (void)
|
|||
*/
|
||||
else {
|
||||
no_huffcode_file = FALSE;
|
||||
fgets (filebuf, sizeof (filebuf) - 1, instream_huf);
|
||||
if(NULL == fgets (filebuf, sizeof (filebuf) - 1, instream_huf)) {
|
||||
fprintf (stderr, "No first line in file\n");
|
||||
exit(2);
|
||||
}
|
||||
/* discard this first line (don't need id stamp) */
|
||||
while (fgets (filebuf, sizeof (filebuf) - 1, instream_huf)
|
||||
!= NULL) {
|
||||
|
|
|
@ -89,6 +89,7 @@
|
|||
#include <signal.h>
|
||||
#include <sys/stat.h>
|
||||
#include <locale.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define PRINT_MESSAGES \
|
||||
{ puts (DtSearchGetMessages()); DtSearchFreeMessages(); }
|
||||
|
@ -475,7 +476,10 @@ DISPLAY_RECORD:
|
|||
"\n...push ENTER to continue... ") );
|
||||
|
||||
*userbuf = '\0';
|
||||
fgets (userbuf, sizeof (userbuf), stdin);
|
||||
if(NULL == fgets (userbuf, sizeof (userbuf), stdin)) {
|
||||
fprintf(stderr, "Failed to read from stdin\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if (strlen(userbuf) && userbuf[strlen(userbuf)-1] == '\n')
|
||||
userbuf[strlen(userbuf)-1] = '\0';
|
||||
|
||||
|
@ -504,8 +508,12 @@ DISPLAY_RECORD:
|
|||
"\n...push ENTER to continue... ") );
|
||||
|
||||
*userbuf = '\0';
|
||||
fgets (userbuf, sizeof (userbuf), stdin);
|
||||
if (strlen(userbuf) &&
|
||||
if(NULL == fgets (userbuf, sizeof (userbuf), stdin)) {
|
||||
fprintf(stderr, "Failed to read from stdin 2\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (strlen(userbuf) &&
|
||||
userbuf[strlen(userbuf)-1] == '\n')
|
||||
userbuf[strlen(userbuf)-1] = '\0';
|
||||
|
||||
|
@ -677,7 +685,10 @@ static void deleter (char *infname)
|
|||
"If you are sure you are ready to start deleting, enter 'y' now... ") ,
|
||||
infname, OE_prodname);
|
||||
|
||||
fgets (buf, sizeof(buf)-1, stdin);
|
||||
if(NULL == fgets (buf, sizeof(buf)-1, stdin)) {
|
||||
fprintf(stderr, "no input\n");
|
||||
return;
|
||||
}
|
||||
if (tolower (*buf) != 'y')
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue