All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcel Heinz <marcel.heinz@informatik.tu-chemnitz.de>
To: kvm@vger.kernel.org
Subject: [PTACH] libcacard: fix VCARD_ATTR_PREFIX macro
Date: Sun, 18 Mar 2012 18:41:18 +0100	[thread overview]
Message-ID: <4F661E3E.60007@informatik.tu-chemnitz.de> (raw)

Hi,

i just tried to compile lastest git HEAD and ran into the following
problem:

vcard_emul_nss.c:528:1: error: initializer element is not constant

The source code is:
static const unsigned char nss_atr[] = { VCARD_ATR_PREFIX(3), 'N', 'S', 'S' };

with

#define VCARD_ATR_PREFIX(size) (0x3b, 0x68+(size), 0x00, 0xff, \
                                'V', 'C', 'A', 'R', 'D', '_')

The parentheses in this macro result in the use of the comma operator
in the initialization and are clearly not correct. This is a regression
from commit 0082f4336e128a17d5f34e01de0fd29930e99b0d, which changed
0x66+(size) to 0x68+size and added the parenthesis.

So I propose the following patch:

diff --git a/libcacard/vcardt.h b/libcacard/vcardt.h
index d4d8e2e..d3e9522 100644
--- a/libcacard/vcardt.h
+++ b/libcacard/vcardt.h
@@ -26,8 +26,8 @@ typedef struct VCardEmulStruct VCardEmul;
 #define MAX_CHANNEL 4

 /* create an ATR with appropriate historical bytes */
-#define VCARD_ATR_PREFIX(size) (0x3b, 0x68+(size), 0x00, 0xff, \
-                               'V', 'C', 'A', 'R', 'D', '_')
+#define VCARD_ATR_PREFIX(size) 0x3b, 0x68+(size), 0x00, 0xff, \
+                               'V', 'C', 'A', 'R', 'D', '_'


 typedef enum {



Regards,
	Marcel

             reply	other threads:[~2012-03-18 18:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-18 17:41 Marcel Heinz [this message]
2012-03-18 19:23 ` [PTACH] libcacard: fix VCARD_ATTR_PREFIX macro Alon Levy
2012-03-19  8:51   ` Marcel Heinz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F661E3E.60007@informatik.tu-chemnitz.de \
    --to=marcel.heinz@informatik.tu-chemnitz.de \
    --cc=kvm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.