Convert channel counts to size_t.

IIRC, this was originally requested by ajm during review of the other size_t conversions I did over the past year, and I agreed it made sense, but wanted to do it separately since those changes were already gargantuan.

BUG=chromium:81439
TEST=none
R=henrik.lundin@webrtc.org, henrika@webrtc.org, kjellander@webrtc.org, minyue@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org

Review URL: https://codereview.webrtc.org/1316523002 .

Cr-Commit-Position: refs/heads/master@{#11229}
This commit is contained in:
Peter Kasting
2016-01-12 16:26:35 -08:00
parent 92e677a1f8
commit 6955870806
190 changed files with 892 additions and 868 deletions

View File

@ -20,20 +20,20 @@ namespace webrtc {
// aligned to the given byte alignment.
template<typename T> class AlignedArray {
public:
AlignedArray(int rows, size_t cols, size_t alignment)
AlignedArray(size_t rows, size_t cols, size_t alignment)
: rows_(rows),
cols_(cols) {
RTC_CHECK_GT(alignment, 0u);
head_row_ = static_cast<T**>(AlignedMalloc(rows_ * sizeof(*head_row_),
alignment));
for (int i = 0; i < rows_; ++i) {
for (size_t i = 0; i < rows_; ++i) {
head_row_[i] = static_cast<T*>(AlignedMalloc(cols_ * sizeof(**head_row_),
alignment));
}
}
~AlignedArray() {
for (int i = 0; i < rows_; ++i) {
for (size_t i = 0; i < rows_; ++i) {
AlignedFree(head_row_[i]);
}
AlignedFree(head_row_);
@ -47,27 +47,27 @@ template<typename T> class AlignedArray {
return head_row_;
}
T* Row(int row) {
T* Row(size_t row) {
RTC_CHECK_LE(row, rows_);
return head_row_[row];
}
const T* Row(int row) const {
const T* Row(size_t row) const {
RTC_CHECK_LE(row, rows_);
return head_row_[row];
}
T& At(int row, size_t col) {
T& At(size_t row, size_t col) {
RTC_CHECK_LE(col, cols_);
return Row(row)[col];
}
const T& At(int row, size_t col) const {
const T& At(size_t row, size_t col) const {
RTC_CHECK_LE(col, cols_);
return Row(row)[col];
}
int rows() const {
size_t rows() const {
return rows_;
}
@ -76,7 +76,7 @@ template<typename T> class AlignedArray {
}
private:
int rows_;
size_t rows_;
size_t cols_;
T** head_row_;
};