1 | /* |
1 | /* |
2 | generate_word.c - Part of psiconv, a PSION 5 file formats converter |
2 | generate_word.c - Part of psiconv, a PSION 5 file formats converter |
3 | Copyright (c) 2000-2004 Frodo Looijaard <frodol@dds.nl> |
3 | Copyright (c) 2000-2005 Frodo Looijaard <frodo@frodo.looijaard.name> |
4 | |
4 | |
5 | This program is free software; you can redistribute it and/or modify |
5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by |
6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or |
7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. |
8 | (at your option) any later version. |
… | |
… | |
92 | res = -PSICONV_E_GENERATE; |
92 | res = -PSICONV_E_GENERATE; |
93 | goto ERROR1; |
93 | goto ERROR1; |
94 | } |
94 | } |
95 | |
95 | |
96 | if (!(basepara=psiconv_basic_paragraph_layout())) { |
96 | if (!(basepara=psiconv_basic_paragraph_layout())) { |
|
|
97 | psiconv_error(config,lev+1,0,"Out of memory error"); |
97 | res = -PSICONV_E_NOMEM; |
98 | res = -PSICONV_E_NOMEM; |
98 | goto ERROR1; |
99 | goto ERROR1; |
99 | } |
100 | } |
100 | |
101 | |
101 | if (!(basechar=psiconv_basic_character_layout())) { |
102 | if (!(basechar=psiconv_basic_character_layout())) { |
|
|
103 | psiconv_error(config,lev+1,0,"Out of memory error"); |
102 | res = -PSICONV_E_NOMEM; |
104 | res = -PSICONV_E_NOMEM; |
103 | goto ERROR2; |
105 | goto ERROR2; |
104 | } |
106 | } |
105 | |
107 | |
106 | |
108 | |
… | |
… | |
131 | |
133 | |
132 | |
134 | |
133 | |
135 | |
134 | for (i = 0; i < psiconv_list_length(value->styles); i++) { |
136 | for (i = 0; i < psiconv_list_length(value->styles); i++) { |
135 | if (!(style = psiconv_list_get(value->styles,i))) { |
137 | if (!(style = psiconv_list_get(value->styles,i))) { |
136 | psiconv_error(config,lev,0,"Massive memory corruption"); |
138 | psiconv_error(config,lev,0,"Data structure corruption"); |
137 | res = -PSICONV_E_NOMEM; |
139 | res = -PSICONV_E_NOMEM; |
138 | goto ERROR3; |
140 | goto ERROR3; |
139 | } |
141 | } |
140 | buflen = psiconv_buffer_length(buf); |
142 | buflen = psiconv_buffer_length(buf); |
141 | if ((res = psiconv_unicode_write_char(config,buf,lev+1,style->hotkey))) |
143 | if ((res = psiconv_unicode_write_char(config,buf,lev+1,style->hotkey))) |
… | |
… | |
146 | } |
148 | } |
147 | if ((res = psiconv_write_u8(config,buf,lev+1,psiconv_list_length(value->styles)))) |
149 | if ((res = psiconv_write_u8(config,buf,lev+1,psiconv_list_length(value->styles)))) |
148 | goto ERROR3; |
150 | goto ERROR3; |
149 | for (i = 0; i < psiconv_list_length(value->styles); i++) { |
151 | for (i = 0; i < psiconv_list_length(value->styles); i++) { |
150 | if (!(style = psiconv_list_get(value->styles,i))) { |
152 | if (!(style = psiconv_list_get(value->styles,i))) { |
151 | psiconv_error(config,lev,0,"Massive memory corruption"); |
153 | psiconv_error(config,lev,0,"Data structure corruption"); |
152 | res = -PSICONV_E_NOMEM; |
154 | res = -PSICONV_E_NOMEM; |
153 | goto ERROR3; |
155 | goto ERROR3; |
154 | } |
156 | } |
155 | if (!style->name) { |
157 | if (!style->name) { |
156 | psiconv_error(config,lev,0,"Null style name"); |
158 | psiconv_error(config,lev,0,"Null style name"); |