modified varicode to replace an unsupported char >= 128 with a space rather than...
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Fri, 27 Apr 2018 20:51:10 +0000 (20:51 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Fri, 27 Apr 2018 20:51:10 +0000 (20:51 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@3526 01035d8c-6547-0410-b346-abe4f91aad63

codec2-dev/src/varicode.c

index 7d0ec1a9ed4673476af31fac6f88695fb6a62b2a..797d33be28e26c901512da8fe64686436ed6ec80 100644 (file)
 int varicode_encode1(short varicode_out[], char ascii_in[], int max_out, int n_in) {
     int            n_out, index, n_zeros, v_len;
     unsigned short byte1, byte2, packed;
-
+    char           c;
+    
     n_out = 0;
 
     while(n_in && (n_out < max_out)) {
 
-        assert((unsigned int)(*ascii_in) < 128);
+        c = *ascii_in;
+        if ((unsigned int)c >= 128) {
+            c = ' ';
+        }
 
-        index = 2*(unsigned int)(*ascii_in);
+        index = 2*(unsigned int)(c);
+        assert(index <= 254);
         byte1 = varicode_table1[index];
         byte2 = varicode_table1[index+1];
         packed = (byte1 << 8) + byte2;