Browse Source

Fix more warnings

tags/1.2
Timo Röhling 10 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
   fflush (fp);
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
   int result;
187
   int result;
188
   char value[1024];
188
   char value[1024];
340
   }
340
   }
341
   /* Read secret. The default installation makes this root accessible only. */
341
   /* Read secret. The default installation makes this root accessible only. */
342
   if (secret_file != NULL) {
342
   if (secret_file != NULL) {
343
-    size_t len;
344
     sf = fopen(secret_file, "rb");
343
     sf = fopen(secret_file, "rb");
345
     if (sf == NULL) {
344
     if (sf == NULL) {
346
       fprintf (stderr, "%s: Cannot open file with secret: %s\n", self, secret_file);
345
       fprintf (stderr, "%s: Cannot open file with secret: %s\n", self, secret_file);

+ 4
- 4
sha1.c View File

334
 */
334
 */
335
 
335
 
336
 static void
336
 static void
337
-sha_digest(char *out, char *data, int len)
337
+sha_digest(char *out, char *data, unsigned len)
338
 {
338
 {
339
 	SHA_INFO ctx;
339
 	SHA_INFO ctx;
340
 	sha_init(&ctx);
340
 	sha_init(&ctx);
343
 }
343
 }
344
 
344
 
345
 void
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
 	char	 sbuf[SHA_BLOCKSIZE];
348
 	char	 sbuf[SHA_BLOCKSIZE];
349
-	int		 i;
349
+	unsigned		 i;
350
 
350
 
351
 	if (len > SHA_BLOCKSIZE) {
351
 	if (len > SHA_BLOCKSIZE) {
352
 		sha_digest(sbuf, secret, len);
352
 		sha_digest(sbuf, secret, len);
368
 }
368
 }
369
 
369
 
370
 void
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
 	sha_update(&ctx->sctx, (sha_byte*)data, len);
373
 	sha_update(&ctx->sctx, (sha_byte*)data, len);
374
 }
374
 }

+ 7
- 7
srs2.c View File

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

+ 4
- 4
srs2.h View File

122
 srs_t	*srs_new();
122
 srs_t	*srs_new();
123
 void	 srs_init(srs_t *srs);
123
 void	 srs_init(srs_t *srs);
124
 void	 srs_free(srs_t *srs);
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
 				const char *sender, const char *alias);
126
 				const char *sender, const char *alias);
127
 int		 srs_forward_alloc(srs_t *srs, char **sptr,
127
 int		 srs_forward_alloc(srs_t *srs, char **sptr,
128
 				const char *sender, const char *alias);
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
 				const char *sender);
130
 				const char *sender);
131
 int		 srs_reverse_alloc(srs_t *srs, char **sptr, const char *sender);
131
 int		 srs_reverse_alloc(srs_t *srs, char **sptr, const char *sender);
132
 const char *
132
 const char *
172
 	char		opad[SHA_BLOCKSIZE + 1];
172
 	char		opad[SHA_BLOCKSIZE + 1];
173
 } srs_hmac_ctx_t;
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
 void	 srs_hmac_fini(srs_hmac_ctx_t *ctx, char *out);
177
 void	 srs_hmac_fini(srs_hmac_ctx_t *ctx, char *out);
178
 
178
 
179
 
179
 

Loading…
Cancel
Save