| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -138,35 +138,35 @@ static void MaybeStackBufferBasic() { | |||
| 138 | 138 | size_t old_length; | |
| 139 | 139 | size_t old_capacity; | |
| 140 | 140 | ||
| 141 | - /* Default constructor */ | ||
| 141 | + // Default constructor. | ||
| 142 | 142 | EXPECT_EQ(0U, buf.length()); | |
| 143 | 143 | EXPECT_FALSE(buf.IsAllocated()); | |
| 144 | 144 | EXPECT_GT(buf.capacity(), buf.length()); | |
| 145 | 145 | ||
| 146 | - /* SetLength() expansion */ | ||
| 146 | + // SetLength() expansion. | ||
| 147 | 147 | buf.SetLength(buf.capacity()); | |
| 148 | 148 | EXPECT_EQ(buf.capacity(), buf.length()); | |
| 149 | 149 | EXPECT_FALSE(buf.IsAllocated()); | |
| 150 | 150 | ||
| 151 | - /* Means of accessing raw buffer */ | ||
| 151 | + // Means of accessing raw buffer. | ||
| 152 | 152 | EXPECT_EQ(buf.out(), *buf); | |
| 153 | 153 | EXPECT_EQ(&buf[0], *buf); | |
| 154 | 154 | ||
| 155 | - /* Basic I/O */ | ||
| 155 | + // Basic I/O. | ||
| 156 | 156 | for (size_t i = 0; i < buf.length(); i++) | |
| 157 | 157 | buf[i] = static_cast<T>(i); | |
| 158 | 158 | for (size_t i = 0; i < buf.length(); i++) | |
| 159 | 159 | EXPECT_EQ(static_cast<T>(i), buf[i]); | |
| 160 | 160 | ||
| 161 | - /* SetLengthAndZeroTerminate() */ | ||
| 161 | + // SetLengthAndZeroTerminate(). | ||
| 162 | 162 | buf.SetLengthAndZeroTerminate(buf.capacity() - 1); | |
| 163 | 163 | EXPECT_EQ(buf.capacity() - 1, buf.length()); | |
| 164 | 164 | for (size_t i = 0; i < buf.length(); i++) | |
| 165 | 165 | EXPECT_EQ(static_cast<T>(i), buf[i]); | |
| 166 | 166 | buf.SetLength(buf.capacity()); | |
| 167 | 167 | EXPECT_EQ(0, buf[buf.length() - 1]); | |
| 168 | 168 | ||
| 169 | - /* Initial Realloc */ | ||
| 169 | + // Initial Realloc. | ||
| 170 | 170 | old_length = buf.length() - 1; | |
| 171 | 171 | old_capacity = buf.capacity(); | |
| 172 | 172 | buf.AllocateSufficientStorage(buf.capacity() * 2); | |
@@ -176,7 +176,7 @@ static void MaybeStackBufferBasic() { | |||
| 176 | 176 | EXPECT_EQ(static_cast<T>(i), buf[i]); | |
| 177 | 177 | EXPECT_EQ(0, buf[old_length]); | |
| 178 | 178 | ||
| 179 | - /* SetLength() reduction and expansion */ | ||
| 179 | + // SetLength() reduction and expansion. | ||
| 180 | 180 | for (size_t i = 0; i < buf.length(); i++) | |
| 181 | 181 | buf[i] = static_cast<T>(i); | |
| 182 | 182 | buf.SetLength(10); | |
@@ -186,7 +186,7 @@ static void MaybeStackBufferBasic() { | |||
| 186 | 186 | for (size_t i = 0; i < buf.length(); i++) | |
| 187 | 187 | EXPECT_EQ(static_cast<T>(i), buf[i]); | |
| 188 | 188 | ||
| 189 | - /* Subsequent Realloc */ | ||
| 189 | + // Subsequent Realloc. | ||
| 190 | 190 | old_length = buf.length(); | |
| 191 | 191 | old_capacity = buf.capacity(); | |
| 192 | 192 | buf.AllocateSufficientStorage(old_capacity * 1.5); | |
@@ -196,13 +196,13 @@ static void MaybeStackBufferBasic() { | |||
| 196 | 196 | for (size_t i = 0; i < old_length; i++) | |
| 197 | 197 | EXPECT_EQ(static_cast<T>(i), buf[i]); | |
| 198 | 198 | ||
| 199 | - /* Basic I/O on Realloc'd buffer */ | ||
| 199 | + // Basic I/O on Realloc'd buffer. | ||
| 200 | 200 | for (size_t i = 0; i < buf.length(); i++) | |
| 201 | 201 | buf[i] = static_cast<T>(i); | |
| 202 | 202 | for (size_t i = 0; i < buf.length(); i++) | |
| 203 | 203 | EXPECT_EQ(static_cast<T>(i), buf[i]); | |
| 204 | 204 | ||
| 205 | - /* Release() */ | ||
| 205 | + // Release(). | ||
| 206 | 206 | T* rawbuf = buf.out(); | |
| 207 | 207 | buf.Release(); | |
| 208 | 208 | EXPECT_EQ(0U, buf.length()); | |
@@ -215,7 +215,7 @@ TEST(UtilTest, MaybeStackBuffer) { | |||
| 215 | 215 | MaybeStackBufferBasic<uint8_t>(); | |
| 216 | 216 | MaybeStackBufferBasic<uint16_t>(); | |
| 217 | 217 | ||
| 218 | - // Constructor with size parameter | ||
| 218 | + // Constructor with size parameter. | ||
| 219 | 219 | { | |
| 220 | 220 | MaybeStackBuffer<unsigned char> buf(100); | |
| 221 | 221 | EXPECT_EQ(100U, buf.length()); | |
@@ -239,7 +239,7 @@ TEST(UtilTest, MaybeStackBuffer) { | |||
| 239 | 239 | EXPECT_EQ(static_cast<unsigned char>(i), bigbuf[i]); | |
| 240 | 240 | } | |
| 241 | 241 | ||
| 242 | - // Invalidated buffer | ||
| 242 | + // Invalidated buffer. | ||
| 243 | 243 | { | |
| 244 | 244 | MaybeStackBuffer<char> buf; | |
| 245 | 245 | buf.Invalidate(); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments