diff --git a/headers/cpp/iostream.h b/headers/cpp/iostream.h index 22b9d69e25..0a68fe86da 100644 --- a/headers/cpp/iostream.h +++ b/headers/cpp/iostream.h @@ -271,11 +271,6 @@ __asm__ ("__IO_clog") #endif ; -extern istream& lock(istream& ins); -extern istream& unlock(istream& ins); -extern ostream& lock(ostream& outs); -extern ostream& unlock(ostream& outs); - struct Iostream_init { } ; // Compatibility hack for AT&T library. inline ios& dec(ios& i) diff --git a/headers/cpp/std/bastring.h b/headers/cpp/std/bastring.h index 59eceab5a1..46d07cd75b 100644 --- a/headers/cpp/std/bastring.h +++ b/headers/cpp/std/bastring.h @@ -66,8 +66,10 @@ extern void __length_error (const char *); #endif #ifdef __HAIKU__ +#ifndef atomic_add extern "C" __haiku_int32 atomic_add(__haiku_int32* value, __haiku_int32 addvalue); +#endif #endif /* __HAIKU__ */ template , diff --git a/headers/private/userlandfs/private/FSCapabilities.h b/headers/private/userlandfs/private/FSCapabilities.h index 27f6551eea..741c87af0d 100644 --- a/headers/private/userlandfs/private/FSCapabilities.h +++ b/headers/private/userlandfs/private/FSCapabilities.h @@ -8,6 +8,8 @@ #include #include +#include + #include "Debug.h" enum client_fs_type { @@ -148,7 +150,7 @@ namespace UserlandFSUtil { template struct FSCapabilitiesBase { - uint8 capabilities[(CapabilityCount + 7) / 8]; + std::bitset capabilities; inline void ClearAll(); @@ -171,7 +173,7 @@ template inline void FSCapabilitiesBase::ClearAll() { - memset(capabilities, 0, sizeof(capabilities)); + capabilities.reset(); } @@ -183,11 +185,7 @@ FSCapabilitiesBase::Set(uint32 capability, bool set) if (capability >= CapabilityCount) return; - uint8 flag = uint8(1 << (capability % 8)); - if (set) - capabilities[capability / 8] |= flag; - else - capabilities[capability / 8] &= ~flag; + capabilities.set(capability, set); } @@ -196,7 +194,10 @@ template inline void FSCapabilitiesBase::Clear(uint32 capability) { - Set(capability, false); + if (capability >= CapabilityCount) + return; + + capabilities.reset(capability); } @@ -208,8 +209,7 @@ FSCapabilitiesBase::Get(uint32 capability) const if (capability >= CapabilityCount) return false; - uint8 flag = uint8(1 << (capability % 8)); - return (capabilities[capability / 8] & flag); + return capabilities.test(capability); } @@ -218,12 +218,10 @@ template inline uint32 FSCapabilitiesBase::GetHashCode() const { - uint32 hashCode = 0; - int byteCount = sizeof(capabilities); - for (int i = 0; i < byteCount; i++) - hashCode = hashCode * 37 + capabilities[i]; - - return hashCode; + uint32 hash = 0; + for (int i = 0; i < CapabilityCount; i++) + hash ^= capabilities.test(i) << (i % 32); + return hash; } @@ -233,13 +231,7 @@ inline bool FSCapabilitiesBase::operator==( const FSCapabilitiesBase& other) const { - int byteCount = sizeof(capabilities); - for (int i = 0; i < byteCount; i++) { - if (capabilities[i] != other.capabilities[i]) - return false; - } - - return true; + return capabilities == other.capabilities; } @@ -249,12 +241,7 @@ inline void FSCapabilitiesBase::Dump() const { D( - char buffer[128]; - int byteCount = sizeof(capabilities); - for (int i = 0; i < byteCount; i++) - sprintf(buffer + 2 * i, "%02x", (int)capabilities[i]); - - PRINT(("FSCapabilities[%s]\n", buffer)); + PRINT(("FSCapabilities[%s]\n", capabilities.to_string().c_str())); ) } diff --git a/src/add-ons/kernel/file_systems/userlandfs/server/beos/Jamfile b/src/add-ons/kernel/file_systems/userlandfs/server/beos/Jamfile index ce4d64bf13..406ac87ce5 100644 --- a/src/add-ons/kernel/file_systems/userlandfs/server/beos/Jamfile +++ b/src/add-ons/kernel/file_systems/userlandfs/server/beos/Jamfile @@ -33,5 +33,5 @@ SharedLibrary libuserlandfs_beos_kernel.so : userlandfs_server - [ TargetLibsupc++ ] libbsd.so + [ TargetLibsupc++ ] [ TargetLibstdc++ ] libbsd.so ; diff --git a/src/add-ons/kernel/file_systems/userlandfs/server/fuse/Jamfile b/src/add-ons/kernel/file_systems/userlandfs/server/fuse/Jamfile index 1a1b058577..1928d9c3a8 100644 --- a/src/add-ons/kernel/file_systems/userlandfs/server/fuse/Jamfile +++ b/src/add-ons/kernel/file_systems/userlandfs/server/fuse/Jamfile @@ -36,7 +36,7 @@ SharedLibrary libuserlandfs_fuse.so FUSEVolume.cpp mime_ext_table.c : - userlandfs_server shared be [ TargetLibsupc++ ] + userlandfs_server shared be [ TargetLibsupc++ ] [ TargetLibstdc++ ] ; SEARCH on [ FGristFiles mime_ext_table.c ] diff --git a/src/add-ons/kernel/file_systems/userlandfs/server/haiku/Jamfile b/src/add-ons/kernel/file_systems/userlandfs/server/haiku/Jamfile index b59ea6cb24..f886f463c3 100644 --- a/src/add-ons/kernel/file_systems/userlandfs/server/haiku/Jamfile +++ b/src/add-ons/kernel/file_systems/userlandfs/server/haiku/Jamfile @@ -51,7 +51,7 @@ SharedLibrary libuserlandfs_haiku_kernel.so : userlandfs_server be # for BLocker only - [ TargetLibsupc++ ] + [ TargetLibsupc++ ] [ TargetLibstdc++ ] ;