<div dir="ltr"><span style="font-size:12.8px"><span class="gmail-il">Acked</span>-<span class="gmail-il">by</span>: Sagara Wickramasekara <</span><a href="mailto:sagaraw@gmail.com" target="_blank" style="font-size:12.8px">sagaraw@gmail.<wbr>com</a><span style="font-size:12.8px">></span><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jan 13, 2017 at 9:44 AM, Aaron Conole <span dir="ltr"><<a href="mailto:aconole@bytheb.org" target="_blank">aconole@bytheb.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Signed-off-by: Aaron Conole <<a href="mailto:aconole@bytheb.org">aconole@bytheb.org</a>><br>
---<br>
 c-lib/src/asn-UTF8String.c | 307 ------------------------------<wbr>---------------<br>
 1 file changed, 307 deletions(-)<br>
<br>
diff --git a/c-lib/src/asn-UTF8String.c b/c-lib/src/asn-UTF8String.c<br>
index 9f7dd7f..7c55379 100644<br>
--- a/c-lib/src/asn-UTF8String.c<br>
+++ b/c-lib/src/asn-UTF8String.c<br>
@@ -295,310 +295,3 @@ int CvtWchar2UTF8(wchar_t *inStr, char **utf8Str)<br>
<br>
        return 0;<br>
 } /* end of CvtWchar2UTF8() */<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-#ifdef OLD_CODE_<br>
-       /*<br>
-        * Convert a ISO10646 stream to UTF-8 wide character<br>
-        * Used only by UniversalStrings, BMPStrings, etc<br>
-        */<br>
-       int CvtToUTFStr(AsnOcts *Octsinputstr, wchar_t  **wchar_ptr)<br>
-       {<br>
-       int encodelen = Octsinputstr->octetLen;<br>
-       int newlen = 0;<br>
-       int flip = 1;<br>
-       wchar_t c = 0;<br>
-       char *inputstr = (char *)Octsinputstr->octs;<br>
-       int pos = encodelen;<br>
-       wchar_t *newbuf = (wchar_t *)calloc (1, encodelen*4);<br>
-<br>
-               memset (newbuf, 0, encodelen*4);<br>
-               while (pos > 0) {<br>
-                       memcpy ((wchar_t *)&c, inputstr, sizeof (wchar_t));<br>
-                  if(*(char *)&flip == 1)<br>
-                  {<br>
-                          c = (c << 8) | (c >> 8);<br>
-                  }<br>
-<br>
-                       if (c < 0x80)<br>
-                       {<br>
-                               newbuf[newlen++] = c;<br>
-                       }<br>
-                       else if (c < 0x800)<br>
-                       {<br>
-                               /* Produce the 2 byte encoding */<br>
-                   newbuf[newlen++] = ((0xc0 | (c >>6))<<8) |<br>
-                                                                       (0x80 | (c & 0x3f));<br>
-                       }<br>
-                       else if (c < 0x10000)<br>
-                       {<br>
-                               /* Produce the 3 byte encoding */<br>
-                               newbuf[newlen++] = ((0xe0 | (c >>12)) <<8) |<br>
-                                                                       (0x80 | ((c >>6) & 0x3f));<br>
-                               newbuf[newlen++] = (0x80 | (c & 0x3f));<br>
-<br>
-                       }<br>
-                       else if (c < 0x200000)<br>
-                       {<br>
-                               /* Not currently supported */<br>
-                               return (-1);<br>
-                       }<br>
-                       pos -= sizeof (wchar_t);<br>
-                       inputstr += sizeof (wchar_t);<br>
-           }<br>
-               *wchar_ptr = (wchar_t *)newbuf;<br>
-               return (newlen);<br>
-<br>
-       }<br>
-<br>
-       /*<br>
-        * Converts a UTF-8 String into a ISO-10646 string<br>
-        */<br>
-       int  CvtUTFToISO (AsnOcts *utf_stringa, wchar_t  **wchar_ptr)<br>
-       {<br>
-       int count;<br>
-       char *utf_string = (char *)utf_stringa->octs;<br>
-       int UTF8Len = utf_stringa->octetLen;<br>
-       wchar_t *work_buffer  = (wchar_t *)calloc (1, UTF8Len*sizeof(wchar_t));<br>
-       int newlen = 0;<br>
-       unsigned short enc_sequence;<br>
-       wchar_t enc_value = 0;<br>
-       int encoded_length = 0;<br>
-       /*      memset (work_buffer, 0, (UTF8Len*sizeof(wchar_t))); */<br>
-               count = UTF8Len;<br>
-           while (count > 0)<br>
-           {<br>
-                       /* Analyze the UTF encodings */<br>
-                       enc_sequence = (unsigned char)(*utf_string);<br>
-                       if (enc_sequence >= FOUR_BYTE_ENCODING)<br>
-                       {<br>
-                                               free (work_buffer);<br>
-                                               return (-1);<br>
-                       }<br>
-                       else if (enc_sequence >= THREE_BYTE_ENCODING)<br>
-                       {<br>
-                              /* three bytes encoded, 16 bits */<br>
-                               enc_value = ((utf_string[0] & 0x3f)<<12) |<br>
-                                                                               ((utf_string[1] & 0x3f)<<6)  |<br>
-                                                                                (utf_string[2] & 0x3f);<br>
-                               utf_string += 3;<br>
-                               count -= 3;<br>
-                                                       encoded_length = 2;<br>
-                       }<br>
-                       else if (enc_sequence >= TWO_BYTE_ENCODING)<br>
-                       {<br>
-                                                       /* two bytes encoded, 11 bits */<br>
-                               enc_value = ((utf_string[0] & 0x3f)<<6) |<br>
-                                                                               (utf_string[1] & 0x3f);<br>
-<br>
-                               utf_string += 2;<br>
-                               count -= 2;<br>
-                                                       encoded_length = 2;<br>
-                       }<br>
-                       else<br>
-                       {<br>
-                              /* Simple - no encoding needed */<br>
-                                                       enc_value = enc_sequence;<br>
-                               utf_string++;<br>
-                               count--;<br>
-                                                       encoded_length = 1;<br>
-                        }<br>
-<br>
-                                       work_buffer[newlen] = enc_value;<br>
-                                       newlen ++;<br>
-                 }<br>
-                /* NULL Terminate it */\<br>
-<br>
-                work_buffer[newlen] = (wchar_t)NULL;<br>
-                /* Update the caller's pointer (may want to realloc it) */<br>
-                       *wchar_ptr = (wchar_t *)work_buffer;<br>
-<br>
-               /* Return the length */<br>
-                return (newlen);<br>
-       }<br>
-       /* Format char pointer to RFC 2253<br>
-        * The flip argument specifies if you want to check for Endian-ness<br>
-        * such as on BMPStrings they are already checked for Endian-ness<br>
-        */<br>
-       int cvt_WCStrtoLDAP  (wchar_t *in_string, char  **char_ptr, int flip)<br>
-       {<br>
-<br>
-               bool quoted = false;      /* Flag telling us if we are in a quoted string */<br>
-               int hex_val = 0;                  /* Temporary hex value returned from sprintf */<br>
-               int quote_count = 0;      /* Quote counter */<br>
-               int nullcount = 0;                /* The terminating NULL Counter (related to the sizeof wchar_t) */<br>
-               int count = 0;                    /* The input byte counter */<br>
-               int to_count = 0;                 /* The destination counter */<br>
-               int buf_len = 0;<br>
-               char *wrkbf = (char *)NULL;<br>
-               wchar_t *lptr = in_string;<br>
-               for (buf_len=0; in_string[buf_len] != (wchar_t)NULL; buf_len++);<br>
-<br>
-               wrkbf = (char *)calloc (1, buf_len*6);<br>
-               while ((wchar_t)lptr[count] != (wchar_t)NULL)<br>
-               {<br>
-                       wchar_t the_string = (wchar_t)lptr[count];<br>
-                       /* Make platform independent */<br>
-                  if(*(char *)&flip == 1)<br>
-                  {<br>
-                         the_string = (the_string << 8) | (the_string >> 8);<br>
-                  }<br>
-<br>
-                       if (the_string != 0)<br>
-                       {<br>
-                               nullcount = 0;<br>
-                               if ((to_count == 0) && (the_string == '#') ||<br>
-                                       (the_string == ' '))<br>
-                               {<br>
-                                       /* A # or a Space in the first position must be escaped */<br>
-                                       wrkbf[to_count] = '\\';<br>
-                               }<br>
-                               /* Check the character for Quote */<br>
-                               if ((the_string == '\"') &&<br>
-                                       (!quoted))<br>
-                               {<br>
-                                       memcpy ((char *)&wrkbf[to_count], (char *)"\\", 1);<br>
-                                       to_count += 1;<br>
-                                       quoted = true;<br>
-                               }<br>
-                               else if ((the_string == '\"') && (quoted))<br>
-                               {<br>
-                                       /* End the Quoted */<br>
-                                       memcpy ((char *)&wrkbf[to_count], (char *)"\\", 1);<br>
-                                       to_count += 1;<br>
-                                       quoted = false;<br>
-                               }<br>
-                               /* Check non printable characters */<br>
-                               if ((the_string < ' ') ||<br>
-                                       (the_string > 0x7E))<br>
-                               {<br>
-                                       int len = 0;<br>
-                                       int hex_val = 0;  /* Temporary hex value returned from sprintf */<br>
-                                       char csprintf[4]; /* Sprintf Buffer */<br>
-<br>
-                                       /* Check for non-ascii values SPACE and DEL */<br>
-                                       /* Escape the value */<br>
-                                       wrkbf[to_count] = '\\';  /* Backslash */<br>
-                                       to_count++;<br>
-                                       hex_val = the_string;<br>
-                                       len = sprintf (csprintf,"%2x", hex_val);<br>
-                                       memcpy ((char *)&wrkbf[to_count], &csprintf[0], 2);<br>
-                                       to_count += 2;<br>
-                                       if (len == 4)<br>
-                                       {<br>
-                                               /* Check for "00" */<br>
-                                               if (memcmp (&csprintf[2], "00", 2) != 0)<br>
-                                               {<br>
-                                                       wrkbf[to_count] = '\\';  /* Backslash */<br>
-                                                       to_count++;<br>
-                                                       memcpy ((char *)&wrkbf[to_count], &csprintf[2], 2);<br>
-                                                       to_count += 2;<br>
-                                               }<br>
-                                       }<br>
-                               }<br>
-                               else<br>
-                               {<br>
-                                       if (!quoted)<br>
-                                       {<br>
-                                               /*<br>
-                                                * Escape the following characters if not quoted<br>
-                                                */<br>
-                                               if ((the_string == ',') ||<br>
-                                                       (the_string == '=') ||<br>
-                                                       (the_string == '+') ||<br>
-                                                       (the_string == '<') ||<br>
-                                                       (the_string == '>') ||<br>
-                                                       (the_string == '#') ||<br>
-                                                       (the_string == ';'))<br>
-                                               {<br>
-                                                       /* Add the escape character to the work buffer */<br>
-                                                       wrkbf[to_count] = '\\';<br>
-                                                       to_count ++;<br>
-                                               }<br>
-                                       }<br>
-                                       wrkbf[to_count] = (char)the_string;<br>
-                                       to_count++;<br>
-                               }<br>
-                       }<br>
-                       else<br>
-                       {<br>
-                               nullcount ++;<br>
-                       }<br>
-<br>
-                       count ++;<br>
-               }<br>
-                       /* Check the last character for a SPACE */<br>
-               if (wrkbf[to_count-1] == ' ')<br>
-               {<br>
-                       /* Must be escaped */<br>
-                       wrkbf[to_count] = wrkbf[to_count-1];<br>
-                       wrkbf[to_count-1] = '\\';<br>
-               }<br>
-               *char_ptr = wrkbf;<br>
-               return (to_count);<br>
-       }<br>
-<br>
-       /* Format char pointer with RFC 2253 to a char pointer */<br>
-       int cvt_LDAPtoStr  (char *in_string, char  **char_ptr)<br>
-       {<br>
-<br>
-               bool quoted = false;      /* Flag telling us if we are in a quoted string */<br>
-               int hex_val = 0;                  /* Temporary hex value returned from sprintf */<br>
-               int quote_count = 0;      /* Quote counter */<br>
-               char hex_str[4];                  /* Sprintf Buffer */<br>
-               char *the_string;                 /* The character to parse     */<br>
-               char *wrkbf, *buf_ptr;    /* Our work buffer */<br>
-               int nullcount = 0;                /* The terminating NULL Counter (related to the sizeof wchar_t) */<br>
-               int count = 0;                    /* The input byte counter */<br>
-               int to_count = 0;                 /* The destination counter */<br>
-               int len = 0;<br>
-               int buf_len = 0;<br>
-<br>
-               char *lptr = (char *)in_string;<br>
-               for (buf_len=0; in_string[buf_len] != (wchar_t)NULL; buf_len++);<br>
-               buf_ptr = (char *)calloc (1, buf_len*6);<br>
-               wrkbf = buf_ptr;<br>
-               the_string = lptr;<br>
-               while (nullcount < sizeof (wchar_t))<br>
-               {<br>
-                       if (the_string != NULL)<br>
-                       {<br>
-                               if (the_string == (char *)'\\')<br>
-                               {<br>
-                                       if ((the_string >= (char *)'0') && (the_string <= (char *)'9'))<br>
-                                       {<br>
-                                               memset (&hex_str, 0, 4);<br>
-                                               memcpy (hex_str, (char *)&the_string+1, 2);<br>
-                                               /* Escaped hex value - convert */<br>
-                                               hex_val = strtol (hex_str, NULL, 10);<br>
-                                               /* Copy then to the buffer */<br>
-                                               memcpy ((char *)wrkbf[to_count], (char *)&hex_val, 2);<br>
-                                               the_string++;<br>
-                                       }<br>
-                                       else<br>
-                                       {<br>
-                                               /* Just skip over the backslash and add the data to the buffer */<br>
-                                               wrkbf = (char *)&the_string+1;<br>
-                                               memcpy ((char *)wrkbf[to_count], (char *)the_string+1, 1);<br>
-                                       the_string ++;<br>
-                               }<br>
-                       }<br>
-                       else<br>
-                       {<br>
-                               wrkbf = the_string;<br>
-                       }<br>
-                       the_string ++;<br>
-                       wrkbf++;<br>
-               }<br>
-       }<br>
-    if (to_count < buf_len*6)<br>
-               realloc (wrkbf, to_count+1);<br>
-       *char_ptr = wrkbf;<br>
-       return (to_count);<br>
-}<br>
-<br>
-<br>
-#endif /* OLD_CODE_ */<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.7.4<br>
<br>
______________________________<wbr>_________________<br>
dev mailing list<br>
<a href="mailto:dev@lists.esnacc.org">dev@lists.esnacc.org</a><br>
<a href="http://mail.esnacc.org/mailman/listinfo/dev" rel="noreferrer" target="_blank">http://mail.esnacc.org/<wbr>mailman/listinfo/dev</a><br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">-Sagara</div>
</div>