mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-03 09:00:21 +00:00
Implement the full range of ISO9660 number conversion routines in iso.h.
MFC after: 2 weeks
This commit is contained in:
parent
dbe16e65dc
commit
a92fef8afc
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=151447
@ -118,21 +118,6 @@ struct ptable_ent {
|
||||
|
||||
#define cdb2devb(bno) ((bno) * ISO_DEFAULT_BLOCK_SIZE / DEV_BSIZE)
|
||||
|
||||
/* XXX these should be in the system headers */
|
||||
static __inline int
|
||||
isonum_722(p)
|
||||
u_char *p;
|
||||
{
|
||||
return (*p << 8)|p[1];
|
||||
}
|
||||
|
||||
static __inline int
|
||||
isonum_732(p)
|
||||
u_char *p;
|
||||
{
|
||||
return (*p << 24)|(p[1] << 16)|(p[2] << 8)|p[3];
|
||||
}
|
||||
|
||||
static ISO_SUSP_HEADER *
|
||||
susp_lookup_record(struct open_file *f, const char *identifier,
|
||||
struct iso_directory_record *dp, int lenskip)
|
||||
|
@ -277,79 +277,65 @@ u_short sgetrune(const char *, size_t, char const **, int, void *);
|
||||
* outside the kernel. Thus we don't hide them here.
|
||||
*/
|
||||
|
||||
static __inline int isonum_711(u_char *);
|
||||
static __inline int
|
||||
isonum_711(p)
|
||||
u_char *p;
|
||||
/*
|
||||
* 7xy
|
||||
* x -> 1 = 8 bits, 2 = 16 bits, 3 = 32 bits
|
||||
* y -> 1 = little-endian, 2 = big-endian, 3 = both (le then be)
|
||||
*/
|
||||
|
||||
static __inline uint8_t
|
||||
isonum_711(unsigned char *p)
|
||||
{
|
||||
return *p;
|
||||
return p[0];
|
||||
}
|
||||
|
||||
static __inline int isonum_712(char *);
|
||||
static __inline int
|
||||
isonum_712(p)
|
||||
char *p;
|
||||
static __inline uint8_t
|
||||
isonum_712(unsigned char *p)
|
||||
{
|
||||
return *p;
|
||||
return p[0];
|
||||
}
|
||||
|
||||
#ifndef UNALIGNED_ACCESS
|
||||
|
||||
static __inline int isonum_723(u_char *);
|
||||
static __inline int
|
||||
isonum_723(p)
|
||||
u_char *p;
|
||||
static __inline uint8_t
|
||||
isonum_713(unsigned char *p)
|
||||
{
|
||||
return *p|(p[1] << 8);
|
||||
return p[0];
|
||||
}
|
||||
|
||||
static __inline int isonum_733(u_char *);
|
||||
static __inline int
|
||||
isonum_733(p)
|
||||
u_char *p;
|
||||
static __inline uint16_t
|
||||
isonum_721(unsigned char *p)
|
||||
{
|
||||
return *p|(p[1] << 8)|(p[2] << 16)|(p[3] << 24);
|
||||
return (p[0] | p[1] << 8);
|
||||
}
|
||||
|
||||
#else /* UNALIGNED_ACCESS */
|
||||
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
|
||||
static __inline int
|
||||
isonum_723(p)
|
||||
u_char *p
|
||||
static __inline uint16_t
|
||||
isonum_722(unsigned char *p)
|
||||
{
|
||||
return *(u_int16t *)p;
|
||||
return (p[1] | p[0] << 8);
|
||||
}
|
||||
|
||||
static __inline int
|
||||
isonum_733(p)
|
||||
u_char *p;
|
||||
static __inline uint16_t
|
||||
isonum_723(unsigned char *p)
|
||||
{
|
||||
return *(u_int32t *)p;
|
||||
return (p[0] | p[1] << 8);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
|
||||
static __inline int
|
||||
isonum_723(p)
|
||||
u_char *p
|
||||
static __inline uint32_t
|
||||
isonum_731(unsigned char *p)
|
||||
{
|
||||
return *(u_int16t *)(p + 2);
|
||||
return (p[0] | p[1] << 8 | p[2] << 16 | p[3] << 24);
|
||||
}
|
||||
|
||||
static __inline int
|
||||
isonum_733(p)
|
||||
u_char *p;
|
||||
static __inline uint32_t
|
||||
isonum_732(unsigned char *p)
|
||||
{
|
||||
return *(u_int32t *)(p + 4);
|
||||
return (p[3] | p[2] << 8 | p[1] << 16 | p[0] << 24);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* UNALIGNED_ACCESS */
|
||||
static __inline uint32_t
|
||||
isonum_733(unsigned char *p)
|
||||
{
|
||||
return (p[0] | p[1] << 8 | p[2] << 16 | p[3] << 24);
|
||||
}
|
||||
|
||||
/*
|
||||
* Associated files have a leading '='.
|
||||
|
@ -277,79 +277,65 @@ u_short sgetrune(const char *, size_t, char const **, int, void *);
|
||||
* outside the kernel. Thus we don't hide them here.
|
||||
*/
|
||||
|
||||
static __inline int isonum_711(u_char *);
|
||||
static __inline int
|
||||
isonum_711(p)
|
||||
u_char *p;
|
||||
/*
|
||||
* 7xy
|
||||
* x -> 1 = 8 bits, 2 = 16 bits, 3 = 32 bits
|
||||
* y -> 1 = little-endian, 2 = big-endian, 3 = both (le then be)
|
||||
*/
|
||||
|
||||
static __inline uint8_t
|
||||
isonum_711(unsigned char *p)
|
||||
{
|
||||
return *p;
|
||||
return p[0];
|
||||
}
|
||||
|
||||
static __inline int isonum_712(char *);
|
||||
static __inline int
|
||||
isonum_712(p)
|
||||
char *p;
|
||||
static __inline uint8_t
|
||||
isonum_712(unsigned char *p)
|
||||
{
|
||||
return *p;
|
||||
return p[0];
|
||||
}
|
||||
|
||||
#ifndef UNALIGNED_ACCESS
|
||||
|
||||
static __inline int isonum_723(u_char *);
|
||||
static __inline int
|
||||
isonum_723(p)
|
||||
u_char *p;
|
||||
static __inline uint8_t
|
||||
isonum_713(unsigned char *p)
|
||||
{
|
||||
return *p|(p[1] << 8);
|
||||
return p[0];
|
||||
}
|
||||
|
||||
static __inline int isonum_733(u_char *);
|
||||
static __inline int
|
||||
isonum_733(p)
|
||||
u_char *p;
|
||||
static __inline uint16_t
|
||||
isonum_721(unsigned char *p)
|
||||
{
|
||||
return *p|(p[1] << 8)|(p[2] << 16)|(p[3] << 24);
|
||||
return (p[0] | p[1] << 8);
|
||||
}
|
||||
|
||||
#else /* UNALIGNED_ACCESS */
|
||||
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
|
||||
static __inline int
|
||||
isonum_723(p)
|
||||
u_char *p
|
||||
static __inline uint16_t
|
||||
isonum_722(unsigned char *p)
|
||||
{
|
||||
return *(u_int16t *)p;
|
||||
return (p[1] | p[0] << 8);
|
||||
}
|
||||
|
||||
static __inline int
|
||||
isonum_733(p)
|
||||
u_char *p;
|
||||
static __inline uint16_t
|
||||
isonum_723(unsigned char *p)
|
||||
{
|
||||
return *(u_int32t *)p;
|
||||
return (p[0] | p[1] << 8);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
|
||||
static __inline int
|
||||
isonum_723(p)
|
||||
u_char *p
|
||||
static __inline uint32_t
|
||||
isonum_731(unsigned char *p)
|
||||
{
|
||||
return *(u_int16t *)(p + 2);
|
||||
return (p[0] | p[1] << 8 | p[2] << 16 | p[3] << 24);
|
||||
}
|
||||
|
||||
static __inline int
|
||||
isonum_733(p)
|
||||
u_char *p;
|
||||
static __inline uint32_t
|
||||
isonum_732(unsigned char *p)
|
||||
{
|
||||
return *(u_int32t *)(p + 4);
|
||||
return (p[3] | p[2] << 8 | p[1] << 16 | p[0] << 24);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* UNALIGNED_ACCESS */
|
||||
static __inline uint32_t
|
||||
isonum_733(unsigned char *p)
|
||||
{
|
||||
return (p[0] | p[1] << 8 | p[2] << 16 | p[3] << 24);
|
||||
}
|
||||
|
||||
/*
|
||||
* Associated files have a leading '='.
|
||||
|
Loading…
Reference in New Issue
Block a user