/[public]/psiconv/trunk/program/psiconv/general.c
ViewVC logotype

Diff of /psiconv/trunk/program/psiconv/general.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 216 Revision 217
31/* Output a UCS2 character in one of the supported encodings. */ 31/* Output a UCS2 character in one of the supported encodings. */
32void output_char(psiconv_config config, psiconv_list list, 32void output_char(psiconv_config config, psiconv_list list,
33 psiconv_ucs2 character, encoding enc) 33 psiconv_ucs2 character, encoding enc)
34{ 34{
35 psiconv_u8 temp; 35 psiconv_u8 temp;
36 psiconv_u8 *byteptr;
36 int res; 37 int res,i;
38 psiconv_buffer buf;
37#define TEMPSTR_LEN 80 39#define TEMPSTR_LEN 80
38 char tempstr[TEMPSTR_LEN]; 40 char tempstr[TEMPSTR_LEN];
39 41
40 if (enc == ENCODING_UCS2) { 42 if (enc == ENCODING_UCS2) {
41 temp = character >> 8; 43 temp = character >> 8;
104 fputs("Out of memory error\n",stderr); 106 fputs("Out of memory error\n",stderr);
105 exit(1); 107 exit(1);
106 } 108 }
107 } 109 }
108 } else if (enc == ENCODING_PSION) { 110 } else if (enc == ENCODING_PSION) {
111 if (!(buf = psiconv_buffer_new())) {
112 fputs("Out of memory error\n",stderr);
113 exit(1);
114 }
109 temp = psiconv_unicode_to_char(config,character); 115 psiconv_unicode_write_char(config,buf,0,character);
116 for (i = 0; i < psiconv_buffer_length(buf); i++) {
117 if (!(byteptr = psiconv_buffer_get(buf,i))) {
118 fputs("Internal memory corruption\n",stderr);
119 exit(1);
120 }
110 if ((res = psiconv_list_add(list,&temp))) { 121 if ((res = psiconv_list_add(list,byteptr))) {
111 fputs("Out of memory error\n",stderr); 122 fputs("Out of memory error\n",stderr);
112 exit(1); 123 exit(1);
113 } 124 }
125 }
126 psiconv_buffer_free(buf);
114 } 127 }
115} 128}
116 129
117void output_string(psiconv_config config, psiconv_list list, 130void output_string(psiconv_config config, psiconv_list list,
118 psiconv_ucs2 *string, encoding enc) 131 psiconv_ucs2 *string, encoding enc)

Legend:
Removed from v.216  
changed lines
  Added in v.217

frodo@frodo.looijaard.name
ViewVC Help
Powered by ViewVC 1.1.26