From 95a4b1b1587f33692830153d6d03081b5e51d172 Mon Sep 17 00:00:00 2001 From: Alexander Barton Date: Mon, 25 Mar 2002 19:11:01 +0000 Subject: [PATCH] - einige Anpassungen nach Code-Check mit SPLint ;-) --- src/ngircd/channel.h | 4 ++-- src/ngircd/client.c | 32 ++++++++++++++++---------------- src/ngircd/client.h | 4 ++-- src/ngircd/conf.c | 6 +++--- src/ngircd/hash.c | 4 ++-- src/ngircd/log.c | 6 +++--- src/ngircd/ngircd.c | 15 ++++++++------- 7 files changed, 36 insertions(+), 35 deletions(-) diff --git a/src/ngircd/channel.h b/src/ngircd/channel.h index e9d16a56..6728e5a6 100644 --- a/src/ngircd/channel.h +++ b/src/ngircd/channel.h @@ -9,7 +9,7 @@ * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste * der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS. * - * $Id: channel.h,v 1.15 2002/03/25 16:55:14 alex Exp $ + * $Id: channel.h,v 1.16 2002/03/25 19:11:01 alex Exp $ * * channel.h: Management der Channels (Header) */ @@ -21,7 +21,7 @@ #include "client.h" -#ifdef __channel_c__ +#if defined(__channel_c__) | defined(S_SPLINT_S) #include "defines.h" diff --git a/src/ngircd/client.c b/src/ngircd/client.c index b4c8dd5e..1d08f476 100644 --- a/src/ngircd/client.c +++ b/src/ngircd/client.c @@ -9,7 +9,7 @@ * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste * der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS. * - * $Id: client.c,v 1.51 2002/03/25 16:59:36 alex Exp $ + * $Id: client.c,v 1.52 2002/03/25 19:11:01 alex Exp $ * * client.c: Management aller Clients * @@ -105,7 +105,7 @@ GLOBAL VOID Client_Exit( VOID ) while( c ) { cnt++; - next = c->next; + next = (CLIENT *)c->next; free( c ); c = next; } @@ -169,7 +169,7 @@ GLOBAL CLIENT *Client_New( CONN_ID Idx, CLIENT *Introducer, CLIENT *TopServer, I if( strchr( client->modes, 'a' )) strcpy( client->away, DEFAULT_AWAY_MSG ); /* Verketten */ - client->next = My_Clients; + client->next = (POINTER *)My_Clients; My_Clients = client; return client; @@ -209,7 +209,7 @@ GLOBAL VOID Client_Destroy( CLIENT *Client, CHAR *LogMsg, CHAR *FwdMsg, BOOLEAN { /* Wir haben den Client gefunden: entfernen */ if( last ) last->next = c->next; - else My_Clients = c->next; + else My_Clients = (CLIENT *)c->next; if( c->type == CLIENT_USER ) { @@ -274,7 +274,7 @@ GLOBAL VOID Client_Destroy( CLIENT *Client, CHAR *LogMsg, CHAR *FwdMsg, BOOLEAN break; } last = c; - c = c->next; + c = (CLIENT *)c->next; } } /* Client_Destroy */ @@ -478,7 +478,7 @@ GLOBAL CLIENT *Client_GetFromConn( CONN_ID Idx ) while( c ) { if( c->conn_id == Idx ) return c; - c = c->next; + c = (CLIENT *)c->next; } return NULL; } /* Client_GetFromConn */ @@ -511,7 +511,7 @@ GLOBAL CLIENT *Client_Search( CHAR *Nick ) /* lt. Hash-Wert: Treffer! */ if( strcasecmp( c->id, search_id ) == 0 ) return c; } - c = c->next; + c = (CLIENT *)c->next; } return NULL; } /* Client_Search */ @@ -532,7 +532,7 @@ GLOBAL CLIENT *Client_GetFromToken( CLIENT *Client, INT Token ) while( c ) { if(( c->type == CLIENT_SERVER ) && ( c->introducer == Client ) && ( c->token == Token )) return c; - c = c->next; + c = (CLIENT *)c->next; } return NULL; } /* Client_GetFromToken */ @@ -575,7 +575,7 @@ GLOBAL CHAR *Client_Info( CLIENT *Client ) GLOBAL CHAR *Client_User( CLIENT *Client ) { assert( Client != NULL ); - if( Client->user ) return Client->user; + if( Client->user[0] ) return Client->user; else return "~"; } /* Client_User */ @@ -741,7 +741,7 @@ GLOBAL BOOLEAN Client_CheckID( CLIENT *Client, CHAR *ID ) Conn_Close( Client->conn_id, str, str, TRUE ); return FALSE; } - c = c->next; + c = (CLIENT *)c->next; } return TRUE; @@ -762,7 +762,7 @@ GLOBAL CLIENT *Client_Next( CLIENT *c ) * so wird NULL geliefert. */ assert( c != NULL ); - return c->next; + return (CLIENT *)c->next; } /* Client_Next */ @@ -812,7 +812,7 @@ GLOBAL INT Client_OperCount( VOID ) while( c ) { if( c && ( c->type == CLIENT_USER ) && ( strchr( c->modes, 'o' ))) cnt++; - c = c->next; + c = (CLIENT *)c->next; } return cnt; } /* Client_OperCount */ @@ -828,7 +828,7 @@ GLOBAL INT Client_UnknownCount( VOID ) while( c ) { if( c && ( c->type != CLIENT_USER ) && ( c->type != CLIENT_SERVICE ) && ( c->type != CLIENT_SERVER )) cnt++; - c = c->next; + c = (CLIENT *)c->next; } return cnt; } /* Client_UnknownCount */ @@ -868,7 +868,7 @@ LOCAL INT Count( CLIENT_TYPE Type ) while( c ) { if( c && ( c->type == Type )) cnt++; - c = c->next; + c = (CLIENT *)c->next; } return cnt; } /* Count */ @@ -884,7 +884,7 @@ LOCAL INT MyCount( CLIENT_TYPE Type ) while( c ) { if( c && ( c->introducer == This_Server ) && ( c->type == Type )) cnt++; - c = c->next; + c = (CLIENT *)c->next; } return cnt; } /* MyCount */ @@ -941,7 +941,7 @@ LOCAL VOID Generate_MyToken( CLIENT *Client ) c = My_Clients; continue; } - else c = c->next; + else c = (CLIENT *)c->next; } Client->mytoken = token; Log( LOG_DEBUG, "Assigned token %d to server \"%s\".", token, Client->id ); diff --git a/src/ngircd/client.h b/src/ngircd/client.h index d377d828..853ac313 100644 --- a/src/ngircd/client.h +++ b/src/ngircd/client.h @@ -9,7 +9,7 @@ * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste * der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS. * - * $Id: client.h,v 1.26 2002/03/25 17:01:07 alex Exp $ + * $Id: client.h,v 1.27 2002/03/25 19:11:01 alex Exp $ * * client.h: Konfiguration des ngircd (Header) */ @@ -35,7 +35,7 @@ typedef enum } CLIENT_TYPE; -#ifdef __client_c__ +#if defined(__client_c__) | defined(S_SPLINT_S) #include "defines.h" diff --git a/src/ngircd/conf.c b/src/ngircd/conf.c index df93b28b..9db611a1 100644 --- a/src/ngircd/conf.c +++ b/src/ngircd/conf.c @@ -9,7 +9,7 @@ * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste * der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS. * - * $Id: conf.c,v 1.19 2002/03/25 16:14:15 alex Exp $ + * $Id: conf.c,v 1.20 2002/03/25 19:11:01 alex Exp $ * * conf.h: Konfiguration des ngircd */ @@ -170,7 +170,7 @@ LOCAL VOID Read_Config( VOID ) GLOBAL VOID Handle_GLOBAL( INT Line, CHAR *Var, CHAR *Arg ) { CHAR *ptr; - INT port; + INT32 port; assert( Line > 0 ); assert( Var != NULL ); @@ -209,7 +209,7 @@ GLOBAL VOID Handle_GLOBAL( INT Line, CHAR *Var, CHAR *Arg ) if( Conf_ListenPorts_Count + 1 > MAX_LISTEN_PORTS ) Log( LOG_ERR, "Too many listen ports configured. Port %ld ignored.", port ); else { - if( port > 0 && port < 0xFFFF ) Conf_ListenPorts[Conf_ListenPorts_Count++] = port; + if( port > 0 && port < 0xFFFF ) Conf_ListenPorts[Conf_ListenPorts_Count++] = (INT)port; else Log( LOG_ERR, "%s, line %d (section \"Global\"): Illegal port number %ld!", Conf_File, Line, port ); } ptr = strtok( NULL, "," ); diff --git a/src/ngircd/hash.c b/src/ngircd/hash.c index a2801b06..876b92f5 100644 --- a/src/ngircd/hash.c +++ b/src/ngircd/hash.c @@ -9,7 +9,7 @@ * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste * der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS. * - * $Id: hash.c,v 1.3 2002/03/22 00:21:51 alex Exp $ + * $Id: hash.c,v 1.4 2002/03/25 19:11:01 alex Exp $ * * hash.c: Hash-Werte berechnen */ @@ -41,7 +41,7 @@ GLOBAL UINT32 Hash( CHAR *String ) strncpy( buffer, String, LINE_LEN - 1 ); buffer[LINE_LEN - 1] = '\0'; - return jenkins_hash( ngt_LowerStr( buffer ), strlen( buffer ), 42 ); + return jenkins_hash( (UINT8 *)ngt_LowerStr( buffer ), strlen( buffer ), 42 ); } /* Hash */ diff --git a/src/ngircd/log.c b/src/ngircd/log.c index 452c045e..b10f3c4f 100644 --- a/src/ngircd/log.c +++ b/src/ngircd/log.c @@ -9,7 +9,7 @@ * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste * der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS. * - * $Id: log.c,v 1.22 2002/03/21 12:00:23 alex Exp $ + * $Id: log.c,v 1.23 2002/03/25 19:11:01 alex Exp $ * * log.c: Logging-Funktionen */ @@ -85,7 +85,7 @@ GLOBAL VOID Log_Init( VOID ) if( ! freopen( ERROR_FILE, "a+", stderr )) Log( LOG_ERR, "Can't reopen stderr (\""ERROR_FILE"\"): %s", strerror( errno )); fprintf( stderr, "\n--- %s ---\n\n", NGIRCd_StartStr ); - fprintf( stderr, "%s started.\npid=%d, ppid=%d, uid=%d, gid=%d [euid=%d, egid=%d].\nActivating: %s\n\n", NGIRCd_Version( ), getpid( ), getppid( ), getuid( ), getgid( ), geteuid( ), getegid( ), txt[0] ? txt : "-" ); + fprintf( stderr, "%s started.\npid=%ld, ppid=%ld, uid=%ld, gid=%ld [euid=%ld, egid=%ld].\nActivating: %s\n\n", NGIRCd_Version( ), (INT32)getpid( ), (INT32)getppid( ), (INT32)getuid( ), (INT32)getgid( ), (INT32)geteuid( ), (INT32)getegid( ), txt[0] ? txt : "-" ); fflush( stderr ); } /* Log_Init */ @@ -99,7 +99,7 @@ GLOBAL VOID Log_Exit( VOID ) t = time( NULL ); fputs( ctime( &t ), stderr ); - fprintf( stderr, PACKAGE" done (pid=%d).\n", getpid( )); + fprintf( stderr, PACKAGE" done (pid=%ld).\n", (INT32)getpid( )); fflush( stderr ); #ifdef USE_SYSLOG diff --git a/src/ngircd/ngircd.c b/src/ngircd/ngircd.c index 120589a8..ceadd328 100644 --- a/src/ngircd/ngircd.c +++ b/src/ngircd/ngircd.c @@ -9,7 +9,7 @@ * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste * der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS. * - * $Id: ngircd.c,v 1.34 2002/03/12 22:08:24 alex Exp $ + * $Id: ngircd.c,v 1.35 2002/03/25 19:11:01 alex Exp $ * * ngircd.c: Hier beginnt alles ;-) */ @@ -50,10 +50,11 @@ LOCAL VOID Show_Version( VOID ); LOCAL VOID Show_Help( VOID ); -GLOBAL INT main( INT argc, CONST CHAR *argv[] ) +GLOBAL int main( int argc, const char *argv[] ) { BOOLEAN ok; - INT pid, i, n; + INT32 pid, n; + INT i; NGIRCd_Restart = FALSE; NGIRCd_Quit = FALSE; @@ -114,7 +115,7 @@ GLOBAL INT main( INT argc, CONST CHAR *argv[] ) { /* Kurze Option */ - for( n = 1; n < strlen( argv[i] ); n++ ) + for( n = 1; n < (INT32)strlen( argv[i] ); n++ ) { ok = FALSE; #ifdef DEBUG @@ -177,7 +178,7 @@ GLOBAL INT main( INT argc, CONST CHAR *argv[] ) if( ! NGIRCd_NoDaemon ) { /* Daemon im Hintergrund erzeugen */ - pid = fork( ); + pid = (INT32)fork( ); if( pid > 0 ) { /* "alter" Prozess */ @@ -191,13 +192,13 @@ GLOBAL INT main( INT argc, CONST CHAR *argv[] ) } /* Child-Prozess initialisieren */ - setsid( ); + (VOID)setsid( ); chdir( "/" ); } /* Globale Variablen initialisieren */ NGIRCd_Start = time( NULL ); - strftime( NGIRCd_StartStr, 64, "%a %b %d %Y at %H:%M:%S (%Z)", localtime( &NGIRCd_Start )); + (VOID)strftime( NGIRCd_StartStr, 64, "%a %b %d %Y at %H:%M:%S (%Z)", localtime( &NGIRCd_Start )); NGIRCd_Restart = FALSE; NGIRCd_Quit = FALSE; -- 2.39.2