Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: src/images/SkImageDecoder_libico.cpp

Issue 1503423003: ubsan shift fixes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add cast to work around win compiler Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/effects/gradients/SkGradientShaderPriv.h ('k') | src/pathops/SkOpAngle.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkColorPriv.h" 8 #include "SkColorPriv.h"
9 #include "SkImageDecoder.h" 9 #include "SkImageDecoder.h"
10 #include "SkStream.h" 10 #include "SkStream.h"
(...skipping 14 matching lines...) Expand all
25 private: 25 private:
26 typedef SkImageDecoder INHERITED; 26 typedef SkImageDecoder INHERITED;
27 }; 27 };
28 28
29 //////////////////////////////////////////////////////////////////////////////// ///////// 29 //////////////////////////////////////////////////////////////////////////////// /////////
30 30
31 //read bytes starting from the begin-th index in the buffer 31 //read bytes starting from the begin-th index in the buffer
32 //read in Intel order, and return an integer 32 //read in Intel order, and return an integer
33 33
34 #define readByte(buffer,begin) buffer[begin] 34 #define readByte(buffer,begin) buffer[begin]
35 #define read2Bytes(buffer,begin) buffer[begin]+(buffer[begin+1]<<8) 35 #define read2Bytes(buffer,begin) buffer[begin]+SkLeftShift(buffer[begin+1],8)
36 #define read4Bytes(buffer,begin) buffer[begin]+(buffer[begin+1]<<8)+(buffer[begi n+2]<<16)+(buffer[begin+3]<<24) 36 #define read4Bytes(buffer,begin) buffer[begin]+SkLeftShift(buffer[begin+1],8)+Sk LeftShift(buffer[begin+2],16)+SkLeftShift(buffer[begin+3],24)
37 37
38 //////////////////////////////////////////////////////////////////////////////// ///////// 38 //////////////////////////////////////////////////////////////////////////////// /////////
39 39
40 SkICOImageDecoder::SkICOImageDecoder() 40 SkICOImageDecoder::SkICOImageDecoder()
41 { 41 {
42 } 42 }
43 43
44 //helpers - my function pointer will call one of these, depending on the bitCoun t, each time through the inner loop 44 //helpers - my function pointer will call one of these, depending on the bitCoun t, each time through the inner loop
45 static void editPixelBit1(const int pixelNo, const unsigned char* buf, 45 static void editPixelBit1(const int pixelNo, const unsigned char* buf,
46 const int xorOffset, int& x, int y, const int w, 46 const int xorOffset, int& x, int y, const int w,
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 static SkImageDecoder_DecodeReg gReg(sk_libico_dfactory); 443 static SkImageDecoder_DecodeReg gReg(sk_libico_dfactory);
444 444
445 static SkImageDecoder::Format get_format_ico(SkStreamRewindable* stream) { 445 static SkImageDecoder::Format get_format_ico(SkStreamRewindable* stream) {
446 if (is_ico(stream)) { 446 if (is_ico(stream)) {
447 return SkImageDecoder::kICO_Format; 447 return SkImageDecoder::kICO_Format;
448 } 448 }
449 return SkImageDecoder::kUnknown_Format; 449 return SkImageDecoder::kUnknown_Format;
450 } 450 }
451 451
452 static SkImageDecoder_FormatReg gFormatReg(get_format_ico); 452 static SkImageDecoder_FormatReg gFormatReg(get_format_ico);
OLDNEW
« no previous file with comments | « src/effects/gradients/SkGradientShaderPriv.h ('k') | src/pathops/SkOpAngle.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698