~ubuntu-branches/ubuntu/saucy/libwpd/saucy

« back to all changes in this revision

Viewing changes to src/lib/WP6ExtendedDocumentSummaryPacket.cpp

  • Committer: Package Import Robot
  • Author(s): Rene Engelhard
  • Date: 2011-11-29 23:31:13 UTC
  • mfrom: (1.2.5)
  • Revision ID: package-import@ubuntu.com-20111129233113-xdtwca9h0y6wdxst
Tags: 0.9.4-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
1
2
/* libwpd
2
3
 * Copyright (C) 2002 William Lachance (wrlach@gmail.com)
3
4
 * Copyright (C) 2002 Marc Maurer (uwog@uwog.net)
4
5
 * Copyright (C) 2006 Fridrich Strba (fridrich.strba@bluewin.ch)
5
 
 *  
 
6
 *
6
7
 * This library is free software; you can redistribute it and/or
7
8
 * modify it under the terms of the GNU Library General Public
8
9
 * License as published by the Free Software Foundation; either
20
21
 * For further information visit http://libwpd.sourceforge.net
21
22
 */
22
23
 
23
 
/* "This product is not manufactured, approved, or supported by 
 
24
/* "This product is not manufactured, approved, or supported by
24
25
 * Corel Corporation or Corel Corporation Limited."
25
26
 */
26
27
#include <string.h>
34
35
        m_dataSize(dataSize),
35
36
        m_streamData(0),
36
37
        m_stream(0)
37
 
{       
 
38
{
38
39
        if (dataSize > 0)
39
40
                _read(input, encryption, dataOffset, dataSize);
40
41
}
56
57
        m_streamData = new uint8_t[m_dataSize];
57
58
        for(unsigned i=0; i<(unsigned)m_dataSize; i++)
58
59
                m_streamData[i] = readU8(input, encryption);
59
 
        
 
60
 
60
61
        m_stream = new WPXMemoryInputStream(m_streamData, (unsigned long)m_dataSize);
61
62
}
62
63
 
94
95
                        uint8_t characterSet = (uint8_t)((wpChar >> 8) & 0x00FF);
95
96
                        const uint32_t *chars;
96
97
                        int len = extendedCharacterWP6ToUCS4(character,
97
 
                                                      characterSet, &chars);
 
98
                                                             characterSet, &chars);
98
99
                        for (int j = 0; j < len; j++)
99
100
                                appendUCS4(name, chars[j]);
100
 
                } 
101
 
                
 
101
                }
 
102
 
102
103
                if (tagID == WP6_INDEX_HEADER_EXTENDED_DOCUMENT_SUMMARY_CREATION_DATE ||
103
 
                    tagID == WP6_INDEX_HEADER_EXTENDED_DOCUMENT_SUMMARY_DATE_COMPLETED ||
104
 
                    tagID == WP6_INDEX_HEADER_EXTENDED_DOCUMENT_SUMMARY_RECORDED_DATE ||
105
 
                    tagID == WP6_INDEX_HEADER_EXTENDED_DOCUMENT_SUMMARY_REVISION_DATE ||
106
 
                    tagID == WP6_INDEX_HEADER_EXTENDED_DOCUMENT_SUMMARY_VERSION_DATE)
 
104
                        tagID == WP6_INDEX_HEADER_EXTENDED_DOCUMENT_SUMMARY_DATE_COMPLETED ||
 
105
                        tagID == WP6_INDEX_HEADER_EXTENDED_DOCUMENT_SUMMARY_RECORDED_DATE ||
 
106
                        tagID == WP6_INDEX_HEADER_EXTENDED_DOCUMENT_SUMMARY_REVISION_DATE ||
 
107
                        tagID == WP6_INDEX_HEADER_EXTENDED_DOCUMENT_SUMMARY_VERSION_DATE)
107
108
                {
108
109
                        try
109
110
                        {
130
131
                        if (!m_stream->atEOS())
131
132
                                wpChar = readU16(m_stream, 0);
132
133
                        for (; wpChar != 0 && !m_stream->atEOS(); wpChar = readU16(m_stream, 0))
133
 
                        {                               
 
134
                        {
134
135
                                uint8_t character = (uint8_t)(wpChar & 0x00FF);
135
136
                                uint8_t characterSet = (uint8_t)((wpChar >> 8) & 0x00FF);
136
137
                                const uint32_t *chars;
137
138
                                int len = extendedCharacterWP6ToUCS4(character,
138
 
                                                      characterSet, &chars);
 
139
                                                                     characterSet, &chars);
139
140
                                for (int j = 0; j < len; j++)
140
141
                                        appendUCS4(data, chars[j]);
141
142
                        }
145
146
                m_stream->seek((i+groupLength), WPX_SEEK_SET);
146
147
        }
147
148
}
 
149
/* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */