/[public]/psiconv/trunk/lib/psiconv/data.c
ViewVC logotype

Diff of /psiconv/trunk/lib/psiconv/data.c

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

Revision 208 Revision 241
22#include <stdlib.h> 22#include <stdlib.h>
23#include <string.h> 23#include <string.h>
24#include "data.h" 24#include "data.h"
25#include "list.h" 25#include "list.h"
26#include "unicode.h" 26#include "unicode.h"
27#include "error.h"
27 28
28#ifdef DMALLOC 29#ifdef DMALLOC
29#include <dmalloc.h> 30#include <dmalloc.h>
30#endif 31#endif
31 32
333 return ss->normal; 334 return ss->normal;
334 else 335 else
335 return psiconv_list_get(ss->styles,0xff - nr); 336 return psiconv_list_get(ss->styles,0xff - nr);
336} 337}
337 338
339int psiconv_find_style(const psiconv_word_styles_section ss,
340 const psiconv_ucs2 *name,
341 int *nr)
342{
343 const psiconv_ucs2 value_normal[] = { 'N','o','r','m','a','l',0 };
344 psiconv_word_style style;
345 int i;
346
347 if (!nr)
348 return PSICONV_E_OTHER;
349 if(!psiconv_unicode_strcmp(value_normal,name)) {
350 *nr = 0;
351 return 0;
352 }
353 for (i = 0; i < psiconv_list_length(ss->styles);i++) {
354 if (!(style = psiconv_list_get(ss->styles,i)))
355 return PSICONV_E_NOMEM;
356 if (!psiconv_unicode_strcmp(style->name,name)) {
357 *nr = 0xff - i;
358 return 0;
359 }
360 }
361 *nr = 0;
362 return PSICONV_E_OTHER;
363}
364
365
338psiconv_formula psiconv_get_formula (psiconv_formula_list ss, int nr) 366psiconv_formula psiconv_get_formula (psiconv_formula_list ss, int nr)
339{ 367{
340 return psiconv_list_get(ss,psiconv_list_length(ss)-nr-1); 368 return psiconv_list_get(ss,psiconv_list_length(ss)-nr-1);
341} 369}
342 370
447 psiconv_free_style_aux(style); 475 psiconv_free_style_aux(style);
448 free(style); 476 free(style);
449 } 477 }
450} 478}
451 479
480void psiconv_free_word_style_list(psiconv_word_style_list style_list)
481{
482 if (style_list)
483 psiconv_list_free_el(style_list,psiconv_free_style_aux);
484}
485
452void psiconv_free_word_styles_section(psiconv_word_styles_section styles) 486void psiconv_free_word_styles_section(psiconv_word_styles_section styles)
453{ 487{
454 if (styles) { 488 if (styles) {
455 psiconv_free_word_style(styles->normal); 489 psiconv_free_word_style(styles->normal);
456 if (styles->styles) 490 psiconv_free_word_style_list(styles->styles);
457 psiconv_list_free_el(styles->styles,psiconv_free_style_aux);
458 free(styles); 491 free(styles);
459 } 492 }
460} 493}
461 494
462void psiconv_free_header_section(psiconv_header_section header) 495void psiconv_free_header_section(psiconv_header_section header)

Legend:
Removed from v.208  
changed lines
  Added in v.241

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