namespace
{
- unsigned short readWORD(File *file, bool *ok = 0)
+ inline unsigned short readWORD(File *file, bool *ok = 0)
{
const ByteVector v = file->readBlock(2);
if(v.size() != 2) {
return v.toUShort(false);
}
- unsigned int readDWORD(File *file, bool *ok = 0)
+ inline unsigned int readDWORD(File *file, bool *ok = 0)
{
const ByteVector v = file->readBlock(4);
if(v.size() != 4) {
return v.toUInt(false);
}
- long long readQWORD(File *file, bool *ok = 0)
+ inline long long readQWORD(File *file, bool *ok = 0)
{
const ByteVector v = file->readBlock(8);
if(v.size() != 8) {
return v.toLongLong(false);
}
- String readString(File *file, int length)
+ inline String readString(File *file, int length)
{
ByteVector data = file->readBlock(length);
unsigned int size = data.size();
return String(data, String::UTF16LE);
}
- ByteVector renderString(const String &str, bool includeLength = false)
+ inline ByteVector renderString(const String &str, bool includeLength = false)
{
ByteVector data = str.data(String::UTF16LE) + ByteVector::fromShort(0, false);
if(includeLength) {
* first byte is easy to check for, however checking to see if the second byte
* starts with \e 111 is a bit more tricky, hence these functions.
*/
- bool firstSyncByte(unsigned char byte)
+ inline bool firstSyncByte(unsigned char byte)
{
return (byte == 0xFF);
}
- bool secondSynchByte(unsigned char byte)
+ inline bool secondSynchByte(unsigned char byte)
{
// 0xFF is possible in theory, but it's very unlikely be a header.
namespace
{
- bool isValidChunkName(const ByteVector &name)
+ inline bool isValidChunkName(const ByteVector &name)
{
if(name.size() != 4)
return false;
/*!
* Reverses the order of bytes in an 16-bit integer.
*/
- unsigned short byteSwap(unsigned short x)
+ inline unsigned short byteSwap(unsigned short x)
{
#if defined(HAVE_BOOST_BYTESWAP)
/*!
* Reverses the order of bytes in an 32-bit integer.
*/
- unsigned int byteSwap(unsigned int x)
+ inline unsigned int byteSwap(unsigned int x)
{
#if defined(HAVE_BOOST_BYTESWAP)
/*!
* Reverses the order of bytes in an 64-bit integer.
*/
- unsigned long long byteSwap(unsigned long long x)
+ inline unsigned long long byteSwap(unsigned long long x)
{
#if defined(HAVE_BOOST_BYTESWAP)
* Returns a formatted string just like standard sprintf(), but makes use of
* safer functions such as snprintf() if available.
*/
- String formatString(const char *format, ...)
+ inline String formatString(const char *format, ...)
{
// Sufficient buffer size for the current internal uses.
// Consider changing this value when you use this function.
* We took the trouble to define this one here, since there are some
* incompatible variations of case insensitive strcmp().
*/
- bool equalsIgnoreCase(const char *s1, const char *s2)
+ inline bool equalsIgnoreCase(const char *s1, const char *s2)
{
while(*s1 != '\0' && *s2 != '\0' && ::tolower(*s1) == ::tolower(*s2)) {
s1++;
/*!
* Returns the integer byte order of the system.
*/
- ByteOrder systemByteOrder()
+ inline ByteOrder systemByteOrder()
{
union {
int i;
/*!
* Returns the IEEE754 byte order of the system.
*/
- ByteOrder floatByteOrder()
+ inline ByteOrder floatByteOrder()
{
union {
double d;