Fix more warnings.
authorSimon Josefsson <simon@josefsson.org>
Mon, 17 Nov 2008 18:03:30 +0000 (19:03 +0100)
committerSimon Josefsson <simon@josefsson.org>
Mon, 17 Nov 2008 18:03:30 +0000 (19:03 +0100)
configure.in
examples/CertificateExample.c
examples/CrlExample.c
gl/progname.h
lib/ASN1.c
lib/ASN1.y
lib/element.c
lib/errors.c
lib/gstr.c
lib/int.h
src/asn1Coding.c

index be691b8..0026075 100644 (file)
@@ -59,7 +59,7 @@ gl_INIT
 
 gl_WARN_SUPPORTED([WARNINGS])
 
-# Useless warnings for libidn.
+# Useless warnings for libtasn1.
 USELESS_WARNINGS=" \
   -Wc++-compat \
   -Woverlength-strings \
@@ -83,6 +83,7 @@ for w in $WARNINGS; do
   gl_WARN_ADD([$w])
 done
 
+gl_WARN_ADD([-Wno-missing-field-initializers])
 gl_WARN_ADD([-Wno-pointer-sign])
 gl_WARN_ADD([-Wno-unused-parameter])
 gl_WARN_ADD([-fdiagnostics-show-option])
index 39ce703..02e9bfd 100644 (file)
@@ -65,10 +65,10 @@ my_ltostr(long v,char *str)
 /* Parameters:                                        */
 /*   char *root: the structure identifier             */
 /*   char *answer: the string with elements like:     */
-/*                 "C=US O=gov"                       */ 
+/*                 "C=US O=gov"                       */
 /******************************************************/
 static void
-get_Name_type(ASN1_TYPE cert_def,ASN1_TYPE cert,char *root, char *answer)
+get_Name_type(ASN1_TYPE cert_def,ASN1_TYPE cert,const char *root, char *answer)
 {
   int k,k2,result,len;
   char name[128],str[1024],str2[1024],name2[128],counter[5],name3[128];
@@ -178,10 +178,11 @@ get_Name_type(ASN1_TYPE cert_def,ASN1_TYPE cert,char *root, char *answer)
 /*   int *der_len: number of bytes of der string      */ 
 /******************************************************/
 static void
-create_certificate(ASN1_TYPE cert_def,unsigned char *der,int *der_len)
+create_certificate(ASN1_TYPE cert_def, unsigned char *der,int *der_len)
 {
   int result,k,len;
-  unsigned char str[1024],*str2;
+  unsigned char str[1024];
+  const unsigned char *str2;
   ASN1_TYPE cert1=ASN1_TYPE_EMPTY;
   ASN1_TYPE value=ASN1_TYPE_EMPTY;
   ASN1_TYPE param=ASN1_TYPE_EMPTY;
index d34c0d8..b66f7e4 100644 (file)
@@ -67,10 +67,10 @@ my_ltostr(long v,char *str)
 /* Parameters:                                        */
 /*   char *root: the structure identifier             */
 /*   char *answer: the string with elements like:     */
-/*                 "C=US O=gov"                       */ 
+/*                 "C=US O=gov"                       */
 /******************************************************/
 static void
-get_Name_type(ASN1_TYPE cert_def,ASN1_TYPE cert,char *root, char *answer)
+get_Name_type(ASN1_TYPE cert_def,ASN1_TYPE cert,const char *root, char *answer)
 {
   int k,k2,result,len;
   char name[128],str[1024],str2[1024],name2[128],counter[5],name3[128];
@@ -191,7 +191,8 @@ static void
 create_CRL(ASN1_TYPE cert_def, unsigned char *der,int *der_len)
 {
   int result,k,len;
-  unsigned char str[1024],*str2;
+  unsigned char str[1024];
+  const unsigned char *str2;
   ASN1_TYPE crl=ASN1_TYPE_EMPTY;
   ASN1_TYPE value=ASN1_TYPE_EMPTY;
   char errorDescription[ASN1_MAX_ERROR_DESCRIPTION_SIZE];
index 82615c6..c5983f6 100644 (file)
@@ -34,7 +34,7 @@ extern const char *program_name;
 /* Set program_name, based on argv[0].  */
 extern void set_program_name (const char *argv0);
 
-#if ENABLE_RELOCATABLE
+#if defined(ENABLE_RELOCATABLE) && ENABLE_RELOCATABLE
 
 /* Set program_name, based on argv[0], and original installation prefix and
    directory, for relocatability.  */
index 1cbb7b0..2ddedec 100644 (file)
@@ -181,7 +181,7 @@ static char lastToken[ASN1_MAX_NAME_SIZE+1];        /* last token find in the file
 extern char _asn1_identifierMissing[];
 static const char *fileName;           /* file to parse */
 
-static int _asn1_yyerror (char *);
+static int _asn1_yyerror (const char *);
 static int _asn1_yylex(void);
 
 
@@ -2739,7 +2739,7 @@ int asn1_parser2array(const char *inputFileName,const char *outputFileName,
 /*  Return: int                                              */
 /*                                                           */
 /*************************************************************/
-static int _asn1_yyerror (char *s)
+static int _asn1_yyerror (const char *s)
 {
   /* Sends the error description to the std_out */
 
index 1b30822..eaae9eb 100644 (file)
@@ -51,7 +51,7 @@ static char lastToken[ASN1_MAX_NAME_SIZE+1];  /* last token find in the file
 extern char _asn1_identifierMissing[];
 static const char *fileName;           /* file to parse */
 
-static int _asn1_yyerror (char *);
+static int _asn1_yyerror (const char *);
 static int _asn1_yylex(void);
 
 %}
@@ -787,7 +787,7 @@ int asn1_parser2array(const char *inputFileName,const char *outputFileName,
 /*  Return: int                                              */
 /*                                                           */
 /*************************************************************/
-static int _asn1_yyerror (char *s)
+static int _asn1_yyerror (const char *s)
 {
   /* Sends the error description to the std_out */
 
index 05da2f2..e82807f 100644 (file)
@@ -33,6 +33,8 @@
 #include <gstr.h>
 #include "structure.h"
 
+#include "element.h"
+
 void
 _asn1_hierarchical_name (ASN1_TYPE  node, char *name, int name_size)
 {
index 29e08dc..9524fe1 100644 (file)
@@ -54,7 +54,7 @@ static const libtasn1_error_entry error_algorithms[] = {
   LIBTASN1_ERROR_ENTRY (ASN1_NAME_TOO_LONG),
   LIBTASN1_ERROR_ENTRY (ASN1_ARRAY_ERROR),
   LIBTASN1_ERROR_ENTRY (ASN1_ELEMENT_NOT_EMPTY),
-  {0}
+  {0, 0}
 };
 
 /**
index a093643..bf8f90c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *      Copyright (C) 2006 Free Software Foundation
+ *      Copyright (C) 2006, 2008 Free Software Foundation
  *      Copyright (C) 2002 Nikos Mavroyanopoulos
  *
  * This file is part of LIBTASN1.
@@ -21,6 +21,7 @@
  */
 
 #include <int.h>
+#include "gstr.h"
 
 /* These function are like strcat, strcpy. They only
  * do bounds checking (they shouldn't cause buffer overruns),
index 01f8e7f..65cc10b 100644 (file)
--- a/lib/int.h
+++ b/lib/int.h
@@ -140,15 +140,4 @@ struct node_asn
 #define CONST_DOWN        (1<<29)
 #define CONST_RIGHT       (1<<30)
 
-/* Prototypes for gstr.c. */
-void _asn1_str_cat (char *dest, size_t dest_tot_size, const char *src);
-void _asn1_str_cpy (char *dest, size_t dest_tot_size, const char *src);
-
-/* Prototypes for element.c. */
-void _asn1_hierarchical_name (ASN1_TYPE  node, char *name, int name_size);
-asn1_retCode _asn1_convert_integer (const char *value,
-                                   unsigned char *value_out,
-                                   int value_out_size, int *len);
-int _asn1_append_sequence_set (ASN1_TYPE  node);
-
 #endif /* INT_H */
index 86b7fa3..3fc2ca0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *      Copyright (C) 2006, 2007 Free Software Foundation
+ *      Copyright (C) 2006, 2007, 2008 Free Software Foundation
  *      Copyright (C) 2002 Fabio Fiorina
  *
  * This file is part of LIBTASN1.
@@ -56,7 +56,8 @@ static const char help_man[] =
 #define ASSIGNMENT_ERROR   2
 #define ASSIGNMENT_EOF     3
 
-int readAssignment(FILE *file,char *varName, char *value){
+static int
+readAssignment(FILE *file,char *varName, char *value){
 
   int ret;
 
@@ -72,7 +73,8 @@ int readAssignment(FILE *file,char *varName, char *value){
 
 
 
-void createFileName(char *inputFileName, char **outputFileName)
+static void
+createFileName(char *inputFileName, char **outputFileName)
 {
  char *char_p,*slash_p,*dot_p;