Michael Stefaniuc : crypt32: Don't open code CONTAINING_RECORD().

Alexandre Julliard julliard at winehq.org
Wed Dec 29 11:14:50 CST 2010


Module: wine
Branch: master
Commit: ef39e0ec1af20e1753f6833d418714dda9053728
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=ef39e0ec1af20e1753f6833d418714dda9053728

Author: Michael Stefaniuc <mstefani at redhat.de>
Date:   Wed Dec 29 02:39:42 2010 +0100

crypt32: Don't open code CONTAINING_RECORD().

---

 dlls/crypt32/decode.c |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/dlls/crypt32/decode.c b/dlls/crypt32/decode.c
index 62231cd..a1431fb 100644
--- a/dlls/crypt32/decode.c
+++ b/dlls/crypt32/decode.c
@@ -3731,9 +3731,8 @@ static BOOL CRYPT_AsnDecodeRequireExplicit(const BYTE *pbEncoded,
         }
         else
         {
-            CERT_POLICY_CONSTRAINTS_INFO *info =
-             (CERT_POLICY_CONSTRAINTS_INFO *)((BYTE *)pvStructInfo -
-             offsetof(CERT_POLICY_CONSTRAINTS_INFO, fRequireExplicitPolicy));
+            CERT_POLICY_CONSTRAINTS_INFO *info = CONTAINING_RECORD(pvStructInfo,
+              CERT_POLICY_CONSTRAINTS_INFO, fRequireExplicitPolicy);
 
             *pcbStructInfo = bytesNeeded;
             /* The BOOL is implicit:  if the integer is present, then it's
@@ -3779,9 +3778,8 @@ static BOOL CRYPT_AsnDecodeInhibitMapping(const BYTE *pbEncoded,
         }
         else
         {
-            CERT_POLICY_CONSTRAINTS_INFO *info =
-             (CERT_POLICY_CONSTRAINTS_INFO *)((BYTE *)pvStructInfo -
-             offsetof(CERT_POLICY_CONSTRAINTS_INFO, fInhibitPolicyMapping));
+            CERT_POLICY_CONSTRAINTS_INFO *info = CONTAINING_RECORD(pvStructInfo,
+              CERT_POLICY_CONSTRAINTS_INFO, fInhibitPolicyMapping);
 
             *pcbStructInfo = bytesNeeded;
             /* The BOOL is implicit:  if the integer is present, then it's
@@ -5107,8 +5105,8 @@ static BOOL CRYPT_AsnDecodeMaximum(const BYTE *pbEncoded,
         }
         else
         {
-            CERT_GENERAL_SUBTREE *subtree = (CERT_GENERAL_SUBTREE *)
-             ((BYTE *)pvStructInfo - offsetof(CERT_GENERAL_SUBTREE, fMaximum));
+            CERT_GENERAL_SUBTREE *subtree = CONTAINING_RECORD(pvStructInfo,
+             CERT_GENERAL_SUBTREE, fMaximum);
 
             *pcbStructInfo = bytesNeeded;
             /* The BOOL is implicit:  if the integer is present, then it's




More information about the wine-cvs mailing list