summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2005-08-21 14:15:00 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2005-08-21 14:15:00 +0200
commita8fe90b28bdd9643cfd4168c006069d165cef101 (patch)
tree80cd5820ce9be0d4a803e1f9c55188b9eb68208d
parent0b9aa1c1a8c5df42270866baf5f80cfb73cccdea (diff)
downloadvdr-a8fe90b28bdd9643cfd4168c006069d165cef101.tar.gz
vdr-a8fe90b28bdd9643cfd4168c006069d165cef101.tar.bz2
Replaced the get/put_unaligned() macros from <asm/unaligned.h> with own inline functions1.3.30
-rw-r--r--CONTRIBUTORS4
-rw-r--r--HISTORY3
-rw-r--r--ci.c3
-rw-r--r--tools.h17
4 files changed, 24 insertions, 3 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index a4942419..ff546dd4 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -1436,3 +1436,7 @@ Klaus Heppenheimer <klaus@reel-multimedia.com>
Thomas Günther <tom1@toms-cafe.de>
for fixing handling the frame number display if '7' is pressed before the first
editing mark, or '9' after the last one
+
+David Woodhouse <dwmw2@infradead.org>
+ for his help in replacing the get/put_unaligned() macros from asm/unaligned.h with
+ own inline functions to avoid problems on platforms that don't provide these
diff --git a/HISTORY b/HISTORY
index 601dbad4..02cc7b7e 100644
--- a/HISTORY
+++ b/HISTORY
@@ -3713,3 +3713,6 @@ Video Disk Recorder Revision History
- Fixed cDvbTuner to avoid lockups on NPTL systems (thanks to Marcel Wiesweg).
- Added 'Service' functions to the plugin interface (thanks to Udo Richter).
See PLUGINS.html, section "Custom services" for details.
+- Replaced the get/put_unaligned() macros from <asm/unaligned.h> with own inline
+ functions to avoid problems on platforms that don't provide these (thanks to
+ David Woodhouse for his help).
diff --git a/ci.c b/ci.c
index b99c5495..94a5cd63 100644
--- a/ci.c
+++ b/ci.c
@@ -4,11 +4,10 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: ci.c 1.26 2005/08/20 15:27:35 kls Exp $
+ * $Id: ci.c 1.27 2005/08/21 14:10:27 kls Exp $
*/
#include "ci.h"
-#include <asm/unaligned.h>
#include <ctype.h>
#include <linux/dvb/ca.h>
#include <malloc.h>
diff --git a/tools.h b/tools.h
index 0644f4e6..0a8ee8b6 100644
--- a/tools.h
+++ b/tools.h
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: tools.h 1.73 2005/08/06 09:53:21 kls Exp $
+ * $Id: tools.h 1.74 2005/08/21 14:06:38 kls Exp $
*/
#ifndef __TOOLS_H
@@ -57,6 +57,21 @@ template<class T> inline void swap(T &a, T &b) { T t = a; a = b; b = t; }
#define BCDCHARTOINT(x) (10 * ((x & 0xF0) >> 4) + (x & 0xF))
int BCD2INT(int x);
+// Unfortunately there are no platform independent macros for unaligned
+// access. so we do it this way:
+
+template<class T> inline T get_unaligned(T *p)
+{
+ struct s { T v; } __attribute__((packed));
+ return ((s *)p)->v;
+}
+
+template<class T> inline void put_unaligned(unsigned int v, T* p)
+{
+ struct s { T v; } __attribute__((packed));
+ ((s *)p)->v = v;
+}
+
class cString {
private:
char *s;