Skip to content

Commit

Permalink
Run make style to indent macros
Browse files Browse the repository at this point in the history
  • Loading branch information
smortex committed Jun 29, 2017
1 parent c54e3d9 commit 69bf99b
Show file tree
Hide file tree
Showing 30 changed files with 272 additions and 272 deletions.
8 changes: 4 additions & 4 deletions examples/felica-read-ndef.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#if defined(HAVE_CONFIG_H)
# include "config.h"
#include "config.h"
#endif

#include <ctype.h>
Expand All @@ -8,15 +8,15 @@
#include <unistd.h>

#if defined(HAVE_SYS_ENDIAN_H)
# include <sys/endian.h>
#include <sys/endian.h>
#endif

#if defined(HAVE_ENDIAN_H)
# include <endian.h>
#include <endian.h>
#endif

#if defined(HAVE_COREFOUNDATION_COREFOUNDATION_H)
# include <CoreFoundation/CoreFoundation.h>
#include <CoreFoundation/CoreFoundation.h>
#endif

#include <nfc/nfc.h>
Expand Down
2 changes: 1 addition & 1 deletion examples/mifare-classic-format.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#if defined(HAVE_CONFIG_H)
# include "config.h"
#include "config.h"
#endif

#include <err.h>
Expand Down
2 changes: 1 addition & 1 deletion examples/mifare-classic-read-ndef.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/

#if defined(HAVE_CONFIG_H)
# include "config.h"
#include "config.h"
#endif

#include <err.h>
Expand Down
2 changes: 1 addition & 1 deletion examples/mifare-classic-write-ndef.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#if defined(HAVE_CONFIG_H)
# include "config.h"
#include "config.h"
#endif

#include <err.h>
Expand Down
2 changes: 1 addition & 1 deletion examples/mifare-desfire-create-ndef.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#if defined(HAVE_CONFIG_H)
# include "config.h"
#include "config.h"
#endif

#include <err.h>
Expand Down
2 changes: 1 addition & 1 deletion examples/mifare-desfire-ev1-configure-ats.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#if defined(HAVE_CONFIG_H)
# include "config.h"
#include "config.h"
#endif

#include <err.h>
Expand Down
2 changes: 1 addition & 1 deletion examples/mifare-desfire-ev1-configure-default-key.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#if defined(HAVE_CONFIG_H)
# include "config.h"
#include "config.h"
#endif

#include <err.h>
Expand Down
2 changes: 1 addition & 1 deletion examples/mifare-desfire-ev1-configure-random-uid.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#if defined(HAVE_CONFIG_H)
# include "config.h"
#include "config.h"
#endif

#include <err.h>
Expand Down
2 changes: 1 addition & 1 deletion examples/mifare-desfire-format.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#if defined(HAVE_CONFIG_H)
# include "config.h"
#include "config.h"
#endif

#include <err.h>
Expand Down
2 changes: 1 addition & 1 deletion examples/mifare-desfire-read-ndef.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#if defined(HAVE_CONFIG_H)
# include "config.h"
#include "config.h"
#endif

#include <err.h>
Expand Down
2 changes: 1 addition & 1 deletion examples/mifare-desfire-write-ndef.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#if defined(HAVE_CONFIG_H)
# include "config.h"
#include "config.h"
#endif

#include <err.h>
Expand Down
4 changes: 2 additions & 2 deletions libfreefare/felica.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

#if defined(HAVE_CONFIG_H)
# include "config.h"
#include "config.h"
#endif

#include <assert.h>
Expand All @@ -18,7 +18,7 @@
#include <sys/types.h>

#ifdef WITH_DEBUG
# include <libutil.h>
#include <libutil.h>
#endif

#include <freefare.h>
Expand Down
2 changes: 1 addition & 1 deletion libfreefare/freefare.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#if defined(HAVE_CONFIG_H)
# include "config.h"
#include "config.h"
#endif

#include <stdlib.h>
Expand Down
32 changes: 16 additions & 16 deletions libfreefare/freefare.h
Original file line number Diff line number Diff line change
Expand Up @@ -279,11 +279,11 @@ bit 0: PICC master key frozen (reversible with configuration change or when form
*/

#define MDMK_SETTINGS(picc_master_key_settings_changeable,free_create_delete_application,free_listing_apps_and_key_settings,picc_master_key_changeable) ( \
(picc_master_key_settings_changeable << 3) | \
(free_create_delete_application << 2) | \
(free_listing_apps_and_key_settings << 1) | \
(picc_master_key_changeable) \
)
(picc_master_key_settings_changeable << 3) | \
(free_create_delete_application << 2) | \
(free_listing_apps_and_key_settings << 1) | \
(picc_master_key_changeable) \
)

/* Mifare DESFire EV1 Application crypto operations */

Expand All @@ -300,21 +300,21 @@ bit 0: PICC master key frozen (reversible with configuration change or when form
*/

#define MDAPP_SETTINGS(key_no_for_key_changing,config_changeable,free_create_delete_files,free_listing_contents,app_master_key_changeable) ( \
(key_no_for_key_changing << 4) | \
(config_changeable << 3) | \
(free_create_delete_files << 2) | \
(free_listing_contents << 1) | \
(app_master_key_changeable) \
)
(key_no_for_key_changing << 4) | \
(config_changeable << 3) | \
(free_create_delete_files << 2) | \
(free_listing_contents << 1) | \
(app_master_key_changeable) \
)

/* Access right */

#define MDAR(read,write,read_write,change_access_rights) ( \
(read << 12) | \
(write << 8) | \
(read_write << 4) | \
(change_access_rights) \
)
(read << 12) | \
(write << 8) | \
(read_write << 4) | \
(change_access_rights) \
)

#define MDAR_READ(ar) (((ar) >> 12) & 0x0f)
#define MDAR_WRITE(ar) (((ar) >> 8) & 0x0f)
Expand Down
102 changes: 51 additions & 51 deletions libfreefare/freefare_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define __FREEFARE_INTERNAL_H__

#if defined(HAVE_CONFIG_H)
# include "config.h"
#include "config.h"
#endif

#include <openssl/des.h>
Expand All @@ -25,55 +25,55 @@
*/

#if !defined(le32toh) && defined(letoh32)
# define le32toh(x) letoh32(x)
# define be32toh(x) betoh32(x)
#define le32toh(x) letoh32(x)
#define be32toh(x) betoh32(x)
#endif

#if !defined(le16toh) && defined(letoh16)
# define le16toh(x) letoh16(x)
# define be16toh(x) betoh16(x)
#define le16toh(x) letoh16(x)
#define be16toh(x) betoh16(x)
#endif

#if !defined(le32toh) && defined(HAVE_COREFOUNDATION_COREFOUNDATION_H)
# define be32toh(x) CFSwapInt32BigToHost(x)
# define htobe32(x) CFSwapInt32HostToBig(x)
# define le32toh(x) CFSwapInt32LittleToHost(x)
# define htole32(x) CFSwapInt32HostToLittle(x)
#define be32toh(x) CFSwapInt32BigToHost(x)
#define htobe32(x) CFSwapInt32HostToBig(x)
#define le32toh(x) CFSwapInt32LittleToHost(x)
#define htole32(x) CFSwapInt32HostToLittle(x)
#endif

#if !defined(le16toh) && defined(HAVE_COREFOUNDATION_COREFOUNDATION_H)
# define be16toh(x) CFSwapInt16BigToHost(x)
# define htobe16(x) CFSwapInt16HostToBig(x)
# define le16toh(x) CFSwapInt16LittleToHost(x)
# define htole16(x) CFSwapInt16HostToLittle(x)
#define be16toh(x) CFSwapInt16BigToHost(x)
#define htobe16(x) CFSwapInt16HostToBig(x)
#define le16toh(x) CFSwapInt16LittleToHost(x)
#define htole16(x) CFSwapInt16HostToLittle(x)
#endif

#if !defined(le32toh) && defined(bswap_32)
# if BYTE_ORDER == LITTLE_ENDIAN
# define be32toh(x) bswap_32(x)
# define htobe32(x) bswap_32(x)
# define le32toh(x) (x)
# define htole32(x) (x)
# else
# define be32toh(x) (x)
# define htobe32(x) (x)
# define le32toh(x) bswap_32(x)
# define htole32(x) bswap_32(x)
# endif
#if BYTE_ORDER == LITTLE_ENDIAN
#define be32toh(x) bswap_32(x)
#define htobe32(x) bswap_32(x)
#define le32toh(x) (x)
#define htole32(x) (x)
#else
#define be32toh(x) (x)
#define htobe32(x) (x)
#define le32toh(x) bswap_32(x)
#define htole32(x) bswap_32(x)
#endif
#endif

#if !defined(htole16) && defined(bswap_16)
# if BYTE_ORDER == LITTLE_ENDIAN
# define be16toh(x) (bswap_16(x))
# define htobe16(x) (bswap_16(x))
# define htole16(x) (x)
# define le16toh(x) (x)
# else
# define be16toh(x) (x)
# define htobe16(x) (x)
# define htole16(x) (bswap_16(x))
# define le16toh(x) (bswap_16(x))
# endif
#if BYTE_ORDER == LITTLE_ENDIAN
#define be16toh(x) (bswap_16(x))
#define htobe16(x) (bswap_16(x))
#define htole16(x) (x)
#define le16toh(x) (x)
#else
#define be16toh(x) (x)
#define htobe16(x) (x)
#define htole16(x) (bswap_16(x))
#define le16toh(x) (bswap_16(x))
#endif
#endif

#define MIN(a, b) (((a) < (b)) ? (a) : (b))
Expand Down Expand Up @@ -276,11 +276,11 @@ struct ntag21x_key {
#define TB_AB(ab) ((ab == C_DEFAULT) ? C_100 : ab)

#ifdef WITH_DEBUG
#define DEBUG_FUNCTION() do { printf("*** \033[033;1m%s\033[0m ***\n", __FUNCTION__); } while (0)
#define DEBUG_XFER(data, nbytes, hint) do { hexdump (data, nbytes, hint, 0); } while (0)
#define DEBUG_FUNCTION() do { printf("*** \033[033;1m%s\033[0m ***\n", __FUNCTION__); } while (0)
#define DEBUG_XFER(data, nbytes, hint) do { hexdump (data, nbytes, hint, 0); } while (0)
#else
#define DEBUG_FUNCTION() do {} while (0)
#define DEBUG_XFER(data, nbytes, hint) do {} while (0)
#define DEBUG_FUNCTION() do {} while (0)
#define DEBUG_XFER(data, nbytes, hint) do {} while (0)
#endif


Expand Down Expand Up @@ -328,18 +328,18 @@ struct ntag21x_key {
*/
#define BUFFER_APPEND(buffer_name, data) \
do { \
buffer_name[__##buffer_name##_n++] = data; \
buffer_name[__##buffer_name##_n++] = data; \
} while (0)

/*
* Append size bytes of data to the buffer buffer_name.
*/
#define BUFFER_APPEND_BYTES(buffer_name, data, size) \
do { \
size_t __n = 0; \
while (__n < size) { \
buffer_name[__##buffer_name##_n++] = ((uint8_t *)data)[__n++]; \
} \
size_t __n = 0; \
while (__n < size) { \
buffer_name[__##buffer_name##_n++] = ((uint8_t *)data)[__n++]; \
} \
} while (0)

/*
Expand All @@ -354,17 +354,17 @@ struct ntag21x_key {
#if defined(_BYTE_ORDER) && (_BYTE_ORDER != _LITTLE_ENDIAN)
#define BUFFER_APPEND_LE(buffer, data, data_size, field_size) \
do { \
size_t __data_size = data_size; \
size_t __field_size = field_size; \
while (__field_size--, __data_size--) { \
buffer[__##buffer##_n++] = ((uint8_t *)&data)[__field_size]; \
} \
size_t __data_size = data_size; \
size_t __field_size = field_size; \
while (__field_size--, __data_size--) { \
buffer[__##buffer##_n++] = ((uint8_t *)&data)[__field_size]; \
} \
} while (0)
#else
#define BUFFER_APPEND_LE(buffer, data, data_size, field_size) \
do { \
memcpy (buffer + __##buffer##_n, &data, data_size); \
__##buffer##_n += data_size; \
memcpy (buffer + __##buffer##_n, &data, data_size); \
__##buffer##_n += data_size; \
} while (0)
#endif

Expand Down
2 changes: 1 addition & 1 deletion libfreefare/mad.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/

#if defined(HAVE_CONFIG_H)
# include "config.h"
#include "config.h"
#endif

#include <sys/types.h>
Expand Down
2 changes: 1 addition & 1 deletion libfreefare/mifare_application.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

#if defined(HAVE_CONFIG_H)
# include "config.h"
#include "config.h"
#endif

#include <errno.h>
Expand Down
Loading

0 comments on commit 69bf99b

Please sign in to comment.