Couple of fiddly fixes in libcharset.
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Tue, 26 Oct 2004 19:39:42 +0000 (19:39 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Tue, 26 Oct 2004 19:39:42 +0000 (19:39 +0000)
git-svn-id: svn://svn.tartarus.org/sgt/charset@4701 cda61777-01e9-0310-a592-d414129be87e

iso2022s.c
sbcs.c

index 0599534..53b5d44 100644 (file)
@@ -679,7 +679,7 @@ static int ctext_from_ucs(long int ucs, int *subcharset, unsigned long *bytes)
     }
 }
 #define SEQ(str,cont,cs) \
-    {str,~(63<<(6*((cont&~RO)))),(cs)<<(6*((cont&~RO))),(cont),(cs)}
+    {str,~(63<<(6*(((cont)&~RO)))),(cs)<<(6*(((cont)&~RO))),(cont),(cs)}
 /*
  * Compound text defines restrictions on which container can take
  * which character sets. Things labelled `left half of' can only go
diff --git a/sbcs.c b/sbcs.c
index ab7b997..e8be5a8 100644 (file)
--- a/sbcs.c
+++ b/sbcs.c
@@ -56,11 +56,17 @@ int write_sbcs(charset_spec const *charset, long int input_chr,
               void (*emit)(void *ctx, long int output), void *emitctx)
 {
     const struct sbcs_data *sd = charset->data;
+    long int ret;
 
     UNUSEDARG(state);
 
     if (input_chr == -1)
        return TRUE;                   /* stateless; no cleanup required */
 
-    emit(emitctx, sbcs_from_unicode(sd, input_chr));
+    ret = sbcs_from_unicode(sd, input_chr);
+    if (ret == ERROR)
+       return FALSE;
+
+    emit(emitctx, ret);
+    return TRUE;
 }