pspp-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pspp-cvs] pspp/src/libpspp ChangeLog i18n.c


From: John Darrington
Subject: [Pspp-cvs] pspp/src/libpspp ChangeLog i18n.c
Date: Tue, 06 Mar 2007 10:36:46 +0000

CVSROOT:        /sources/pspp
Module name:    pspp
Changes by:     John Darrington <jmd>   07/03/06 10:36:46

Modified files:
        src/libpspp    : ChangeLog i18n.c 

Log message:
        Fixed constness problem in iconv, using the ICONV_CONST preprocessor 
        macro provided by iconv.m4 (from gettext).

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/src/libpspp/ChangeLog?cvsroot=pspp&r1=1.55&r2=1.56
http://cvs.savannah.gnu.org/viewcvs/pspp/src/libpspp/i18n.c?cvsroot=pspp&r1=1.5&r2=1.6

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/pspp/pspp/src/libpspp/ChangeLog,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -b -r1.55 -r1.56
--- ChangeLog   22 Feb 2007 23:34:44 -0000      1.55
+++ ChangeLog   6 Mar 2007 10:36:46 -0000       1.56
@@ -1,3 +1,7 @@
+Mon Mar  5 20:55:49 CET 2007 John Darrington <address@hidden>
+
+       * i18n.c: Cast second argument of iconv using ICONV_CONST
+
 2007-02-22  Ben Pfaff  <address@hidden>
 
        * string.h: Don't include vsnprintf.h any more, because gnulib has

Index: i18n.c
===================================================================
RCS file: /sources/pspp/pspp/src/libpspp/i18n.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- i18n.c      21 Feb 2007 08:27:16 -0000      1.5
+++ i18n.c      6 Mar 2007 10:36:46 -0000       1.6
@@ -62,7 +62,7 @@
    The returned string must be freed when no longer required.
 */
 char *
-recode_string(enum conv_id how,  const char *text, int length)
+recode_string (enum conv_id how,  const char *text, int length)
 {
   char *outbuf = 0;
   size_t outbufferlength;
@@ -80,7 +80,7 @@
   if ( length == -1 ) 
      length = strlen(text);
 
-  assert(how < n_CONV);
+  assert (how < n_CONV);
 
   if (convertor[how] == (iconv_t) -1) 
     return xstrndup (text, length);
@@ -96,14 +96,14 @@
   inbytes = length;
   
   do {
-    result = iconv(convertor[how], &text, &inbytes, 
+    result = iconv (convertor[how], (ICONV_CONST char **) &text, &inbytes, 
                   &op, &outbytes);
 
     if ( -1 == result ) 
       {
        int the_error = errno;
 
-       switch ( the_error)
+       switch (the_error)
          {
          case EILSEQ:
          case EINVAL:
@@ -117,9 +117,9 @@
              }
            /* Fall through */
          case E2BIG:
-           free(outbuf);
+           free (outbuf);
            outbufferlength <<= 1;
-           outbuf = xmalloc(outbufferlength);
+           outbuf = xmalloc (outbufferlength);
            op = outbuf;
            outbytes = outbufferlength;
            inbytes = length;
@@ -128,14 +128,13 @@
            /* should never happen */
            break;
          }
-
       }
   } while ( -1 == result );
 
   if (outbytes == 0 ) 
     {
       char *const oldaddr = outbuf;
-      outbuf = xrealloc(outbuf, outbufferlength + 1);
+      outbuf = xrealloc (outbuf, outbufferlength + 1);
       
       op += (outbuf - oldaddr) ;
     }
@@ -148,15 +147,15 @@
 
 /* Returns the current PSPP locale */
 const char *
-get_pspp_locale(void)
+get_pspp_locale (void)
 {
-  assert ( locale);
+  assert (locale);
   return locale;
 }
 
 /* Set the PSPP locale */
 void 
-set_pspp_locale(const char *l)
+set_pspp_locale (const char *l)
 {
   char *current_locale;
   const char *current_charset;
@@ -164,28 +163,28 @@
   free(locale);
   locale = strdup(l);
 
-  current_locale = setlocale(LC_CTYPE, 0);
-  current_charset = locale_charset();
-  setlocale(LC_CTYPE, locale);
+  current_locale = setlocale (LC_CTYPE, 0);
+  current_charset = locale_charset ();
+  setlocale (LC_CTYPE, locale);
   
-  charset = locale_charset();
-  setlocale(LC_CTYPE, current_locale);
+  charset = locale_charset ();
+  setlocale (LC_CTYPE, current_locale);
 
-  iconv_close(convertor[CONV_PSPP_TO_UTF8]);
+  iconv_close (convertor[CONV_PSPP_TO_UTF8]);
   convertor[CONV_PSPP_TO_UTF8] = create_iconv ("UTF-8", charset);
 
-  iconv_close(convertor[CONV_SYSTEM_TO_PSPP]);
+  iconv_close (convertor[CONV_SYSTEM_TO_PSPP]);
   convertor[CONV_SYSTEM_TO_PSPP] = create_iconv (charset, current_charset);
 }
 
 void
-i18n_init(void)
+i18n_init (void)
 {
-  assert ( ! locale) ;
-  locale = strdup(setlocale(LC_CTYPE, NULL));
+  assert (!locale) ;
+  locale = strdup (setlocale (LC_CTYPE, NULL));
 
-  setlocale(LC_CTYPE, locale);
-  charset = locale_charset();
+  setlocale (LC_CTYPE, locale);
+  charset = locale_charset ();
 
   convertor[CONV_PSPP_TO_UTF8] = create_iconv ("UTF-8", charset);
   convertor[CONV_SYSTEM_TO_PSPP] = create_iconv (charset, charset);
@@ -193,17 +192,17 @@
 
 
 void 
-i18n_done(void)
+i18n_done (void)
 {
   int i;
-  free(locale);
+  free (locale);
   locale = 0;
 
   for(i = 0 ; i < n_CONV; ++i ) 
     {
       if ( (iconv_t) -1 == convertor[i] ) 
        continue;
-      iconv_close(convertor[i]);
+      iconv_close (convertor[i]);
     }
 }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]