Make RT build without __USE_MISC and __USE_XOPEN

This commit is contained in:
Flössie
2017-01-28 19:03:59 +01:00
parent 9c9ac0d589
commit 88336cb897
24 changed files with 276 additions and 242 deletions

View File

@@ -245,4 +245,19 @@ bool hasPngExtension(const Glib::ustring& filename)
return getFileExtension(filename) == "png";
}
void swab(const void* from, void* to, ssize_t n)
{
// Adapted from glibc
const char* char_from = static_cast<const char*>(from);
char* char_to = static_cast<char*>(to);
n &= ~static_cast<ssize_t>(1);
while (n > 1) {
const char b0 = char_from[--n], b1 = char_from[--n];
char_to[n] = b0;
char_to[n + 1] = b1;
}
}
}