test/*, configure.ac:
First paranoia regression test. It's run automatically as it assumes
that you have a *flawless* CD-DA in a drive.
*.{c,h}: more integration toward libcdio routines. In particular remove
swap16 and swap32.
This commit is contained in:
@@ -61,6 +61,7 @@
|
||||
|
||||
#include <cdio/cdda_interface.h>
|
||||
#include <cdio/paranoia.h>
|
||||
#include <cdio/bytesex.h>
|
||||
#include "utils.h"
|
||||
#include "report.h"
|
||||
#include "version.h"
|
||||
@@ -1236,7 +1237,8 @@ int main(int argc,char *argv[]){
|
||||
|
||||
if(output_endian!=bigendianp()){
|
||||
int i;
|
||||
for(i=0;i<CDIO_CD_FRAMESIZE_RAW/2;i++)readbuf[i]=swap16(readbuf[i]);
|
||||
for(i=0;i<CDIO_CD_FRAMESIZE_RAW/2;i++)
|
||||
readbuf[i]=UINT16_SWAP_LE_BE_C(readbuf[i]);
|
||||
}
|
||||
|
||||
callback(cursor*(CD_FRAMEWORDS)-1,-2);
|
||||
@@ -1250,7 +1252,8 @@ int main(int argc,char *argv[]){
|
||||
|
||||
if(output_endian!=bigendianp()){
|
||||
int i;
|
||||
for(i=0;i<CDIO_CD_FRAMESIZE_RAW/2;i++)readbuf[i]=swap16(readbuf[i]);
|
||||
for(i=0;i<CDIO_CD_FRAMESIZE_RAW/2;i++)
|
||||
readbuf[i]=UINT16_SWAP_LE_BE_C(readbuf[i]);
|
||||
}
|
||||
|
||||
/* One last bit of silliness to deal with sample offsets */
|
||||
@@ -1279,7 +1282,7 @@ int main(int argc,char *argv[]){
|
||||
|
||||
if(output_endian!=bigendianp())
|
||||
for(i=0;i<CDIO_CD_FRAMESIZE_RAW/2;i++)
|
||||
offset_buffer[i]=swap16(readbuf[i]);
|
||||
offset_buffer[i]=UINT16_SWAP_LE_BE_C(readbuf[i]);
|
||||
else
|
||||
memcpy(offset_buffer,readbuf,CDIO_CD_FRAMESIZE_RAW);
|
||||
offset_buffer_used=sample_offset*4;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
$Id: utils.h,v 1.1 2004/12/18 17:29:32 rocky Exp $
|
||||
$Id: utils.h,v 1.2 2004/12/19 00:02:09 rocky Exp $
|
||||
|
||||
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
||||
Copyright (C) 1998 Monty xiphmont@mit.edu
|
||||
@@ -24,6 +24,8 @@
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <cdio/types.h>
|
||||
#include <cdio/bytesex.h>
|
||||
|
||||
extern long buffering_write(int outf, char *buffer, long num);
|
||||
extern int buffering_close(int fd);
|
||||
@@ -39,26 +41,14 @@ static inline int bigendianp(void){
|
||||
return(1);
|
||||
}
|
||||
|
||||
static inline int32_t swap32(int32_t x){
|
||||
return((((u_int32_t)x & 0x000000ffU) << 24) |
|
||||
(((u_int32_t)x & 0x0000ff00U) << 8) |
|
||||
(((u_int32_t)x & 0x00ff0000U) >> 8) |
|
||||
(((u_int32_t)x & 0xff000000U) >> 24));
|
||||
}
|
||||
|
||||
static inline int16_t swap16(int16_t x){
|
||||
return((((u_int16_t)x & 0x00ffU) << 8) |
|
||||
(((u_int16_t)x & 0xff00U) >> 8));
|
||||
}
|
||||
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
|
||||
static inline int32_t be32_to_cpu(int32_t x){
|
||||
return(swap32(x));
|
||||
return(UINT32_SWAP_LE_BE_C(x));
|
||||
}
|
||||
|
||||
static inline int16_t be16_to_cpu(int16_t x){
|
||||
return(swap16(x));
|
||||
return(UINT16_SWAP_LE_BE_C(x));
|
||||
}
|
||||
|
||||
static inline int32_t le32_to_cpu(int32_t x){
|
||||
@@ -80,11 +70,11 @@ static inline int16_t be16_to_cpu(int16_t x){
|
||||
}
|
||||
|
||||
static inline int32_t le32_to_cpu(int32_t x){
|
||||
return(swap32(x));
|
||||
return(UINT32_SWAP_LE_BE_C(x));
|
||||
}
|
||||
|
||||
static inline int16_t le16_to_cpu(int16_t x){
|
||||
return(swap16(x));
|
||||
return(UINT16_SWAP_LE_BE_C(x));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user