~ubuntu-branches/ubuntu/trusty/libwpd/trusty

« back to all changes in this revision

Viewing changes to src/lib/WP6Part.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Rene Engelhard
  • Date: 2006-07-15 11:58:12 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20060715115812-v18efmdayby4clau
Tags: 0.8.6-1
* New upstream release
* swap maintainer/uploader

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* libwpd
2
2
 * Copyright (C) 2002 William Lachance (william.lachance@sympatico.ca)
3
3
 * Copyright (C) 2002 Marc Maurer (uwog@uwog.net)
 
4
 * Copyright (C) 2006 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
35
36
// returns the part if it successfully creates the part, returns NULL if it can't
36
37
// throws an exception if there is an error
37
38
// precondition: readVal us between 0x80 and 0xFF
38
 
WP6Part * WP6Part::constructPart(WPXInputStream *input, uint8_t readVal)
 
39
WP6Part * WP6Part::constructPart(WPXInputStream *input, const uint8_t readVal)
39
40
{       
40
41
        WPD_DEBUG_MSG(("WordPerfect: ConstructPart\n"));
41
42
                
42
43
        if (readVal >= (uint8_t)0x80 && readVal <= (uint8_t)0xCF)
43
44
        {
44
 
                WPD_DEBUG_MSG(("WordPerfect: constructFixedLengthGroup(input, val)\n"));
 
45
                WPD_DEBUG_MSG(("WordPerfect: constructSingleByteFunction(input, val=0x%.2x)\n", readVal));
45
46
                return WP6SingleByteFunction::constructSingleByteFunction(input, readVal);
46
47
        }
47
48
        else if (readVal >= (uint8_t)0xD0 && readVal <= (uint8_t)0xEF)
48
49
        {
49
 
                WPD_DEBUG_MSG(("WordPerfect: constructVariableLengthGroup(input, val)\n"));
 
50
                if (!WP6VariableLengthGroup::isGroupConsistent(input, readVal))
 
51
                {
 
52
                        WPD_DEBUG_MSG(("WordPerfect: Consistency Check (variable length) failed; ignoring this byte\n"));
 
53
                        return NULL;
 
54
                }
 
55
                WPD_DEBUG_MSG(("WordPerfect: constructVariableLengthGroup(input, val=0x%.2x)\n", readVal));
50
56
                return WP6VariableLengthGroup::constructVariableLengthGroup(input, readVal);
51
57
        }      
52
58
 
53
59
        else if (readVal >= (uint8_t)0xF0)
54
60
        {
55
 
                WPD_DEBUG_MSG(("WordPerfect: constructFixedLengthGroup(input, val)\n"));
 
61
                if (!WP6FixedLengthGroup::isGroupConsistent(input, readVal))
 
62
                {
 
63
                        WPD_DEBUG_MSG(("WordPerfect: Consistency Check (fixed length) failed; ignoring this byte\n"));
 
64
                        return NULL;
 
65
                }
 
66
                WPD_DEBUG_MSG(("WordPerfect: constructFixedLengthGroup(input, val=0x%.2x)\n", readVal));
56
67
                return WP6FixedLengthGroup::constructFixedLengthGroup(input, readVal);
57
68
        }
58
69