File: | home/maarten/src/libreoffice/core/filter/source/graphicfilter/icgm/class1.cxx |
Warning: | line 154, column 13 Value stored to 'nI1' is never read |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | /* |
3 | * This file is part of the LibreOffice project. |
4 | * |
5 | * This Source Code Form is subject to the terms of the Mozilla Public |
6 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
7 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
8 | * |
9 | * This file incorporates work covered by the following license notice: |
10 | * |
11 | * Licensed to the Apache Software Foundation (ASF) under one or more |
12 | * contributor license agreements. See the NOTICE file distributed |
13 | * with this work for additional information regarding copyright |
14 | * ownership. The ASF licenses this file to you under the Apache |
15 | * License, Version 2.0 (the "License"); you may not use this file |
16 | * except in compliance with the License. You may obtain a copy of |
17 | * the License at http://www.apache.org/licenses/LICENSE-2.0 . |
18 | */ |
19 | |
20 | #include <sal/config.h> |
21 | |
22 | #include <o3tl/safeint.hxx> |
23 | |
24 | #include "bundles.hxx" |
25 | #include "cgm.hxx" |
26 | #include "elements.hxx" |
27 | |
28 | |
29 | void CGM::ImplDoClass1() |
30 | { |
31 | long nInteger, nI0, nI1; |
32 | sal_uInt32 nUInteger; |
33 | |
34 | switch ( mnElementID ) |
35 | { |
36 | case 0x01 : /*Metafile Version*/ |
37 | pElement->nMetaFileVersion = ImplGetI( pElement->nIntegerPrecision ); |
38 | break; |
39 | case 0x02 : /*Metafile Description */break; |
40 | case 0x03 : /*VDC Type*/ |
41 | { |
42 | nUInteger = ImplGetUI16(); |
43 | switch( nUInteger ) |
44 | { |
45 | case 0 : pElement->eVDCType = VDC_INTEGER; break; |
46 | case 1 : pElement->eVDCType = VDC_REAL; break; |
47 | default: mbStatus = false; break; |
48 | } |
49 | } |
50 | break; |
51 | case 0x04 : /*Integer Precision*/ |
52 | { |
53 | nInteger = ImplGetI( pElement->nIntegerPrecision ); |
54 | switch ( nInteger ) |
55 | { |
56 | case 32 : |
57 | case 24 : |
58 | case 16 : |
59 | case 8 : pElement->nIntegerPrecision = nInteger >> 3; break; |
60 | default : mbStatus = false; break; |
61 | } |
62 | } |
63 | break; |
64 | case 0x05 : /*Real Precision*/ |
65 | { |
66 | nUInteger = ImplGetUI16(); |
67 | nI0 = ImplGetI( pElement->nIntegerPrecision ); // exponent |
68 | nI1 = ImplGetI( pElement->nIntegerPrecision ); // mantissa |
69 | switch( nUInteger ) |
70 | { |
71 | case 0 : |
72 | pElement->eRealPrecision = RP_FLOAT; |
73 | switch ( nI0 ) |
74 | { |
75 | case 9 : |
76 | if ( nI1 != 23 ) |
77 | mbStatus = false; |
78 | pElement->nRealSize = 4; |
79 | break; |
80 | case 12 : |
81 | if ( nI1 != 52 ) |
82 | mbStatus =false; |
83 | pElement->nRealSize = 8; |
84 | break; |
85 | default: |
86 | mbStatus = false; |
87 | break; |
88 | } |
89 | break; |
90 | case 1 : |
91 | pElement->eRealPrecision = RP_FIXED; |
92 | if ( nI0 != nI1 ) |
93 | mbStatus = false; |
94 | if ( nI0 == 16 ) |
95 | pElement->nRealSize = 4; |
96 | else if ( nI0 == 32 ) |
97 | pElement->nRealSize = 8; |
98 | else |
99 | mbStatus = false; |
100 | break; |
101 | default : |
102 | mbStatus = false; break; |
103 | } |
104 | } |
105 | break; |
106 | case 0x06 : /*Index Precision*/ |
107 | { |
108 | nInteger = ImplGetI( pElement->nIntegerPrecision ); |
109 | switch ( nInteger ) |
110 | { |
111 | case 32 : |
112 | case 24 : |
113 | case 16 : |
114 | case 8 : pElement->nIndexPrecision = nInteger >> 3; break; |
115 | default : mbStatus = false; break; |
116 | } |
117 | } |
118 | break; |
119 | case 0x07 : /*Color Precision*/ |
120 | { |
121 | nInteger = ImplGetI( pElement->nIntegerPrecision ); |
122 | switch ( nInteger ) |
123 | { |
124 | case 32 : |
125 | case 24 : |
126 | case 16 : |
127 | case 8 : pElement->nColorPrecision = nInteger >> 3; break; |
128 | default : mbStatus = false; break; |
129 | } |
130 | } |
131 | break; |
132 | case 0x08 : /*Color Index Precision*/ |
133 | { |
134 | nInteger = ImplGetI( pElement->nIntegerPrecision ); |
135 | switch ( nInteger ) |
136 | { |
137 | case 32 : |
138 | case 24 : |
139 | case 16 : |
140 | case 8 : pElement->nColorIndexPrecision = nInteger >> 3; break; |
141 | default : mbStatus = false; break; |
142 | } |
143 | } |
144 | break; |
145 | case 0x09 : /*Maximum Colour Index*/ |
146 | { |
147 | pElement->nColorMaximumIndex = ImplGetUI( pElement->nColorIndexPrecision ); |
148 | if ( ( pElement->nColorMaximumIndex > 256 /*255*/ ) || ( pElement->nColorMaximumIndex == 0 ) ) |
149 | mbStatus = false; |
150 | } |
151 | break; |
152 | case 0x0a : /*Color Value Extent*/ |
153 | { |
154 | nI1 = 6; |
Value stored to 'nI1' is never read | |
155 | } |
156 | break; |
157 | case 0x0b : /*MetaFile Element List */break; |
158 | case 0x0c : /*MetaFile Default Replacement*/ |
159 | { |
160 | if ( mnElementSize > 1 ) |
161 | { |
162 | std::unique_ptr<sal_uInt8[]> pBuf(new sal_uInt8[ mnElementSize ]); |
163 | memcpy( pBuf.get(), mpSource, mnElementSize ); |
164 | maDefRepList.push_back( std::move(pBuf) ); |
165 | maDefRepSizeList.push_back( mnElementSize ); |
166 | } |
167 | mnParaSize = mnElementSize; |
168 | } |
169 | break; |
170 | case 0x0d : /*Font List*/ |
171 | { |
172 | while ( mnParaSize < mnElementSize ) |
173 | { |
174 | sal_uInt32 nSize = ImplGetUI(1); |
175 | |
176 | if (o3tl::make_unsigned(mpEndValidSource - (mpSource + mnParaSize)) < nSize) |
177 | throw css::uno::Exception("attempt to read past end of input", nullptr); |
178 | |
179 | pElement->aFontList.InsertName( mpSource + mnParaSize, nSize ); |
180 | mnParaSize += nSize; |
181 | } |
182 | } |
183 | break; |
184 | case 0x0e : /*Character Set List*/ |
185 | { |
186 | while ( mnParaSize < mnElementSize ) |
187 | { |
188 | ImplGetUI16(); // skip CharSetType |
189 | sal_uInt32 nSize = ImplGetUI(1); |
190 | |
191 | if (o3tl::make_unsigned(mpEndValidSource - (mpSource + mnParaSize)) < nSize) |
192 | throw css::uno::Exception("attempt to read past end of input", nullptr); |
193 | |
194 | pElement->aFontList.InsertCharSet( mpSource + mnParaSize, nSize ); |
195 | mnParaSize += nSize; |
196 | } |
197 | } |
198 | break; |
199 | case 0x0f : /*Character Coding Announcer*/ |
200 | pElement->eCharacterCodingA = static_cast<CharacterCodingA>(ImplGetUI16()); |
201 | break; |
202 | case 0x10 : /*Name Precision */break; // NS |
203 | case 0x11 : /*Maximum VDC Extent */break; // NS |
204 | case 0x12 : /*Segment Priority Extent */break; // NS |
205 | case 0x13 : /*Color Model */break; // NS |
206 | case 0x14 : /*Color Calibration */break; // NS |
207 | case 0x15 : /*Font Properties */break; // NS |
208 | case 0x16 : /*Glyph Mapping */break; // NS |
209 | case 0x17 : /*Symbol Library List */break; // NS |
210 | case 0xfc : /*Inquire Function Support */break; |
211 | case 0xfa : /*End Metafile Defaults Replacement */break; |
212 | case 0xf8 : /*Set Color Value Desc Extent */break; |
213 | default: break; |
214 | } |
215 | }; |
216 | |
217 | |
218 | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |