]> git.deb.at Git - pkg/abook.git/blobdiff - misc.c
wide character support
[pkg/abook.git] / misc.c
diff --git a/misc.c b/misc.c
index fa67f0c99a644942f26c2b43af43ca3f85282370..f54b1c90b45c5cc3bdc7efdf1db2f264c39345f8 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -85,7 +85,7 @@ char *
 mkstr (const char *format, ... )
 {
        MY_VA_LOCAL_DECL;
-       int size = 100;
+       size_t size = 100;
        char *buffer =
 #ifdef ABOOK_SRC
                (char *) abook_malloc (size);
@@ -123,7 +123,7 @@ mkstr (const char *format, ... )
 char*
 strconcat (const char *str, ...)
 {
-       int   l;
+       unsigned long l;
        MY_VA_LOCAL_DECL;
        char *s, *concat;
 
@@ -144,6 +144,8 @@ strconcat (const char *str, ...)
 #else
        malloc(l);
 #endif
+       if(concat == NULL)
+               return NULL;
 
        strcpy (concat, str);
        MY_VA_START(str);
@@ -186,10 +188,12 @@ char *
 my_getcwd()
 {
        char *dir = NULL;
-       int size = 100;
+       size_t size = 100;
 
        if( (dir = (char *)malloc(size)) == NULL)
                return NULL;
+
+       *dir = 0;
        
        while( getcwd(dir, size) == NULL && errno == ERANGE )
                if( (dir = (char *)realloc(dir, size *=2)) == NULL)