OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #define WIN32_LEAN_AND_MEAN | 10 #define WIN32_LEAN_AND_MEAN |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 this->fLocation.QuadPart += skipped; | 169 this->fLocation.QuadPart += skipped; |
170 if (skipped != liDistanceToMove.QuadPart) { | 170 if (skipped != liDistanceToMove.QuadPart) { |
171 hr = E_FAIL; | 171 hr = E_FAIL; |
172 } | 172 } |
173 break; | 173 break; |
174 } | 174 } |
175 case STREAM_SEEK_END: { | 175 case STREAM_SEEK_END: { |
176 if (!this->fSkStream->rewind()) { | 176 if (!this->fSkStream->rewind()) { |
177 hr = E_FAIL; | 177 hr = E_FAIL; |
178 } else { | 178 } else { |
| 179 // FIXME: Should not depend on getLength. |
| 180 // See https://code.google.com/p/skia/issues/detail?id=1570 |
179 LONGLONG skip = this->fSkStream->getLength() | 181 LONGLONG skip = this->fSkStream->getLength() |
180 + liDistanceToMove.QuadPart; | 182 + liDistanceToMove.QuadPart; |
181 size_t skipped = this->fSkStream->skip(static_cast<size_t>(skip)); | 183 size_t skipped = this->fSkStream->skip(static_cast<size_t>(skip)); |
182 this->fLocation.QuadPart = skipped; | 184 this->fLocation.QuadPart = skipped; |
183 if (skipped != skip) { | 185 if (skipped != skip) { |
184 hr = E_FAIL; | 186 hr = E_FAIL; |
185 } | 187 } |
186 } | 188 } |
187 break; | 189 break; |
188 } | 190 } |
189 default: | 191 default: |
190 hr = STG_E_INVALIDFUNCTION; | 192 hr = STG_E_INVALIDFUNCTION; |
191 break; | 193 break; |
192 } | 194 } |
193 | 195 |
194 if (NULL != lpNewFilePointer) { | 196 if (NULL != lpNewFilePointer) { |
195 lpNewFilePointer->QuadPart = this->fLocation.QuadPart; | 197 lpNewFilePointer->QuadPart = this->fLocation.QuadPart; |
196 } | 198 } |
197 return hr; | 199 return hr; |
198 } | 200 } |
199 | 201 |
200 HRESULT STDMETHODCALLTYPE SkIStream::Stat(STATSTG* pStatstg | 202 HRESULT STDMETHODCALLTYPE SkIStream::Stat(STATSTG* pStatstg |
201 , DWORD grfStatFlag) | 203 , DWORD grfStatFlag) |
202 { | 204 { |
203 if (0 == (grfStatFlag & STATFLAG_NONAME)) { | 205 if (0 == (grfStatFlag & STATFLAG_NONAME)) { |
204 return STG_E_INVALIDFLAG; | 206 return STG_E_INVALIDFLAG; |
205 } | 207 } |
206 pStatstg->pwcsName = NULL; | 208 pStatstg->pwcsName = NULL; |
| 209 // FIXME: Should not depend on getLength |
| 210 // See https://code.google.com/p/skia/issues/detail?id=1570 |
207 pStatstg->cbSize.QuadPart = this->fSkStream->getLength(); | 211 pStatstg->cbSize.QuadPart = this->fSkStream->getLength(); |
208 pStatstg->clsid = CLSID_NULL; | 212 pStatstg->clsid = CLSID_NULL; |
209 pStatstg->type = STGTY_STREAM; | 213 pStatstg->type = STGTY_STREAM; |
210 pStatstg->grfMode = STGM_READ; | 214 pStatstg->grfMode = STGM_READ; |
211 return S_OK; | 215 return S_OK; |
212 } | 216 } |
213 | 217 |
214 | 218 |
215 /** | 219 /** |
216 * SkIWStream | 220 * SkIWStream |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 if (0 == (grfStatFlag & STATFLAG_NONAME)) { | 265 if (0 == (grfStatFlag & STATFLAG_NONAME)) { |
262 return STG_E_INVALIDFLAG; | 266 return STG_E_INVALIDFLAG; |
263 } | 267 } |
264 pStatstg->pwcsName = NULL; | 268 pStatstg->pwcsName = NULL; |
265 pStatstg->cbSize.QuadPart = 0; | 269 pStatstg->cbSize.QuadPart = 0; |
266 pStatstg->clsid = CLSID_NULL; | 270 pStatstg->clsid = CLSID_NULL; |
267 pStatstg->type = STGTY_STREAM; | 271 pStatstg->type = STGTY_STREAM; |
268 pStatstg->grfMode = STGM_WRITE; | 272 pStatstg->grfMode = STGM_WRITE; |
269 return S_OK; | 273 return S_OK; |
270 } | 274 } |
OLD | NEW |