Chromium Code Reviews

Unified Diff: webrtc/system_wrappers/interface/aligned_array.h

Issue 1238083005: [NOT FOR REVIEW] Convert channel counts to size_t. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@size_t
Patch Set: Checkpoint Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Index: webrtc/system_wrappers/interface/aligned_array.h
diff --git a/webrtc/system_wrappers/interface/aligned_array.h b/webrtc/system_wrappers/interface/aligned_array.h
index 3648c7c1940dc153892bf864d363209ada17bb53..5e961343f7f5c3a195ac94e8bee53c7a1ee9af14 100644
--- a/webrtc/system_wrappers/interface/aligned_array.h
+++ b/webrtc/system_wrappers/interface/aligned_array.h
@@ -20,21 +20,20 @@ namespace webrtc {
// aligned to the given byte alignment.
template<typename T> class AlignedArray {
public:
- AlignedArray(int rows, size_t cols, int alignment)
+ AlignedArray(size_t rows, size_t cols, size_t alignment)
: rows_(rows),
- cols_(cols),
- alignment_(alignment) {
- CHECK_GT(alignment_, 0);
+ cols_(cols) {
+ CHECK_GT(alignment, 0u);
head_row_ = static_cast<T**>(AlignedMalloc(rows_ * sizeof(*head_row_),
- alignment_));
- for (int i = 0; i < rows_; ++i) {
+ alignment));
+ for (size_t i = 0; i < rows_; ++i) {
head_row_[i] = static_cast<T*>(AlignedMalloc(cols_ * sizeof(**head_row_),
- alignment_));
+ alignment));
}
}
~AlignedArray() {
- for (int i = 0; i < rows_; ++i) {
+ for (size_t i = 0; i < rows_; ++i) {
AlignedFree(head_row_[i]);
}
AlignedFree(head_row_);
@@ -48,27 +47,27 @@ template<typename T> class AlignedArray {
return head_row_;
}
- T* Row(int row) {
+ T* Row(size_t row) {
CHECK_LE(row, rows_);
return head_row_[row];
}
- const T* Row(int row) const {
+ const T* Row(size_t row) const {
CHECK_LE(row, rows_);
return head_row_[row];
}
- T& At(int row, size_t col) {
+ T& At(size_t row, size_t col) {
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 {
CHECK_LE(col, cols_);
return Row(row)[col];
}
- int rows() const {
+ size_t rows() const {
return rows_;
}
@@ -77,9 +76,8 @@ template<typename T> class AlignedArray {
}
private:
- int rows_;
+ size_t rows_;
size_t cols_;
- int alignment_;
T** head_row_;
};
« no previous file with comments | « webrtc/modules/rtp_rtcp/test/testAPI/test_api_audio.cc ('k') | webrtc/system_wrappers/source/aligned_array_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine