Replaced the get/put_unaligned() macros from <asm/unaligned.h> with own inline functions

This commit is contained in:
Klaus Schmidinger 2005-08-21 14:15:00 +02:00
parent 0b9aa1c1a8
commit a8fe90b28b
4 changed files with 24 additions and 3 deletions

View File

@ -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

View File

@ -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).

3
ci.c
View File

@ -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>

17
tools.h
View File

@ -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;