| Index: base/crypto/scoped_capi_types.h
|
| ===================================================================
|
| --- base/crypto/scoped_capi_types.h (revision 49024)
|
| +++ base/crypto/scoped_capi_types.h (working copy)
|
| @@ -15,9 +15,20 @@
|
| namespace base {
|
|
|
| // Simple destructor for the Free family of CryptoAPI functions, such as
|
| -// CryptDestroyHash, which take only a single argument to release.
|
| +// CertFreeCertificateChain, which take a single argument to release and
|
| +// return VOID
|
| +template <typename CAPIHandle, VOID (WINAPI *Destroyer)(CAPIHandle)>
|
| +struct CAPIDestroyerVOID {
|
| + void operator()(CAPIHandle handle) const {
|
| + if (handle) Destroyer(handle);
|
| + }
|
| +};
|
| +
|
| +// Simple destructor for the Free family of CryptoAPI functions, such as
|
| +// CryptDestroyHash, which take only a single argument to release and return
|
| +// BOOL
|
| template <typename CAPIHandle, BOOL (WINAPI *Destroyer)(CAPIHandle)>
|
| -struct CAPIDestroyer {
|
| +struct CAPIDestroyerBOOL {
|
| void operator()(CAPIHandle handle) const {
|
| if (handle) {
|
| BOOL ok = Destroyer(handle);
|
| @@ -113,11 +124,13 @@
|
| CAPIDestroyerWithFlags<HCRYPTPROV,
|
| CryptReleaseContext, 0> > ScopedHCRYPTPROV;
|
|
|
| -typedef ScopedCAPIHandle<
|
| - HCRYPTKEY, CAPIDestroyer<HCRYPTKEY, CryptDestroyKey> > ScopedHCRYPTKEY;
|
| +typedef ScopedCAPIHandle<HCRYPTKEY,
|
| + CAPIDestroyerBOOL<HCRYPTKEY,
|
| + CryptDestroyKey> > ScopedHCRYPTKEY;
|
|
|
| -typedef ScopedCAPIHandle<
|
| - HCRYPTHASH, CAPIDestroyer<HCRYPTHASH, CryptDestroyHash> > ScopedHCRYPTHASH;
|
| +typedef ScopedCAPIHandle<HCRYPTHASH,
|
| + CAPIDestroyerBOOL<HCRYPTHASH,
|
| + CryptDestroyHash> > ScopedHCRYPTHASH;
|
|
|
| } // namespace base
|
|
|
|
|