- Rename MifareSector to MifareSectorNumber;

- Fix includes (use '<>' instead of '""');
  - Add -I. to cc arguments.
This commit is contained in:
Romain Tartiere 2009-12-21 02:35:28 +00:00
parent 89dd817a63
commit 00ca4579c9
4 changed files with 13 additions and 13 deletions

View file

@ -1,7 +1,7 @@
ACLOCAL_AMFLAGS = -I m4 ACLOCAL_AMFLAGS = -I m4
AM_CFLAGS = -std=c99 @LIBNFC_CFLAGS@ AM_CFLAGS = -I. -std=c99 @LIBNFC_CFLAGS@
AM_LDFLAGS = @LIBNFC_LIBS@ AM_LDFLAGS = @LIBNFC_LIBS@
lib_LTLIBRARIES = libfreefare.la lib_LTLIBRARIES = libfreefare.la

10
mad.c
View file

@ -30,7 +30,7 @@
#include <errno.h> #include <errno.h>
#include <string.h> #include <string.h>
#include "mad.h" #include <mad.h>
struct aid { struct aid {
uint8_t function_cluster_code; uint8_t function_cluster_code;
@ -264,7 +264,7 @@ mad_set_version (Mad mad, uint8_t version)
/* /*
* Return the MAD card publisher sector. * Return the MAD card publisher sector.
*/ */
MifareSector MifareSectorNumber
mad_get_card_publisher_sector(Mad mad) mad_get_card_publisher_sector(Mad mad)
{ {
return (mad->sector_0x00.info & 0x3f); return (mad->sector_0x00.info & 0x3f);
@ -274,7 +274,7 @@ mad_get_card_publisher_sector(Mad mad)
* Set the MAD card publisher sector. * Set the MAD card publisher sector.
*/ */
int int
mad_set_card_publisher_sector(Mad mad, MifareSector cps) mad_set_card_publisher_sector(Mad mad, MifareSectorNumber cps)
{ {
if (((mad->version == 2) && (cps > 0x27)) | (mad->version == 1) && (cps > 0x0f)) { if (((mad->version == 2) && (cps > 0x27)) | (mad->version == 1) && (cps > 0x0f)) {
errno = EINVAL; errno = EINVAL;
@ -289,7 +289,7 @@ mad_set_card_publisher_sector(Mad mad, MifareSector cps)
* Get the provided sector's application identifier. * Get the provided sector's application identifier.
*/ */
int int
mad_get_aid(Mad mad, MifareSector sector, uint8_t *function_cluster_code, uint8_t *application_code) mad_get_aid(Mad mad, MifareSectorNumber sector, uint8_t *function_cluster_code, uint8_t *application_code)
{ {
if (sector > 0x27) { if (sector > 0x27) {
errno = EINVAL; errno = EINVAL;
@ -316,7 +316,7 @@ mad_get_aid(Mad mad, MifareSector sector, uint8_t *function_cluster_code, uint8_
* Set the provided sector's application identifier. * Set the provided sector's application identifier.
*/ */
int int
mad_set_aid(Mad mad, MifareSector sector, uint8_t function_cluster_code, uint8_t application_code) mad_set_aid(Mad mad, MifareSectorNumber sector, uint8_t function_cluster_code, uint8_t application_code)
{ {
if (sector > 0x27) { if (sector > 0x27) {
errno = EINVAL; errno = EINVAL;

12
mad.h
View file

@ -19,9 +19,9 @@
#ifndef __MIFARE_APPLICATION_DIRECTORY_H__ #ifndef __MIFARE_APPLICATION_DIRECTORY_H__
#define __MIFARE_APPLICATION_DIRECTORY_H__ #define __MIFARE_APPLICATION_DIRECTORY_H__
#include "mifare_classic.h" #include <mifare_classic.h>
typedef uint8_t MifareSector; typedef uint8_t MifareSectorNumber;
struct mad; struct mad;
typedef struct mad *Mad; typedef struct mad *Mad;
@ -31,10 +31,10 @@ Mad mad_read (MifareClassicTag tag);
int mad_write (MifareClassicTag tag, Mad mad, MifareClassicKey key_b_sector_00, MifareClassicKey key_b_sector_10); int mad_write (MifareClassicTag tag, Mad mad, MifareClassicKey key_b_sector_00, MifareClassicKey key_b_sector_10);
int mad_get_version (Mad mad); int mad_get_version (Mad mad);
void mad_set_version (Mad mad, uint8_t version); void mad_set_version (Mad mad, uint8_t version);
MifareSector mad_get_card_publisher_sector(Mad mad); MifareSectorNumber mad_get_card_publisher_sector(Mad mad);
int mad_set_card_publisher_sector(Mad mad, MifareSector cps); int mad_set_card_publisher_sector(Mad mad, MifareSectorNumber cps);
int mad_get_aid(Mad mad, MifareSector sector, uint8_t *function_cluster_code, uint8_t *application_code); int mad_get_aid(Mad mad, MifareSectorNumber sector, uint8_t *function_cluster_code, uint8_t *application_code);
int mad_set_aid(Mad mad, MifareSector sector, uint8_t function_cluster_code, uint8_t application_code); int mad_set_aid(Mad mad, MifareSectorNumber sector, uint8_t function_cluster_code, uint8_t application_code);
void mad_free (Mad mad); void mad_free (Mad mad);
#endif /* !__MIFARE_APPLICATION_DIRECTORY_H__ */ #endif /* !__MIFARE_APPLICATION_DIRECTORY_H__ */

View file

@ -37,7 +37,7 @@
#include <nfc/nfc.h> #include <nfc/nfc.h>
#include "mifare_classic.h" #include <mifare_classic.h>
struct mifare_classic_tag { struct mifare_classic_tag {
nfc_device_t *device; nfc_device_t *device;