Mercurial > noffle
comparison src/protocol.c @ 59:e612b263934f noffle
[svn] Changed some variable types and used some casts to avoid compiler
warnings about signedness. In general, int should be used for parameters
for allowing a signedness assertion in the function.
author | enz |
---|---|
date | Fri, 12 May 2000 17:52:41 +0100 |
parents | 125d79c9e586 |
children | 6f681d41734c |
comparison
equal
deleted
inserted
replaced
58:b4e6f7f96135 | 59:e612b263934f |
---|---|
1 /* | 1 /* |
2 protocol.c | 2 protocol.c |
3 | 3 |
4 $Id: protocol.c 60 2000-05-09 22:28:38Z uh1763 $ | 4 $Id: protocol.c 65 2000-05-12 16:52:41Z enz $ |
5 */ | 5 */ |
6 | 6 |
7 #if HAVE_CONFIG_H | 7 #if HAVE_CONFIG_H |
8 #include <config.h> | 8 #include <config.h> |
9 #endif | 9 #endif |
74 Prt_putTxtLn( const char* line, FILE *f ) | 74 Prt_putTxtLn( const char* line, FILE *f ) |
75 { | 75 { |
76 if ( line[ 0 ] == '.' ) | 76 if ( line[ 0 ] == '.' ) |
77 { | 77 { |
78 Log_dbg( "[S] .%s", line ); | 78 Log_dbg( "[S] .%s", line ); |
79 return ( fprintf( f, ".%s\r\n", line ) == strlen( line ) + 3 ); | 79 return ( fprintf( f, ".%s\r\n", line ) == (int)strlen( line ) + 3 ); |
80 } | 80 } |
81 else | 81 else |
82 { | 82 { |
83 Log_dbg( "[S] %s", line ); | 83 Log_dbg( "[S] %s", line ); |
84 return ( fprintf( f, "%s\r\n", line ) == strlen( line ) + 2 ); | 84 return ( fprintf( f, "%s\r\n", line ) == (int)strlen( line ) + 2 ); |
85 } | 85 } |
86 } | 86 } |
87 | 87 |
88 Bool | 88 Bool |
89 Prt_putEndOfTxt( FILE *f ) | 89 Prt_putEndOfTxt( FILE *f ) |
118 else if ( pLn - line >= MAXCHAR - 1 ) | 118 else if ( pLn - line >= MAXCHAR - 1 ) |
119 { | 119 { |
120 /* Put it out raw to prevent String overflow */ | 120 /* Put it out raw to prevent String overflow */ |
121 Log_err( "Writing VERY long line" ); | 121 Log_err( "Writing VERY long line" ); |
122 *pLn = '\0'; | 122 *pLn = '\0'; |
123 if ( fprintf( f, "%s", line ) != strlen( line ) ) | 123 if ( fprintf( f, "%s", line ) != (int)strlen( line ) ) |
124 return FALSE; | 124 return FALSE; |
125 pLn = line; | 125 pLn = line; |
126 } | 126 } |
127 else | 127 else |
128 *(pLn++) = *(pBuf++); | 128 *(pLn++) = *(pBuf++); |
278 time_t t; | 278 time_t t; |
279 | 279 |
280 getDomain( domain, from ); | 280 getDomain( domain, from ); |
281 time( &t ); | 281 time( &t ); |
282 strftime( date, MAXCHAR, "%Y%m%d%H%M%S", gmtime( &t ) ); | 282 strftime( date, MAXCHAR, "%Y%m%d%H%M%S", gmtime( &t ) ); |
283 srand( time( NULL ) ); | 283 srand( (unsigned int)time( NULL ) ); |
284 snprintf( msgId, MAXCHAR, "<%s.%X.%s@%s>", date, rand(), suffix, domain ); | 284 snprintf( msgId, MAXCHAR, "<%s.%X.%s@%s>", date, rand(), suffix, domain ); |
285 ASSERT( Prt_isValidMsgId( msgId ) ); | 285 ASSERT( Prt_isValidMsgId( msgId ) ); |
286 } | 286 } |