00001
00007 #include <stdlib.h>
00008 #include "check.h"
00009 #include <string.h>
00010 #include "wstring.h"
00011
00012 void ws_wstoa(char *widestring, const size_t length)
00013 {
00014 int i;
00015
00016 check(widestring != NULL);
00017
00018
00019 for(i=1; i < length/2; i++)
00020 {
00021 widestring[i] = widestring[2*i];
00022 }
00023
00024 widestring[i] = '\0';
00025 }
00026
00027 void ws_atows(char *string, const size_t length)
00028 {
00029 int i;
00030
00031 check(string != NULL);
00032
00033 for(i=length/2 - 1; i >= 0; i--)
00034 {
00035 string[2*i] = string[i];
00036 string[2*i+1] = '\0';
00037 }
00038 }
00039
00040 void *ws_memswapcpy(void *dest, void *src, const size_t len)
00041 {
00042 size_t i;
00043
00044 check(dest != NULL);
00045 check(src != NULL);
00046
00047 for(i=0; i < len; i++)
00048 {
00049 ((char *)dest)[i] = ((char *)src)[len-i-1];
00050 }
00051
00052 return dest;
00053 }
00054