Browse Source

Fix more warnings

tags/1.2
Timo Röhling 9 years ago
parent
commit
0442b31227
4 changed files with 16 additions and 17 deletions
  1. 1
    2
      postsrsd.c
  2. 4
    4
      sha1.c
  3. 7
    7
      srs2.c
  4. 4
    4
      srs2.h

+ 1
- 2
postsrsd.c View File

@@ -182,7 +182,7 @@ static void handle_forward (srs_t *srs, FILE *fp, const char *address, const cha
182 182
   fflush (fp);
183 183
 }
184 184
 
185
-static void handle_reverse (srs_t *srs, FILE *fp, const char *address, const char *domain, const char **excludes)
185
+static void handle_reverse (srs_t *srs, FILE *fp, const char *address, const char *domain __attribute__((unused)), const char **excludes __attribute__((unused)) )
186 186
 {
187 187
   int result;
188 188
   char value[1024];
@@ -340,7 +340,6 @@ int main (int argc, char **argv)
340 340
   }
341 341
   /* Read secret. The default installation makes this root accessible only. */
342 342
   if (secret_file != NULL) {
343
-    size_t len;
344 343
     sf = fopen(secret_file, "rb");
345 344
     if (sf == NULL) {
346 345
       fprintf (stderr, "%s: Cannot open file with secret: %s\n", self, secret_file);

+ 4
- 4
sha1.c View File

@@ -334,7 +334,7 @@ sha_final(unsigned char digest[20], SHA_INFO *sha_info)
334 334
 */
335 335
 
336 336
 static void
337
-sha_digest(char *out, char *data, int len)
337
+sha_digest(char *out, char *data, unsigned len)
338 338
 {
339 339
 	SHA_INFO ctx;
340 340
 	sha_init(&ctx);
@@ -343,10 +343,10 @@ sha_digest(char *out, char *data, int len)
343 343
 }
344 344
 
345 345
 void
346
-srs_hmac_init(srs_hmac_ctx_t *ctx, char *secret, int len)
346
+srs_hmac_init(srs_hmac_ctx_t *ctx, char *secret, unsigned len)
347 347
 {
348 348
 	char	 sbuf[SHA_BLOCKSIZE];
349
-	int		 i;
349
+	unsigned		 i;
350 350
 
351 351
 	if (len > SHA_BLOCKSIZE) {
352 352
 		sha_digest(sbuf, secret, len);
@@ -368,7 +368,7 @@ srs_hmac_init(srs_hmac_ctx_t *ctx, char *secret, int len)
368 368
 }
369 369
 
370 370
 void
371
-srs_hmac_update(srs_hmac_ctx_t *ctx, char *data, int len)
371
+srs_hmac_update(srs_hmac_ctx_t *ctx, char *data, unsigned len)
372 372
 {
373 373
 	sha_update(&ctx->sctx, (sha_byte*)data, len);
374 374
 }

+ 7
- 7
srs2.c View File

@@ -212,7 +212,7 @@ const char *SRS_TIME_BASECHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
212 212
 #define SRS_TIME_SLOTS		(1<<(SRS_TIME_BASEBITS<<(SRS_TIME_SIZE-1)))
213 213
 
214 214
 int
215
-srs_timestamp_create(srs_t *srs, char *buf, time_t now)
215
+srs_timestamp_create(srs_t *srs __attribute__((unused)), char *buf, time_t now)
216 216
 {
217 217
 	now = now / SRS_TIME_PRECISION;
218 218
 	buf[1] = SRS_TIME_BASECHARS[now & ((1 << SRS_TIME_BASEBITS) - 1)];
@@ -507,7 +507,7 @@ srs_compile_guarded(srs_t *srs,
507 507
 }
508 508
 
509 509
 int
510
-srs_parse_shortcut(srs_t *srs, char *buf, int buflen, char *senduser)
510
+srs_parse_shortcut(srs_t *srs, char *buf, unsigned buflen, char *senduser)
511 511
 {
512 512
 	char	*srshash;
513 513
 	char	*srsstamp;
@@ -538,7 +538,7 @@ srs_parse_shortcut(srs_t *srs, char *buf, int buflen, char *senduser)
538 538
 						srshost, srsuser);
539 539
 		if (ret != SRS_SUCCESS)
540 540
 			return ret;
541
-		sprintf(buf, "%s@%s", srsuser, srshost);
541
+		snprintf(buf, buflen, "%s@%s", srsuser, srshost);
542 542
 		return SRS_SUCCESS;
543 543
 	}
544 544
 
@@ -577,13 +577,13 @@ srs_parse_guarded(srs_t *srs, char *buf, int buflen, char *senduser)
577 577
 }
578 578
 
579 579
 int
580
-srs_forward(srs_t *srs, char *buf, int buflen,
580
+srs_forward(srs_t *srs, char *buf, unsigned buflen,
581 581
 				const char *sender, const char *alias)
582 582
 {
583 583
 	char	*senduser;
584 584
 	char	*sendhost;
585 585
 	char	*tmp;
586
-	int		 len;
586
+	unsigned		 len;
587 587
 
588 588
 	if (srs->noforward)
589 589
 		return SRS_ENOTREWRITTEN;
@@ -650,11 +650,11 @@ srs_forward_alloc(srs_t *srs, char **sptr,
650 650
 }
651 651
 
652 652
 int
653
-srs_reverse(srs_t *srs, char *buf, int buflen, const char *sender)
653
+srs_reverse(srs_t *srs, char *buf, unsigned buflen, const char *sender)
654 654
 {
655 655
 	char	*senduser;
656 656
 	char	*tmp;
657
-	int		 len;
657
+	unsigned		 len;
658 658
 
659 659
 	if (!SRS_IS_SRS_ADDRESS(sender))
660 660
 		return SRS_ENOTSRSADDRESS;

+ 4
- 4
srs2.h View File

@@ -122,11 +122,11 @@ int		 srs_set_malloc(srs_malloc_t m, srs_realloc_t r, srs_free_t f);
122 122
 srs_t	*srs_new();
123 123
 void	 srs_init(srs_t *srs);
124 124
 void	 srs_free(srs_t *srs);
125
-int		 srs_forward(srs_t *srs, char *buf, int buflen,
125
+int		 srs_forward(srs_t *srs, char *buf, unsigned buflen,
126 126
 				const char *sender, const char *alias);
127 127
 int		 srs_forward_alloc(srs_t *srs, char **sptr,
128 128
 				const char *sender, const char *alias);
129
-int		 srs_reverse(srs_t *srs, char *buf, int buflen,
129
+int		 srs_reverse(srs_t *srs, char *buf, unsigned buflen,
130 130
 				const char *sender);
131 131
 int		 srs_reverse_alloc(srs_t *srs, char **sptr, const char *sender);
132 132
 const char *
@@ -172,8 +172,8 @@ struct _srs_hmac_ctx_t {
172 172
 	char		opad[SHA_BLOCKSIZE + 1];
173 173
 } srs_hmac_ctx_t;
174 174
 
175
-void	 srs_hmac_init(srs_hmac_ctx_t *ctx, char *secret, int len);
176
-void	 srs_hmac_update(srs_hmac_ctx_t *ctx, char *data, int len);
175
+void	 srs_hmac_init(srs_hmac_ctx_t *ctx, char *secret, unsigned len);
176
+void	 srs_hmac_update(srs_hmac_ctx_t *ctx, char *data, unsigned len);
177 177
 void	 srs_hmac_fini(srs_hmac_ctx_t *ctx, char *out);
178 178
 
179 179
 

Loading…
Cancel
Save