OSDN Git Service

I was library can be compiled 20140223
[zither/ds-zither.git] / libms / safe_ujtoj.c
1 // safe_ujtoj.c
2 // masashi shimakura 20140223
3
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include <string.h>
7
8 #include "libms.h"
9
10
11
12 char * safe_ujtoj(char * data)
13 {
14 char * swap;
15 int max;
16 // int count;
17
18 max = (int)strlen(data);
19
20 if(max > 0){
21    swap = (char *)calloc((max * 2), sizeof(char));
22    ujtoj((unsigned char *)swap, (unsigned char *)data);
23    data = safe_memcpy(data, swap, BUF_MAX);
24
25 //   for(count = 0; count < strlen(data); count++){
26 //      printf("data char[%c] data hex<0x%x>\n", data[count], data[count]);
27 //      }
28
29
30    free(swap);
31    }
32 else{
33    fprintf(stderr,"safe_ujtoj(): data size err.\n");
34    }
35
36 return data;
37 }
38
39