… | |
… | |
201 | goto ERROR2_2; |
201 | goto ERROR2_2; |
202 | if ((res = psiconv_parse_character_layout_list(config,buf,lev+3,off+len,&leng, |
202 | if ((res = psiconv_parse_character_layout_list(config,buf,lev+3,off+len,&leng, |
203 | style->character))) |
203 | style->character))) |
204 | goto ERROR2_3; |
204 | goto ERROR2_3; |
205 | len += leng; |
205 | len += leng; |
|
|
206 | /* Ugly: I really don't know whether this is right for UTF8 */ |
206 | psiconv_progress(config,lev+3,off+len,"Going to read the hotkey"); |
207 | psiconv_progress(config,lev+3,off+len,"Going to read the hotkey"); |
207 | temp = psiconv_read_u32(config,buf,lev+3,off+len,&res); |
208 | style->hotkey = psiconv_unicode_read_char(config,buf,lev+3,off+len,NULL,&res); |
|
|
209 | psiconv_debug(config,lev+3,off+len,"Normal Hotkey value %08x",style->hotkey); |
208 | if (res) |
210 | if (res) |
209 | goto ERROR2_3; |
211 | goto ERROR2_3; |
210 | if (temp & 0xffffff00) { |
212 | len += 0x04; |
211 | psiconv_warn(config,lev+3,off+len, |
|
|
212 | "Normal style hotkey has unknown value (ignored)"); |
|
|
213 | psiconv_debug(config,lev+3,off+len,"Hotkey value %08x",temp); |
|
|
214 | temp = 0; |
|
|
215 | } |
|
|
216 | style->hotkey = psiconv_unicode_from_char(config,temp); |
|
|
217 | (*result)->normal = style; |
213 | (*result)->normal = style; |
218 | len += 0x04; |
|
|
219 | |
214 | |
220 | psiconv_progress(config,lev+2,off+len,"Going to read hotkeys list"); |
215 | psiconv_progress(config,lev+2,off+len,"Going to read hotkeys list"); |
221 | if (!((*result)->styles = psiconv_list_new(sizeof(*style)))) |
216 | if (!((*result)->styles = psiconv_list_new(sizeof(*style)))) |
222 | goto ERROR3; |
217 | goto ERROR3; |
223 | if (!(style = malloc(sizeof(*style)))) { |
218 | if (!(style = malloc(sizeof(*style)))) { |
… | |
… | |
229 | if (res) |
224 | if (res) |
230 | goto ERROR3_2; |
225 | goto ERROR3_2; |
231 | len ++; |
226 | len ++; |
232 | psiconv_debug(config,lev+3,off+len,"Nummer of hotkeys: %02x",nr); |
227 | psiconv_debug(config,lev+3,off+len,"Nummer of hotkeys: %02x",nr); |
233 | for (i = 0; i < nr; i ++) { |
228 | for (i = 0; i < nr; i ++) { |
234 | temp = psiconv_read_u32(config,buf,lev+2,off+len,&res); |
229 | /* Ugly: I really don't know whether this is right for UTF8 */ |
235 | if (res) |
230 | style->hotkey = psiconv_unicode_read_char(config,buf,lev+3,off+len, |
236 | goto ERROR3_2; |
231 | NULL,&res); |
237 | if (temp & 0xffffff00) { |
|
|
238 | psiconv_warn(config,lev+3,off+len,"Style hotkey has unknown value (ignored)"); |
|
|
239 | psiconv_debug(config,lev+3,off+len,"Hotkey %d value %08x",i,temp); |
|
|
240 | temp = 0; |
|
|
241 | } |
|
|
242 | style->hotkey = temp & 0x000000ff; |
|
|
243 | if ((style->hotkey >= 32) && (style->hotkey < 127)) |
|
|
244 | psiconv_debug(config,lev+3,off+len,"Hotkey %d: %c",i,style->hotkey); |
|
|
245 | else if (style->hotkey == 0x00) |
|
|
246 | psiconv_debug(config,lev+3,off+len,"Hotkey %d: <none>",i); |
|
|
247 | else |
|
|
248 | psiconv_debug(config,lev+3,off+len,"Hotkey %d: %02x",i,style->hotkey); |
232 | psiconv_debug(config,lev+3,off+len,"Hotkey %d value %08x",i,style->hotkey); |
|
|
233 | len += 0x04; |
249 | if ((res = psiconv_list_add((*result)->styles,style))) |
234 | if ((res = psiconv_list_add((*result)->styles,style))) |
250 | goto ERROR3_2; |
235 | goto ERROR3_2; |
251 | len += 0x04; |
|
|
252 | } |
236 | } |
253 | free(style); |
237 | free(style); |
254 | |
238 | |
255 | psiconv_progress(config,lev+2,off+len,"Going to read all other styles"); |
239 | psiconv_progress(config,lev+2,off+len,"Going to read all other styles"); |
256 | psiconv_progress(config,lev+2,off+len,"Going to read the number of styles"); |
240 | psiconv_progress(config,lev+2,off+len,"Going to read the number of styles"); |
… | |
… | |
369 | ERROR6: |
353 | ERROR6: |
370 | free(style->name); |
354 | free(style->name); |
371 | ERROR5: |
355 | ERROR5: |
372 | for (j = 0; j < i ;j++) { |
356 | for (j = 0; j < i ;j++) { |
373 | if (!(style = psiconv_list_get((*result)->styles,j))) { |
357 | if (!(style = psiconv_list_get((*result)->styles,j))) { |
374 | psiconv_error(config,lev+1,off,"Massive memory corruption"); |
358 | psiconv_error(config,lev+1,off,"Data structure corruption"); |
375 | goto ERROR4; |
359 | goto ERROR4; |
376 | } |
360 | } |
377 | psiconv_free_character_layout(style->character); |
361 | psiconv_free_character_layout(style->character); |
378 | psiconv_free_paragraph_layout(style->paragraph); |
362 | psiconv_free_paragraph_layout(style->paragraph); |
379 | free(style->name); |
363 | free(style->name); |