~ubuntu-branches/ubuntu/edgy/libwpd/edgy-security

« back to all changes in this revision

Viewing changes to src/lib/WP5FixedLengthGroup.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Rene Engelhard
  • Date: 2005-07-03 20:55:49 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20050703205549-t8o91w9rgd7yb3qf
Tags: 0.8.2-2
* C++ ABI transition
  - rename libwpd8 / libwpd-stream8 to ...8c2 and replace/conflict (with)
    the old library. Change debian/rules, *.files and .shlibs for the new
    package names

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* libwpd
2
2
 * Copyright (C) 2003 William Lachance (william.lachance@sympatico.ca)
3
3
 * Copyright (C) 2003 Marc Maurer (j.m.maurer@student.utwente.nl)
 
4
 * Copyright (C) 2004 Fridrich Strba (fridrich.strba@bluewin.ch)
4
5
 *  
5
6
 * This library is free software; you can redistribute it and/or
6
7
 * modify it under the terms of the GNU Lesser General Public
26
27
#include "WP5FixedLengthGroup.h"
27
28
#include "WP5FileStructure.h"
28
29
#include "WP5AttributeGroup.h"
 
30
#include "WP5ExtendedCharacterGroup.h"
29
31
#include "WP5UnsupportedFixedLengthGroup.h"
30
32
#include "libwpd_internal.h"
31
33
 
32
 
WP5FixedLengthGroup::WP5FixedLengthGroup(guint groupID)
 
34
WP5FixedLengthGroup::WP5FixedLengthGroup(int groupID)
33
35
        : m_group(groupID)
34
36
{
35
37
}
36
38
 
37
 
WP5FixedLengthGroup * WP5FixedLengthGroup::constructFixedLengthGroup(GsfInput *input, guint8 groupID)
 
39
WP5FixedLengthGroup * WP5FixedLengthGroup::constructFixedLengthGroup(WPXInputStream *input, uint8_t groupID)
38
40
{
39
41
        switch (groupID) 
40
42
        {
 
43
                case WP5_TOP_EXTENDED_CHARACTER:
 
44
                        return new WP5ExtendedCharacterGroup(input, groupID);
 
45
                        
41
46
                case WP5_TOP_ATTRIBUTE_ON:
42
47
                        return new WP5AttributeOnGroup(input, groupID);
43
48
                        
50
55
        }
51
56
}
52
57
 
53
 
void WP5FixedLengthGroup::_read(GsfInput *input)
 
58
void WP5FixedLengthGroup::_read(WPXInputStream *input)
54
59
{
55
 
        guint32 startPosition = gsf_input_tell(input);
 
60
        uint32_t startPosition = input->tell();
56
61
        _readContents(input);
57
62
        
58
63
        if (m_group >= 0xC0 && m_group <= 0xCF) // just an extra safety check
59
64
        {
60
65
                int size = WP5_FIXED_LENGTH_FUNCTION_GROUP_SIZE[m_group-0xC0];
61
 
                WPD_CHECK_FILE_SEEK_ERROR(gsf_input_seek(input, (startPosition + size - 1 - gsf_input_tell(input)), G_SEEK_CUR));
 
66
                input->seek((startPosition + size - 1 - input->tell()), WPX_SEEK_CUR);
62
67
        }
63
68
        else
64
69
                throw FileException();