From aa537d4bdb2384cdcd0644a02a2ab7fb0ecdd3b3 Mon Sep 17 00:00:00 2001 From: "commit-bot@chromium.org" Date: Thu, 28 Feb 2013 19:03:13 +0000 Subject: Make SkTDArray accessors const-friendly. This change creates const and non-const versions of SkTDArray::begin(), end(), operator[]() and getAt(). This will keep us from inadvertently changing a const SkTDArray, which the previous signatures allowed. Review URL: https://chromiumcodereview.appspot.com/12315131 git-svn-id: http://skia.googlecode.com/svn/trunk@7902 2bbb7eff-a529-9590-31e7-b0007b416f81 --- src/core/SkPathHeap.cpp | 4 ++-- src/core/SkPictureFlat.h | 2 +- src/gpu/GrTHashCache.h | 1 + src/images/SkImageDecoder_libbmp.cpp | 2 +- src/pdf/SkPDFDocument.cpp | 2 +- src/pdf/SkPDFFont.cpp | 2 +- src/pdf/SkPDFFont.h | 2 +- src/pdf/SkPDFTypes.cpp | 2 +- src/pdf/SkPDFTypes.h | 4 ++-- 9 files changed, 11 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/core/SkPathHeap.cpp b/src/core/SkPathHeap.cpp index b8ca40b4ef..12db3c482f 100644 --- a/src/core/SkPathHeap.cpp +++ b/src/core/SkPathHeap.cpp @@ -54,8 +54,8 @@ void SkPathHeap::flatten(SkFlattenableWriteBuffer& buffer) const { int count = fPaths.count(); buffer.writeInt(count); - SkPath** iter = fPaths.begin(); - SkPath** stop = fPaths.end(); + SkPath* const* iter = fPaths.begin(); + SkPath* const* stop = fPaths.end(); while (iter < stop) { buffer.writePath(**iter); iter++; diff --git a/src/core/SkPictureFlat.h b/src/core/SkPictureFlat.h index a9db48d96c..89b8e547e3 100644 --- a/src/core/SkPictureFlat.h +++ b/src/core/SkPictureFlat.h @@ -530,7 +530,7 @@ protected: private: void unflattenIntoArray(T* array) const { const int count = fData.count(); - const SkFlatData** iter = fData.begin(); + const SkFlatData* const* iter = fData.begin(); for (int i = 0; i < count; ++i) { const SkFlatData* element = iter[i]; int index = element->index() - 1; diff --git a/src/gpu/GrTHashCache.h b/src/gpu/GrTHashCache.h index b73b5748f5..3427ffe4c2 100644 --- a/src/gpu/GrTHashCache.h +++ b/src/gpu/GrTHashCache.h @@ -60,6 +60,7 @@ public: // testing const SkTDArray& getArray() const { return fSorted; } + SkTDArray& getArray() { return fSorted; } private: enum { kHashCount = 1 << kHashBits, diff --git a/src/images/SkImageDecoder_libbmp.cpp b/src/images/SkImageDecoder_libbmp.cpp index 2cbdcc33f0..3aa834a6b5 100644 --- a/src/images/SkImageDecoder_libbmp.cpp +++ b/src/images/SkImageDecoder_libbmp.cpp @@ -68,7 +68,7 @@ public: int width() const { return fWidth; } int height() const { return fHeight; } - uint8_t* rgb() const { return fRGB.begin(); } + const uint8_t* rgb() const { return fRGB.begin(); } private: SkTDArray fRGB; diff --git a/src/pdf/SkPDFDocument.cpp b/src/pdf/SkPDFDocument.cpp index c7266d8454..4c66c6bb90 100644 --- a/src/pdf/SkPDFDocument.cpp +++ b/src/pdf/SkPDFDocument.cpp @@ -43,7 +43,7 @@ static void perform_font_subsetting(SkPDFCatalog* catalog, usage.merge(pages[i]->getFontGlyphUsage()); } SkPDFGlyphSetMap::F2BIter iterator(usage); - SkPDFGlyphSetMap::FontGlyphSetPair* entry = iterator.next(); + const SkPDFGlyphSetMap::FontGlyphSetPair* entry = iterator.next(); while (entry) { SkPDFFont* subsetFont = entry->fFont->getFontSubset(entry->fGlyphSet); diff --git a/src/pdf/SkPDFFont.cpp b/src/pdf/SkPDFFont.cpp index 89b4fc9ac7..3d7902d240 100644 --- a/src/pdf/SkPDFFont.cpp +++ b/src/pdf/SkPDFFont.cpp @@ -624,7 +624,7 @@ SkPDFGlyphSetMap::F2BIter::F2BIter(const SkPDFGlyphSetMap& map) { reset(map); } -SkPDFGlyphSetMap::FontGlyphSetPair* SkPDFGlyphSetMap::F2BIter::next() const { +const SkPDFGlyphSetMap::FontGlyphSetPair* SkPDFGlyphSetMap::F2BIter::next() const { if (fIndex >= fMap->count()) { return NULL; } diff --git a/src/pdf/SkPDFFont.h b/src/pdf/SkPDFFont.h index 693b911061..847a2af4b5 100644 --- a/src/pdf/SkPDFFont.h +++ b/src/pdf/SkPDFFont.h @@ -49,7 +49,7 @@ public: class F2BIter { public: explicit F2BIter(const SkPDFGlyphSetMap& map); - FontGlyphSetPair* next() const; + const FontGlyphSetPair* next() const; void reset(const SkPDFGlyphSetMap& map); private: diff --git a/src/pdf/SkPDFTypes.cpp b/src/pdf/SkPDFTypes.cpp index 59250c8534..d479a22432 100644 --- a/src/pdf/SkPDFTypes.cpp +++ b/src/pdf/SkPDFTypes.cpp @@ -483,7 +483,7 @@ SkPDFDict::Iter::Iter(const SkPDFDict& dict) SkPDFName* SkPDFDict::Iter::next(SkPDFObject** value) { if (fIter != fStop) { - Rec* cur = fIter; + const Rec* cur = fIter; fIter++; *value = cur->value; return cur->key; diff --git a/src/pdf/SkPDFTypes.h b/src/pdf/SkPDFTypes.h index 03799d0845..98223aeb56 100644 --- a/src/pdf/SkPDFTypes.h +++ b/src/pdf/SkPDFTypes.h @@ -419,8 +419,8 @@ public: SkPDFName* next(SkPDFObject** value); private: - Rec* fIter; - Rec* fStop; + const Rec* fIter; + const Rec* fStop; }; private: -- cgit v1.2.3