1e507721000647a7d8afe44c63ef7fd04ef8971b1Ruben Brunk/* 2e507721000647a7d8afe44c63ef7fd04ef8971b1Ruben Brunk * Copyright 2014 The Android Open Source Project 3e507721000647a7d8afe44c63ef7fd04ef8971b1Ruben Brunk * 4e507721000647a7d8afe44c63ef7fd04ef8971b1Ruben Brunk * Licensed under the Apache License, Version 2.0 (the "License"); 5e507721000647a7d8afe44c63ef7fd04ef8971b1Ruben Brunk * you may not use this file except in compliance with the License. 6e507721000647a7d8afe44c63ef7fd04ef8971b1Ruben Brunk * You may obtain a copy of the License at 7e507721000647a7d8afe44c63ef7fd04ef8971b1Ruben Brunk * 8e507721000647a7d8afe44c63ef7fd04ef8971b1Ruben Brunk * http://www.apache.org/licenses/LICENSE-2.0 9e507721000647a7d8afe44c63ef7fd04ef8971b1Ruben Brunk * 10e507721000647a7d8afe44c63ef7fd04ef8971b1Ruben Brunk * Unless required by applicable law or agreed to in writing, software 11e507721000647a7d8afe44c63ef7fd04ef8971b1Ruben Brunk * distributed under the License is distributed on an "AS IS" BASIS, 12e507721000647a7d8afe44c63ef7fd04ef8971b1Ruben Brunk * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13e507721000647a7d8afe44c63ef7fd04ef8971b1Ruben Brunk * See the License for the specific language governing permissions and 14e507721000647a7d8afe44c63ef7fd04ef8971b1Ruben Brunk * limitations under the License. 15e507721000647a7d8afe44c63ef7fd04ef8971b1Ruben Brunk */ 16e507721000647a7d8afe44c63ef7fd04ef8971b1Ruben Brunk 17e507721000647a7d8afe44c63ef7fd04ef8971b1Ruben Brunk#include <img_utils/SortedEntryVector.h> 18e507721000647a7d8afe44c63ef7fd04ef8971b1Ruben Brunk 19e507721000647a7d8afe44c63ef7fd04ef8971b1Ruben Brunk#include <utils/TypeHelpers.h> 20e507721000647a7d8afe44c63ef7fd04ef8971b1Ruben Brunk#include <utils/Log.h> 21e507721000647a7d8afe44c63ef7fd04ef8971b1Ruben Brunk 22e507721000647a7d8afe44c63ef7fd04ef8971b1Ruben Brunknamespace android { 23e507721000647a7d8afe44c63ef7fd04ef8971b1Ruben Brunknamespace img_utils { 24e507721000647a7d8afe44c63ef7fd04ef8971b1Ruben Brunk 25e507721000647a7d8afe44c63ef7fd04ef8971b1Ruben BrunkSortedEntryVector::~SortedEntryVector() {} 26e507721000647a7d8afe44c63ef7fd04ef8971b1Ruben Brunk 27e507721000647a7d8afe44c63ef7fd04ef8971b1Ruben Brunkssize_t SortedEntryVector::indexOfTag(uint16_t tag) const { 28e507721000647a7d8afe44c63ef7fd04ef8971b1Ruben Brunk // TODO: Use binary search here. 29e507721000647a7d8afe44c63ef7fd04ef8971b1Ruben Brunk for (size_t i = 0; i < size(); ++i) { 30e507721000647a7d8afe44c63ef7fd04ef8971b1Ruben Brunk if (itemAt(i)->getTag() == tag) { 31e507721000647a7d8afe44c63ef7fd04ef8971b1Ruben Brunk return i; 32e507721000647a7d8afe44c63ef7fd04ef8971b1Ruben Brunk } 33e507721000647a7d8afe44c63ef7fd04ef8971b1Ruben Brunk } 34e507721000647a7d8afe44c63ef7fd04ef8971b1Ruben Brunk return -1; 35e507721000647a7d8afe44c63ef7fd04ef8971b1Ruben Brunk} 36e507721000647a7d8afe44c63ef7fd04ef8971b1Ruben Brunk 37e507721000647a7d8afe44c63ef7fd04ef8971b1Ruben Brunkint SortedEntryVector::do_compare(const void* lhs, const void* rhs) const { 38e507721000647a7d8afe44c63ef7fd04ef8971b1Ruben Brunk const sp<TiffEntry>* lEntry = reinterpret_cast<const sp<TiffEntry>*>(lhs); 39e507721000647a7d8afe44c63ef7fd04ef8971b1Ruben Brunk const sp<TiffEntry>* rEntry = reinterpret_cast<const sp<TiffEntry>*>(rhs); 40e507721000647a7d8afe44c63ef7fd04ef8971b1Ruben Brunk return compare_type(**lEntry, **rEntry); 41e507721000647a7d8afe44c63ef7fd04ef8971b1Ruben Brunk} 42e507721000647a7d8afe44c63ef7fd04ef8971b1Ruben Brunk 43e507721000647a7d8afe44c63ef7fd04ef8971b1Ruben Brunk} /*namespace img_utils*/ 44e507721000647a7d8afe44c63ef7fd04ef8971b1Ruben Brunk} /*namespace android*/ 45