# HG changeset patch # User Mychaela Falconia # Date 1520553582 0 # Node ID f7228c18463a68de3d0262ae33d60f428c4e0927 # Parent 83c755829e31c18e9a57d2744685d2b95a50d691 uptools/libcoding: added function for UCS-2 BE output diff -r 83c755829e31 -r f7228c18463a uptools/libcoding/Makefile --- a/uptools/libcoding/Makefile Thu Mar 08 23:06:31 2018 +0000 +++ b/uptools/libcoding/Makefile Thu Mar 08 23:59:42 2018 +0000 @@ -4,7 +4,7 @@ gsm7_decode_tables.o gsm7_encode.o gsm7_encode_table.o gsm7_pack.o \ gsm7_unpack.o gsmtime.o hexdecode.o hexdump.o hexencode.o \ number_decode.o number_encode.o scaddr.o sms_submit.o sms_submit8.o \ - ucs2_decode.o utf8_decode.o utf8_decode2.o + ucs2_bigend.o ucs2_decode.o utf8_decode.o utf8_decode2.o LIB= libcoding.a all: ${LIB} diff -r 83c755829e31 -r f7228c18463a uptools/libcoding/ucs2_bigend.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uptools/libcoding/ucs2_bigend.c Thu Mar 08 23:59:42 2018 +0000 @@ -0,0 +1,22 @@ +/* + * This library module implements the function for converting a UCS-2 + * string from native 16-bit words into a byte buffer for SMS. + */ + +#include + +ucs2_out_bigend(inbuf, outbuf, nuni) + u_short *inbuf; + u_char *outbuf; + unsigned nuni; +{ + u_short *ip = inbuf; + u_char *op = outbuf; + unsigned n, uni; + + for (n = 0; n < nuni; n++) { + uni = *ip++; + *op++ = uni >> 8; + *op++ = uni; + } +}