aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2025-04-13 20:05:54 +0300
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2025-04-21 20:49:37 +0300
commit278cc757b3146be68376318999415b97220c4d92 (patch)
treede44a0832bad1392f9b5347144a12af5c9039bf1
parent415ef16ae3b6b32652135a219b12a074dff265d9 (diff)
downloadvideoteco-fork-278cc757b3146be68376318999415b97220c4d92.tar.gz
silence some warnings when compiling under FreeBSD (and probably Linux)
Also avoid old-school function declarations without parameters (`void foo();`). This is unnecessarily loosing type safety.
-rw-r--r--tecbuf.c6
-rw-r--r--teccmd.c8
-rw-r--r--tecexec.c2
-rw-r--r--tecmem.c4
-rw-r--r--teco.c10
-rw-r--r--teco.h32
-rw-r--r--tecundo.c2
7 files changed, 32 insertions, 32 deletions
diff --git a/tecbuf.c b/tecbuf.c
index e2e58de..6bfa582 100644
--- a/tecbuf.c
+++ b/tecbuf.c
@@ -1106,7 +1106,7 @@ int max_length;
for(hbp = buffer_headers; hbp != NULL ; hbp = hbp->next_header){
if(hbp->buffer_number <= 0) continue;
i = max_length - strlen(hbp->name);
- sprintf(tmp_buffer,"<Buffer %-4d> %s%s %s %6d bytes\n",
+ snprintf(tmp_buffer,sizeof(tmp_buffer),"<Buffer %-4d> %s%s %s %6d bytes\n",
hbp->buffer_number,hbp->name,&padd_buffer[sizeof(padd_buffer)-1-i],
hbp->ismodified ? "(modified)" : " ",hbp->zee);
i = strlen(tmp_buffer);
@@ -1118,7 +1118,7 @@ int max_length;
for(hbp = buffer_headers; hbp != NULL ; hbp = hbp->next_header){
if(hbp->buffer_number >= 0) continue;
i = max_length - strlen(hbp->name);
- sprintf(tmp_buffer,"<Buffer %-4d> %s%s %s %6d bytes\n",
+ snprintf(tmp_buffer,sizeof(tmp_buffer),"<Buffer %-4d> %s%s %s %6d bytes\n",
hbp->buffer_number,hbp->name,&padd_buffer[sizeof(padd_buffer)-1-i],
hbp->ismodified ? "(modified)" : " ",hbp->zee);
i = strlen(tmp_buffer);
@@ -1327,8 +1327,6 @@ int bytes_inserted_so_far = 0;
#ifdef DEBUG
char outbuf[1024];
-char inbuf[10];
-extern int tty_input_chan;
term_goto(0,0);
term_clrtobot();
term_flush();
diff --git a/teccmd.c b/teccmd.c
index e6618db..bd0ea6c 100644
--- a/teccmd.c
+++ b/teccmd.c
@@ -522,7 +522,7 @@ int new_length;
ut->opcode = UNDO_C_SET_SEARCH_GLOBALS;
ut->iarg1 = last_search_pos1;
ut->iarg2 = last_search_pos2;
- ut->carg1 = (char *)last_search_status;
+ ut->carg1 = (char *)(uintptr_t)last_search_status;
/*
* If the new length is the same as the old length, there is a chance we are
@@ -1223,7 +1223,7 @@ register int status;
errno = EEXIST;
return(FAIL);
}/* End IF */
- sprintf(tmp_message,"?Error opening <%s>: %s",
+ snprintf(tmp_message,sizeof(tmp_message),"?Error opening <%s>: %s",
tmp_filename,error_text(errno));
error_message(tmp_message);
errno = 0;
@@ -1233,7 +1233,7 @@ register int status;
while(1){
i = read(fi,iobuf,IO_BUFFER_SIZE);
if(i < 0){
- sprintf(tmp_message,"?Error reading <%s>: %s",
+ snprintf(tmp_message,sizeof(tmp_message),"?Error reading <%s>: %s",
input_filename,error_text(errno));
error_message(tmp_message);
close(fo);
@@ -1243,7 +1243,7 @@ register int status;
status = write(fo,iobuf,(unsigned)i);
if(status < 0){
- sprintf(tmp_message,"?Error writing <%s>: %s",
+ snprintf(tmp_message,sizeof(tmp_message),"?Error writing <%s>: %s",
tmp_filename,error_text(errno));
error_message(tmp_message);
close(fo);
diff --git a/tecexec.c b/tecexec.c
index d027718..6d0e8e4 100644
--- a/tecexec.c
+++ b/tecexec.c
@@ -1927,7 +1927,7 @@ char tmp_buffer[LINE_BUFFER_SIZE],tmp_message[LINE_BUFFER_SIZE];
char string1[PARSER_STRING_MAX];
extract_label(goto_ptr,string1);
- (void) sprintf(tmp_message,"?Can't find label <%s>",
+ (void) snprintf(tmp_message,sizeof(tmp_message),"?Can't find label <%s>",
string1);
error_message(tmp_message);
return(FAIL);
diff --git a/tecmem.c b/tecmem.c
index 71b595e..f5abd95 100644
--- a/tecmem.c
+++ b/tecmem.c
@@ -78,7 +78,7 @@ char *
tec_alloc( int type, int size )
{
int actual_size;
-register int i,j;
+register int i;
register char *cp;
register struct memblock *mp;
register struct memlist *lp;
@@ -173,7 +173,7 @@ extern char outof_memory;
}/* End IF */
if(lookaside_lists[i] == NULL){
- j = BIG_MALLOC_HUNK_SIZE / actual_size;
+ //j = BIG_MALLOC_HUNK_SIZE / actual_size;
cp = (char *)malloc((unsigned)(BIG_MALLOC_HUNK_SIZE));
if(cp == NULL){
diff --git a/teco.c b/teco.c
index ef78d56..bf5d58b 100644
--- a/teco.c
+++ b/teco.c
@@ -757,11 +757,11 @@ init_signals()
{
#if 0
-int cmd_suspend();
+int cmd_suspend(void);
#endif
-int cmd_interrupt();
-int cmd_alarm();
-int cmd_winch();
+int cmd_interrupt(void);
+int cmd_alarm(void);
+int cmd_winch(void);
PREAMBLE();
@@ -1056,7 +1056,7 @@ register int i,j;
int count;
register char *cp,*dp;
struct wildcard_expansion *name_list,*np;
-struct wildcard_expansion *expand_filename();
+struct wildcard_expansion *expand_filename(char *);
int number_of_buffers_opened = 0;
char switch_buffer[TECO_FILENAME_TOTAL_LENGTH];
char *command_line;
diff --git a/teco.h b/teco.h
index 6fa1e1c..39921fc 100644
--- a/teco.h
+++ b/teco.h
@@ -137,6 +137,9 @@
#define MAGIC_FORMAT_LOOKASIDE 0x06060606
#ifdef DEBUG1
+void do_preamble_checks(void);
+void do_return_checks(void);
+
#define PREAMBLE() \
do_preamble_checks();
@@ -558,6 +561,7 @@ typedef unsigned long teco_ptrint_t;
{ \
int fake_destination; \
fake_destination = *((int *)(0x0FFFFFFF)); \
+ (void)fake_destination; \
}
#endif
@@ -571,7 +575,7 @@ int buff_readfd(struct buff_header *hbp,char *name,int iochan);
int buff_insert(struct buff_header *hbp,int position,char *buffer,int length);
int screen_label_line(struct buff_header *buffer,char *string,int field);
int buff_write(struct buff_header *hbp,int chan,int start,int end);
-void tecmem_stats();
+void tecmem_stats(void);
void screen_free_format_lines(struct format_line *sbp);
int buff_delete_char(struct buff_header *hbp,int position);
int compile_search_string(struct search_buff *search_tbl);
@@ -628,29 +632,27 @@ void screen_scroll(int);
void parser_dump_command_line(struct buff_header *);
int parser_replace_command_line(struct buff_header *);
void tec_gc_lists(void);
-void screen_deallocate_format_lookaside_list();
-void buff_deallocate_line_buffer_lookaside_list();
-int buff_init();
+void screen_deallocate_format_lookaside_list(void);
+void buff_deallocate_line_buffer_lookaside_list(void);
+int buff_init(void);
void tec_error(int, char *);
int handle_command_line(int,int,char **);
-void tecparse();
+void tecparse(void);
//void term_putc(char);
int term_putc(int);
-void term_flush();
-int screen_init();
-void screen_finish();
-int exec_doq0();
+void term_flush(void);
+int screen_init(void);
+void screen_finish(void);
+int exec_doq0(void);
void punt(int);
-void screen_reset_message();
+void screen_reset_message(void);
int tecparse_syntax(int);
void screen_echo(char);
-void cmd_pause();
-void cmd_suspend();
+void cmd_pause(void);
+void cmd_suspend(void);
int term_putnum(char *,int,int);
int term_scroll_region(int,int);
-int init_term_description();
-//int tgetent(char *,char *);
-//int tgetnum(char *);
+int init_term_description(void);
char *tec_alloc(int,int);
void initialize_memory_stats( void );
struct buff_header *buff_qfind(char,char);
diff --git a/tecundo.c b/tecundo.c
index c841ec5..927cea3 100644
--- a/tecundo.c
+++ b/tecundo.c
@@ -311,7 +311,7 @@ register struct cmd_token *ct;
case UNDO_C_SET_SEARCH_GLOBALS:
last_search_pos1 = ut->iarg1;
last_search_pos2 = ut->iarg2;
- last_search_status = (int)ut->carg1;
+ last_search_status = (int)(uintptr_t)ut->carg1;
break;
/*
* This function puts the previous tags file back