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

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

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

Revision 94 Revision 95
180 return -PSICONV_E_NOMEM; 180 return -PSICONV_E_NOMEM;
181 else 181 else
182 return res; 182 return res;
183} 183}
184 184
185int psiconv_parse_sheet_workbook_section(const psiconv_buffer buf, int lev,
186 psiconv_u32 off, int *length,
187 psiconv_sheet_workbook_section *result)
188{
189 int res=0;
190 psiconv_u32 temp;
191 int len=0;
192
193 psiconv_progress(lev+1,off,"Going to read the sheet workbook section");
194 if (!(*result = malloc(sizeof(**result))))
195 goto ERROR1;
196
197 psiconv_progress(lev+2,off+len,
198 "Going to read the initial byte (%02x expected)",0x04);
199 temp = psiconv_read_u8(buf,lev+2,off+len,&res);
200 if (res)
201 goto ERROR2;
202 if (temp != 0x04) {
203 psiconv_warn(lev+2,off+len,
204 "Sheet workbook section initial byte unknown value (ignored)");
205 psiconv_debug(lev+2,off+len,"Initial byte: %02x",temp);
206 }
207 len ++;
208
209 psiconv_progress(lev+2,off+len,
210 "Going to read the offset of the 1st ??? Section");
211 temp = psiconv_read_u32(buf,lev+2,off+len,&res);
212 if (res)
213 goto ERROR2;
214 psiconv_debug(lev+2,off+len,"Offset: %04x",temp);
215 len += 4;
216
217 psiconv_progress(lev+2,off+len,
218 "Going to read the offset of the 2nd ??? Section");
219 temp = psiconv_read_u32(buf,lev+2,off+len,&res);
220 if (res)
221 goto ERROR2;
222 psiconv_debug(lev+2,off+len,"Offset: %04x",temp);
223 len += 4;
224
225 psiconv_progress(lev+2,off+len,
226 "Going to read the offset of the 3rd ??? Section");
227 temp = psiconv_read_u32(buf,lev+2,off+len,&res);
228 if (res)
229 goto ERROR2;
230 psiconv_debug(lev+2,off+len,"Offset: %04x",temp);
231 len += 4;
232
233 psiconv_progress(lev+2,off+len,
234 "Going to read the offset of the 4th ??? Section");
235 temp = psiconv_read_u32(buf,lev+2,off+len,&res);
236 if (res)
237 goto ERROR2;
238 psiconv_debug(lev+2,off+len,"Offset: %04x",temp);
239 len += 4;
240
241 if (length)
242 *length = len;
243
244 psiconv_progress(lev,off+len-1,
245 "End of sheet workbook section (total length: %08x)", len);
246 return 0;
247
248ERROR2:
249 free (*result);
250ERROR1:
251 psiconv_warn(lev+1,off,"Reading of Sheet Workbook Section failed");
252 if (length)
253 *length = 0;
254 if (!res)
255 return -PSICONV_E_NOMEM;
256 else
257 return res;
258}

Legend:
Removed from v.94  
changed lines
  Added in v.95

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