Happy new year
[yaz-moved-to-github.git] / src / advancegreek.c
index 7792073..ea29153 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2008 Index Data
+ * Copyright (C) 1995-2012 Index Data
  * See the file LICENSE for details.
  */
 /**
 #include <assert.h>
 #include <errno.h>
 #include <string.h>
-#include <ctype.h>
 
 #include "iconv-p.h"
 
-unsigned long yaz_read_advancegreek(yaz_iconv_t cd, unsigned char *inp,
-                                    size_t inbytesleft, size_t *no_read)
+static unsigned long read_advancegreek(yaz_iconv_t cd, yaz_iconv_decoder_t d,
+                                       unsigned char *inp,
+                                       size_t inbytesleft, size_t *no_read)
 {
     unsigned long x = 0;
     int shift = 0;
@@ -356,7 +356,7 @@ static size_t write_advancegreek(yaz_iconv_t cd, yaz_iconv_encoder_t w,
     case 0x03c4 : out[k++]=0x94; break;
     case 0x03c5 : out[k++]=0x95; break;
     case 0x03c6 : out[k++]=0x96; break;
-    case 0x03c7 : out[k++]=0x96; break;
+    case 0x03c7 : out[k++]=0x97; break;
     case 0x03c8 : out[k++]=0x98; break;
     case 0x03c9 : out[k++]=0x99; break;
     default:
@@ -365,7 +365,7 @@ static size_t write_advancegreek(yaz_iconv_t cd, yaz_iconv_encoder_t w,
             yaz_iconv_set_errno(cd, YAZ_ICONV_EILSEQ);
             return (size_t) -1;
         }
-        out[k++] = x;
+        out[k++] = (unsigned char ) x;
         break;
     }
     *outbytesleft -= k;
@@ -384,10 +384,23 @@ yaz_iconv_encoder_t yaz_advancegreek_encoder(const char *name,
     return 0;
 }
 
+yaz_iconv_decoder_t yaz_advancegreek_decoder(const char *name,
+                                             yaz_iconv_decoder_t d)
+{
+    if (!yaz_matchstr(name, "advancegreek"))
+    {
+        d->read_handle = read_advancegreek;
+        return d;
+    }
+    return 0;
+}
+
 /*
  * Local variables:
  * c-basic-offset: 4
+ * c-file-style: "Stroustrup"
  * indent-tabs-mode: nil
  * End:
  * vim: shiftwidth=4 tabstop=8 expandtab
  */
+