Changeset 261073 in webkit


Ignore:
Timestamp:
May 4, 2020, 12:13:21 AM (5 years ago)
Author:
mark.lam@apple.com
Message:

Remove some unused and broken functions in Bitmap.
https://bugs.webkit.org/show_bug.cgi?id=211368

Reviewed by Yusuke Suzuki.

Bitmap::operator[] never worked. There's currently no way to use it to read a
bit value. We also can't use it to set a bit value because it relies on
Bitmap::iterator::operator= to set the value. However, Bitmap::iterator stores
the Bitmap* as a const pointer, and Bitmap::iterator::operator= calls set() on
the const pointer. If we try to use operator[] to set a bit, we'll get a
compilation error.

This patch removes the 2 variants of Bitmap::operator[] and Bitmap::iterator::operator=.

  • wtf/Bitmap.h:

(WTF::WordType>::operator): Deleted.
(WTF::WordType>::operator const const): Deleted.

Location:
trunk/Source/WTF
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r261061 r261073  
     12020-05-03  Mark Lam  <mark.lam@apple.com>
     2
     3        Remove some unused and broken functions in Bitmap.
     4        https://bugs.webkit.org/show_bug.cgi?id=211368
     5
     6        Reviewed by Yusuke Suzuki.
     7
     8        Bitmap::operator[] never worked.  There's currently no way to use it to read a
     9        bit value.  We also can't use it to set a bit value because it relies on
     10        Bitmap::iterator::operator= to set the value.  However, Bitmap::iterator stores
     11        the Bitmap* as a const pointer, and Bitmap::iterator::operator= calls set() on
     12        the const pointer.  If we try to use operator[] to set a bit, we'll get a
     13        compilation error.
     14
     15        This patch removes the 2 variants of Bitmap::operator[] and Bitmap::iterator::operator=.
     16
     17        * wtf/Bitmap.h:
     18        (WTF::WordType>::operator): Deleted.
     19        (WTF::WordType>::operator const const): Deleted.
     20
    1212020-05-03  Rob Buis  <rbuis@igalia.com>
    222
  • trunk/Source/WTF/wtf/Bitmap.h

    r261055 r261073  
    11/*
    2  *  Copyright (C) 2010-2019 Apple Inc. All rights reserved.
     2 *  Copyright (C) 2010-2020 Apple Inc. All rights reserved.
    33 *
    44 *  This library is free software; you can redistribute it and/or
     
    104104        }
    105105
    106         iterator& operator=(bool value)
    107         {
    108             m_bitmap->set(m_index, value);
    109             return *this;
    110         }
    111 
    112106    private:
    113107        const Bitmap* m_bitmap;
     
    119113    iterator end() const { return iterator(*this, bitmapSize); }
    120114   
    121     iterator operator[](size_t);
    122     const iterator operator[](size_t) const;
    123 
    124115    void mergeAndClear(Bitmap&);
    125116    void setAndClear(Bitmap&);
     
    428419
    429420template<size_t bitmapSize, typename WordType>
    430 inline auto Bitmap<bitmapSize, WordType>::operator[](size_t index) -> iterator
    431 {
    432     ASSERT(index < size());
    433     return iterator(*this, index);
    434 }
    435 
    436 template<size_t bitmapSize, typename WordType>
    437 inline auto Bitmap<bitmapSize, WordType>::operator[](size_t index) const -> const iterator
    438 {
    439     return (*const_cast<Bitmap<bitmapSize, WordType>*>(this))[index];
    440 }
    441 
    442 template<size_t bitmapSize, typename WordType>
    443421inline unsigned Bitmap<bitmapSize, WordType>::hash() const
    444422{
Note: See TracChangeset for help on using the changeset viewer.