| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 ~CSecBuffer() { | 66 ~CSecBuffer() { |
| 67 Release(); | 67 Release(); |
| 68 } | 68 } |
| 69 | 69 |
| 70 // Frees the buffer appropriately, and re-nulls | 70 // Frees the buffer appropriately, and re-nulls |
| 71 void Release() { | 71 void Release() { |
| 72 pfnFreeBuffer(this->pvBuffer); | 72 pfnFreeBuffer(this->pvBuffer); |
| 73 Clear(); | 73 Clear(); |
| 74 } | 74 } |
| 75 | 75 |
| 76 private: | 76 // This class must not extend the size of SecBuffer, since we use arrays of |
| 77 // A placeholder function for compile-time asserts on the class | 77 // CSecBuffer in CSecBufferBundle below. |
| 78 void CompileAsserts() { | 78 static_assert(sizeof(CSecBuffer<pfnFreeBuffer>) == sizeof(SecBuffer), ""); |
| 79 // never invoked... | |
| 80 assert(false); // _T("Notreached") | |
| 81 | |
| 82 // This class must not extend the size of SecBuffer, since | |
| 83 // we use arrays of CSecBuffer in CSecBufferBundle below | |
| 84 cassert(sizeof(CSecBuffer<SSPIFree> == sizeof(SecBuffer))); | |
| 85 } | |
| 86 }; | 79 }; |
| 87 | 80 |
| 88 // Contains all generic implementation for the | 81 // Contains all generic implementation for the |
| 89 // SecBufferBundle class | 82 // SecBufferBundle class |
| 90 class SecBufferBundleBase { | 83 class SecBufferBundleBase { |
| 91 public: | 84 public: |
| 92 }; | 85 }; |
| 93 | 86 |
| 94 // A template class that bundles a SecBufferDesc with | 87 // A template class that bundles a SecBufferDesc with |
| 95 // one or more SecBuffers for convenience. Can take | 88 // one or more SecBuffers for convenience. Can take |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 // Our descriptor | 140 // Our descriptor |
| 148 SecBufferDesc desc_; | 141 SecBufferDesc desc_; |
| 149 // Our bundled buffers, each takes care of its own | 142 // Our bundled buffers, each takes care of its own |
| 150 // initialization and destruction | 143 // initialization and destruction |
| 151 CSecBuffer<pfnFreeBuffer> buffers_[num_buffers]; | 144 CSecBuffer<pfnFreeBuffer> buffers_[num_buffers]; |
| 152 }; | 145 }; |
| 153 | 146 |
| 154 } // namespace rtc | 147 } // namespace rtc |
| 155 | 148 |
| 156 #endif // WEBRTC_BASE_SEC_BUFFER_H__ | 149 #endif // WEBRTC_BASE_SEC_BUFFER_H__ |
| OLD | NEW |