1
0
forked from pool/libfreefare

libfreefare-0.3.4+git66

OBS-URL: https://build.opensuse.org/package/show/hardware/libfreefare?expand=0&rev=4
This commit is contained in:
Jan Engelhardt 2013-06-05 16:31:14 +00:00 committed by Git OBS Bridge
parent 8d8dd69b13
commit bf73601664
5 changed files with 67 additions and 9 deletions

View File

@ -0,0 +1,41 @@
From 3dd547d851cca5906edc674e127ecaa2b49591b6 Mon Sep 17 00:00:00 2001
From: Jan Engelhardt <jengelh@inai.de>
Date: Wed, 5 Jun 2013 18:22:26 +0200
X-Upstream-Status: submitted, awaiting merge
Subject: [PATCH] libfreefare: resolve compiler warning on breakage of strict
aliasing
gcc warns:
mifare_classic.c:353:45: warning: dereferencing type-punned pointer
will break strict-aliasing rules [-Wstrict-aliasing]
There is another problem with this code: "data", being a 16-byte
array, may not be suitably aligned for the other types in the union.
This patch resolves this.
---
libfreefare/mifare_classic.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/libfreefare/mifare_classic.c b/libfreefare/mifare_classic.c
index aaf2d64..1502fe8 100644
--- a/libfreefare/mifare_classic.c
+++ b/libfreefare/mifare_classic.c
@@ -346,12 +346,10 @@ mifare_classic_init_value (MifareTag tag, const MifareClassicBlockNumber block,
int
mifare_classic_read_value (MifareTag tag, const MifareClassicBlockNumber block, int32_t *value, MifareClassicBlockNumber *adr)
{
- MifareClassicBlock data;
- if (mifare_classic_read (tag, block, &data) < 0)
- return -1;
-
- union mifare_classic_block b = *((union mifare_classic_block *)(&data));
+ union mifare_classic_block b;
+ if (mifare_classic_read (tag, block, b.data) < 0)
+ return -1;
if ((b.value.value ^ (uint32_t)~b.value.value_) || (b.value.value != b.value.value__)) {
errno = EIO;
--
1.8.2

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:47126c92aa8a9e35de4db3bce16d14fbdae3cee0587dacee9544afc514f40030
size 82324

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0ce69d6748f9af49bcc7e8a5c4350c7ab5f73341401bae0c6040aa2cce8e2307
size 285568

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Wed Jun 5 15:58:17 UTC 2013 - jengelh@inai.de
- Update to new upstream snapshot 0.3.4+git66
* update for new libnfc4-1.7.0 API
- Add 0001-libfreefare-resolve-compiler-warning-on-breakage-of-.patch
-------------------------------------------------------------------
Fri Jun 15 17:47:46 UTC 2012 - jengelh@inai.de

View File

@ -1,7 +1,7 @@
#
# spec file for package libfreefare
#
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -21,20 +21,26 @@ Name: libfreefare
Summary: API for Mifare card manipulations
License: LGPL-3.0+
Group: Development/Libraries/C and C++
Version: 0.3.4
# Commit 00e999dd523b6f2be8b7820f3797b4ec9fd6c88a
Version: 0.3.4+git66
Release: 0
Url: http://code.google.com/p/nfc-tools/
#Git-Clone: http://code.google.com/p/libfreefare/
Source: %name-%version.tar.xz
Patch1: 0001-libfreefare-resolve-compiler-warning-on-breakage-of-.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: libtool
BuildRequires: pkgconfig
BuildRequires: xz
%if 0%{?suse_version} >= 1140 || 0%{?fedora_version}
BuildRequires: pkgconfig(libcrypto)
BuildRequires: pkgconfig(libnfc) >= 1.6.0
BuildRequires: pkgconfig(libnfc) >= 1.7.0
%else
BuildRequires: libnfc-devel >= 1.7.0
BuildRequires: libopenssl-devel
BuildRequires: libnfc-devel >= 1.6.0
%endif
%description
@ -80,9 +86,13 @@ This package contains example programs using libfreefare for
inspecting and manipulating Mifare cards.
%prep
%setup -q
%setup -qn %name
%patch -P 1 -p1
%build
if [ ! -e configure ]; then
autoreconf -fi
fi
%configure --disable-static
make %{?_smp_mflags};