Style fixes to Support Kit files

This commit is contained in:
John Scipione
2014-06-24 19:30:54 -04:00
parent 2661ce4605
commit 29e8fa5922
37 changed files with 268 additions and 248 deletions
+5 -11
View File
@@ -1,9 +1,9 @@
/* /*
* Copyright 2013, Haiku, Inc. All Rights Reserved. * Copyright 2013-2014 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef _SUPPORT_ARCHITECTURE_H #ifndef _ARCHITECTURE_H
#define _SUPPORT_ARCHITECTURE_H #define _ARCHITECTURE_H
#include <sys/cdefs.h> #include <sys/cdefs.h>
@@ -13,7 +13,6 @@
__BEGIN_DECLS __BEGIN_DECLS
const char* get_architecture(); const char* get_architecture();
const char* get_primary_architecture(); const char* get_primary_architecture();
size_t get_secondary_architectures(const char** architectures, size_t get_secondary_architectures(const char** architectures,
@@ -21,22 +20,17 @@ size_t get_secondary_architectures(const char** architectures,
size_t get_architectures(const char** architectures, size_t count); size_t get_architectures(const char** architectures, size_t count);
const char* guess_architecture_for_path(const char* path); const char* guess_architecture_for_path(const char* path);
__END_DECLS __END_DECLS
/* C++ API */ /* C++ API */
#ifdef __cplusplus #ifdef __cplusplus
#include <StringList.h> #include <StringList.h>
status_t get_secondary_architectures(BStringList& _architectures); status_t get_secondary_architectures(BStringList& _architectures);
status_t get_architectures(BStringList& _architectures); status_t get_architectures(BStringList& _architectures);
#endif /* __cplusplus */
#endif #endif /* _ARCHITECTURE_H */
#endif /* _SUPPORT_ARCHITECTURE_H */
+1 -1
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2001-2010, Haiku, Inc. All Rights Reserved. * Copyright 2001-2010 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef _ARCHIVABLE_H #ifndef _ARCHIVABLE_H
+4 -3
View File
@@ -2,8 +2,8 @@
* Copyright 2001-2009, Haiku, Inc. All Rights Reserved. * Copyright 2001-2009, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef _SUPPORT_AUTOLOCK_H #ifndef _AUTOLOCK_H
#define _SUPPORT_AUTOLOCK_H #define _AUTOLOCK_H
#include <Locker.h> #include <Locker.h>
@@ -101,4 +101,5 @@ BAutolock::Unlock()
fLocker->Unlock(); fLocker->Unlock();
} }
#endif // _SUPPORT_AUTOLOCK_H
#endif // _AUTOLOCK_H
+2 -2
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2007, Haiku, Inc. All Rights Reserved. * Copyright 2007-2014 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef _BEEP_H #ifndef _BEEP_H
@@ -17,6 +17,6 @@ status_t beep();
status_t system_beep(const char* eventName); status_t system_beep(const char* eventName);
status_t add_system_beep_event(const char* eventName, uint32 flags = 0); status_t add_system_beep_event(const char* eventName, uint32 flags = 0);
#endif #endif // __cplusplus
#endif // _BEEP_H #endif // _BEEP_H
+1
View File
@@ -61,4 +61,5 @@ class BBlockCache {
uint32 _reserved[2]; uint32 _reserved[2];
}; };
#endif // _BLOCK_CACHE_H #endif // _BLOCK_CACHE_H
+1 -1
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2007-2010, Haiku, Inc. All Rights Reserved. * Copyright 2007-2010 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef _BUFFER_IO_H #ifndef _BUFFER_IO_H
+1 -1
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2011, Haiku, Inc. All Rights Reserved. * Copyright 2011 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef _BUFFERED_DATA_IO_H #ifndef _BUFFERED_DATA_IO_H
+6 -6
View File
@@ -1,9 +1,9 @@
/* /*
* Copyright 2007, Haiku, Inc. All Rights Reserved. * Copyright 2007 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef _BYTEORDER_H #ifndef _BYTE_ORDER_H
#define _BYTEORDER_H #define _BYTE_ORDER_H
#include <BeBuild.h> #include <BeBuild.h>
@@ -111,7 +111,7 @@ typedef enum {
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif /* __cplusplus */
extern status_t swap_data(type_code type, void *data, size_t length, extern status_t swap_data(type_code type, void *data, size_t length,
swap_action action); swap_action action);
@@ -132,6 +132,6 @@ extern uint16 __swap_int16(uint16 arg);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif /* __cplusplus */
#endif /* _BYTEORDER_H */ #endif /* _BYTE_ORDER_H */
+1 -1
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2007, Haiku, Inc. All Rights Reserved. * Copyright 2007 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef _CLASS_INFO_H #ifndef _CLASS_INFO_H
+1 -1
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2005-2014, Haiku, Inc. All rights reserved. * Copyright 2005-2014 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef _DATA_IO_H #ifndef _DATA_IO_H
+4 -7
View File
@@ -1,9 +1,9 @@
/* /*
* Copyright 2007-2010, Haiku, Inc. All Rights Reserved. * Copyright 2007-2010 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef _DATE_TIME_H_ #ifndef _DATE_TIME_H
#define _DATE_TIME_H_ #define _DATE_TIME_H
#include <String.h> #include <String.h>
@@ -14,7 +14,6 @@ class BMessage;
namespace BPrivate { namespace BPrivate {
enum time_type { enum time_type {
B_GMT_TIME, B_GMT_TIME,
B_LOCAL_TIME B_LOCAL_TIME
@@ -206,10 +205,8 @@ private:
BTime fTime; BTime fTime;
}; };
} // namespace BPrivate } // namespace BPrivate
using BPrivate::time_type; using BPrivate::time_type;
using BPrivate::B_GMT_TIME; using BPrivate::B_GMT_TIME;
using BPrivate::B_LOCAL_TIME; using BPrivate::B_LOCAL_TIME;
@@ -224,4 +221,4 @@ using BPrivate::BDate;
using BPrivate::BDateTime; using BPrivate::BDateTime;
#endif // _DATE_TIME_H_ #endif // _DATE_TIME_H
+1 -1
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2007, Haiku, Inc. All Rights Reserved. * Copyright 2007 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef _DEBUG_H #ifndef _DEBUG_H
+1 -1
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2007-2014, Haiku, Inc. All Rights Reserved. * Copyright 2007-2014 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef _ERRORS_H #ifndef _ERRORS_H
+1 -1
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2007-2010, Haiku, Inc. All Rights Reserved. * Copyright 2007-2010 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef _FLATTENABLE_H #ifndef _FLATTENABLE_H
+6 -5
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2001-2009, Haiku, Inc. All Rights Reserved. * Copyright 2001-2009 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef _BE_LIST_H #ifndef _BE_LIST_H
@@ -12,14 +12,14 @@
class BList { class BList {
public: public:
BList(int32 count = 20); BList(int32 count = 20);
BList(const BList& anotherList); BList(const BList& other);
virtual ~BList(); virtual ~BList();
BList& operator=(const BList& other); BList& operator=(const BList& other);
bool operator==(const BList& other) const; bool operator==(const BList& other) const;
bool operator!=(const BList& other) const; bool operator!=(const BList& other) const;
// Adding and removing items. // Adding and removing items
bool AddItem(void* item, int32 index); bool AddItem(void* item, int32 index);
bool AddItem(void* item); bool AddItem(void* item);
bool AddList(const BList* list, int32 index); bool AddList(const BList* list, int32 index);
@@ -28,7 +28,7 @@ public:
bool RemoveItem(void* item); bool RemoveItem(void* item);
void* RemoveItem(int32 index); void* RemoveItem(int32 index);
bool RemoveItems(int32 index, int32 count); bool RemoveItems(int32 index, int32 count);
bool ReplaceItem(int32 index, void* newItem); bool ReplaceItem(int32 index, void* item);
void MakeEmpty(); void MakeEmpty();
@@ -36,7 +36,7 @@ public:
void SortItems(int (*compareFunc)(const void*, void SortItems(int (*compareFunc)(const void*,
const void*)); const void*));
bool SwapItems(int32 indexA, int32 indexB); bool SwapItems(int32 indexA, int32 indexB);
bool MoveItem(int32 fromIndex, int32 toIndex); bool MoveItem(int32 from, int32 to);
// Retrieve items // Retrieve items
void* ItemAt(int32 index) const; void* ItemAt(int32 index) const;
@@ -76,4 +76,5 @@ private:
uint32 _reserved[1]; uint32 _reserved[1];
}; };
#endif // _BE_LIST_H #endif // _BE_LIST_H
+1 -1
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2001-2010, Haiku, Inc. All Rights Reserved. * Copyright 2001-2010 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef _LOCKER_H #ifndef _LOCKER_H
+16 -13
View File
@@ -51,11 +51,12 @@ template<class T> class BObjectList;
template<class T> template<class T>
struct UnaryPredicate { struct UnaryPredicate {
virtual int operator()(const T *) const virtual int operator()(const T *) const
// virtual could be avoided here if FindBinaryInsertionIndex, // virtual could be avoided here if FindBinaryInsertionIndex,
// etc. were member template functions // etc. were member template functions
{ return 0; } {
return 0;
}
private: private:
static int _unary_predicate_glue(const void *item, void *context); static int _unary_predicate_glue(const void *item, void *context);
@@ -112,7 +113,6 @@ protected:
template<class T> template<class T>
class BObjectList : private _PointerList_ { class BObjectList : private _PointerList_ {
public: public:
// iteration and sorting // iteration and sorting
typedef T* (*EachFunction)(T*, void*); typedef T* (*EachFunction)(T*, void*);
typedef const T* (*ConstEachFunction)(const T*, void*); typedef const T* (*ConstEachFunction)(const T*, void*);
@@ -424,7 +424,7 @@ BObjectList<T>::BObjectList(int32 itemsPerBlock, bool owning)
template<class T> template<class T>
BObjectList<T>::BObjectList(const BObjectList<T> &list) BObjectList<T>::BObjectList(const BObjectList<T>& list)
: :
_PointerList_(list) _PointerList_(list)
{ {
@@ -483,25 +483,25 @@ BObjectList<T>::AddItem(T* item)
template<class T> template<class T>
bool bool
BObjectList<T>::AddItem(T* item, int32 atIndex) BObjectList<T>::AddItem(T* item, int32 index)
{ {
return _PointerList_::AddItem((void*)item, atIndex); return _PointerList_::AddItem((void*)item, index);
} }
template<class T> template<class T>
bool bool
BObjectList<T>::AddList(BObjectList<T>* newItems) BObjectList<T>::AddList(BObjectList<T>* list)
{ {
return _PointerList_::AddList(newItems); return _PointerList_::AddList(list);
} }
template<class T> template<class T>
bool bool
BObjectList<T>::AddList(BObjectList<T>* newItems, int32 atIndex) BObjectList<T>::AddList(BObjectList<T>* list, int32 index)
{ {
return _PointerList_::AddList(newItems, atIndex); return _PointerList_::AddList(list, index);
} }
@@ -540,16 +540,18 @@ BObjectList<T>::ReplaceItem(int32 index, T* item)
{ {
if (owning) if (owning)
delete ItemAt(index); delete ItemAt(index);
return _PointerList_::ReplaceItem(index, (void*)item); return _PointerList_::ReplaceItem(index, (void*)item);
} }
template<class T> template<class T>
T* T*
BObjectList<T>::SwapWithItem(int32 index, T* newItem) BObjectList<T>::SwapWithItem(int32 index, T* item)
{ {
T* result = ItemAt(index); T* result = ItemAt(index);
_PointerList_::ReplaceItem(index, (void*)newItem); _PointerList_::ReplaceItem(index, (void*)item);
return result; return result;
} }
@@ -712,6 +714,7 @@ BObjectList<T>::BinarySearch(const T& key, CompareFunction func) const
return (T*)_PointerList_::BinarySearch(&key, (GenericCompareFunction)func); return (T*)_PointerList_::BinarySearch(&key, (GenericCompareFunction)func);
} }
template<class T> template<class T>
T* T*
BObjectList<T>::BinarySearch(const T& key, CompareFunctionWithState func, BObjectList<T>::BinarySearch(const T& key, CompareFunctionWithState func,
@@ -942,4 +945,4 @@ BObjectList<T>::BinaryInsertUnique(T* item, const UnaryPredicate<T>& pred)
} }
#endif /* _OBJECT_LIST_H */ #endif // _OBJECT_LIST_H
+25 -24
View File
@@ -1,9 +1,9 @@
/* /*
* Copyright 2001-2010, Haiku Inc. All Rights Reserved. * Copyright 2001-2010 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef __BSTRING__ #ifndef _B_STRING_H
#define __BSTRING__ #define _B_STRING_H
#include <stdarg.h> #include <stdarg.h>
@@ -383,7 +383,7 @@ private:
// Escape // Escape
BString& _DoCharacterEscape(const char* string, BString& _DoCharacterEscape(const char* string,
const char *setOfCharsToEscape, char escapeChar); const char* setOfCharsToEscape, char escapeChar);
BString& _DoCharacterDeescape(const char* string, BString& _DoCharacterDeescape(const char* string,
char escapeChar); char escapeChar);
@@ -426,7 +426,7 @@ BString::Length() const
{ {
// the most significant bit is reserved; accessing // the most significant bit is reserved; accessing
// it in any way will cause the computer to explode // it in any way will cause the computer to explode
return fPrivateData ? (*(((int32 *)fPrivateData) - 1) & 0x7fffffff) : 0; return fPrivateData ? (*(((int32*)fPrivateData) - 1) & 0x7fffffff) : 0;
} }
@@ -453,7 +453,7 @@ BString::HashValue() const
} }
inline BString & inline BString&
BString::SetTo(const char* string) BString::SetTo(const char* string)
{ {
return operator=(string); return operator=(string);
@@ -476,23 +476,23 @@ BString::ByteAt(int32 index) const
} }
inline BString & inline BString&
BString::operator+=(const BString &string) BString::operator+=(const BString& string)
{ {
_DoAppend(string.String(), string.Length()); _DoAppend(string.String(), string.Length());
return *this; return *this;
} }
inline BString & inline BString&
BString::Append(const BString &string) BString::Append(const BString& string)
{ {
_DoAppend(string.String(), string.Length()); _DoAppend(string.String(), string.Length());
return *this; return *this;
} }
inline BString & inline BString&
BString::Append(const char* string) BString::Append(const char* string)
{ {
return operator+=(string); return operator+=(string);
@@ -500,42 +500,42 @@ BString::Append(const char* string)
inline bool inline bool
BString::operator==(const BString &string) const BString::operator==(const BString& string) const
{ {
return strcmp(String(), string.String()) == 0; return strcmp(String(), string.String()) == 0;
} }
inline bool inline bool
BString::operator<(const BString &string) const BString::operator<(const BString& string) const
{ {
return strcmp(String(), string.String()) < 0; return strcmp(String(), string.String()) < 0;
} }
inline bool inline bool
BString::operator<=(const BString &string) const BString::operator<=(const BString& string) const
{ {
return strcmp(String(), string.String()) <= 0; return strcmp(String(), string.String()) <= 0;
} }
inline bool inline bool
BString::operator>=(const BString &string) const BString::operator>=(const BString& string) const
{ {
return strcmp(String(), string.String()) >= 0; return strcmp(String(), string.String()) >= 0;
} }
inline bool inline bool
BString::operator>(const BString &string) const BString::operator>(const BString& string) const
{ {
return strcmp(String(), string.String()) > 0; return strcmp(String(), string.String()) > 0;
} }
inline bool inline bool
BString::operator!=(const BString &string) const BString::operator!=(const BString& string) const
{ {
return strcmp(String(), string.String()) != 0; return strcmp(String(), string.String()) != 0;
} }
@@ -556,42 +556,42 @@ BString::operator const char*() const
inline bool inline bool
operator<(const char *str, const BString &string) operator<(const char* str, const BString& string)
{ {
return string > str; return string > str;
} }
inline bool inline bool
operator<=(const char *str, const BString &string) operator<=(const char* str, const BString& string)
{ {
return string >= str; return string >= str;
} }
inline bool inline bool
operator==(const char *str, const BString &string) operator==(const char* str, const BString& string)
{ {
return string == str; return string == str;
} }
inline bool inline bool
operator>(const char *str, const BString &string) operator>(const char* str, const BString& string)
{ {
return string < str; return string < str;
} }
inline bool inline bool
operator>=(const char *str, const BString &string) operator>=(const char* str, const BString& string)
{ {
return string <= str; return string <= str;
} }
inline bool inline bool
operator!=(const char *str, const BString &string) operator!=(const char* str, const BString& string)
{ {
return string != str; return string != str;
} }
@@ -618,4 +618,5 @@ private:
int32 fPosition; int32 fPosition;
}; };
#endif // __BSTRING__
#endif // _B_STRING_H
+4 -4
View File
@@ -1,9 +1,9 @@
/* /*
* Copyright 2011, Haiku, Inc. All Rights Reserved. * Copyright 2011 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef _SUPPORT_BSTRING_LIST_H_ #ifndef _STRING_LIST_H
#define _SUPPORT_BSTRING_LIST_H_ #define _STRING_LIST_H
#include <BeBuild.h> #include <BeBuild.h>
@@ -100,4 +100,4 @@ BStringList::operator!=(const BStringList& other) const
} }
#endif // _SUPPORT_BSTRING_LIST_H_ #endif // _STRING_LIST_H
+1 -1
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2004-2010, Haiku, Inc. All Rights Reserved. * Copyright 2004-2010 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Author: * Author:
+6 -6
View File
@@ -1,9 +1,9 @@
/* /*
* Copyright 2003-2007, Haiku, Inc. All Rights Reserved. * Copyright 2003-2007 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef _TLS_H #ifndef _TLS_H
#define _TLS_H #define _TLS_H
#include <BeBuild.h> #include <BeBuild.h>
@@ -19,7 +19,7 @@
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif /* __cplusplus */
extern int32 tls_allocate(void); extern int32 tls_allocate(void);
@@ -54,16 +54,16 @@ tls_set(int32 index, void *value)
: : "r" (index), "r" (value)); : : "r" (index), "r" (value));
} }
#else #else /* !_NO_INLINE_ASM && __INTEL__ && __GNUC__ */
extern void *tls_get(int32 index); extern void *tls_get(int32 index);
extern void **tls_address(int32 index); extern void **tls_address(int32 index);
extern void tls_set(int32 index, void *value); extern void tls_set(int32 index, void *value);
#endif #endif /* !_NO_INLINE_ASM && __INTEL__ && __GNUC__ */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif /* __cplusplus */
#endif /* _TLS_H */ #endif /* _TLS_H */
+31 -17
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2005-2010, Haiku, Inc. All Rights Reserved. * Copyright 2005-2010 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Author: * Author:
@@ -63,23 +63,37 @@ enum {
B_NETWORK_ADDRESS_TYPE = 'NWAD', B_NETWORK_ADDRESS_TYPE = 'NWAD',
B_MIME_STRING_TYPE = 'MIMS', B_MIME_STRING_TYPE = 'MIMS',
// deprecated, do not use /* deprecated, do not use */
B_ASCII_TYPE = 'TEXT' // use B_STRING_TYPE instead B_ASCII_TYPE = 'TEXT'
/* use B_STRING_TYPE instead */
}; };
// System-wide MIME types for handling URL's /* System-wide MIME types for handling URL's */
extern const char *B_URL_HTTP; // application/x-vnd.Be.URL.http extern const char* B_URL_HTTP;
extern const char *B_URL_HTTPS; // application/x-vnd.Be.URL.https /* application/x-vnd.Be.URL.http */
extern const char *B_URL_FTP; // application/x-vnd.Be.URL.ftp extern const char* B_URL_HTTPS;
extern const char *B_URL_GOPHER; // application/x-vnd.Be.URL.gopher /* application/x-vnd.Be.URL.https */
extern const char *B_URL_MAILTO; // application/x-vnd.Be.URL.mailto extern const char* B_URL_FTP;
extern const char *B_URL_NEWS; // application/x-vnd.Be.URL.news /* application/x-vnd.Be.URL.ftp */
extern const char *B_URL_NNTP; // application/x-vnd.Be.URL.nntp extern const char* B_URL_GOPHER;
extern const char *B_URL_TELNET; // application/x-vnd.Be.URL.telnet /* application/x-vnd.Be.URL.gopher */
extern const char *B_URL_RLOGIN; // application/x-vnd.Be.URL.rlogin extern const char* B_URL_MAILTO;
extern const char *B_URL_TN3270; // application/x-vnd.Be.URL.tn3270 /* application/x-vnd.Be.URL.mailto */
extern const char *B_URL_WAIS; // application/x-vnd.Be.URL.wais extern const char* B_URL_NEWS;
extern const char *B_URL_FILE; // application/x-vnd.Be.URL.file /* application/x-vnd.Be.URL.news */
extern const char* B_URL_NNTP;
/* application/x-vnd.Be.URL.nntp */
extern const char* B_URL_TELNET;
/* application/x-vnd.Be.URL.telnet */
extern const char* B_URL_RLOGIN;
/* application/x-vnd.Be.URL.rlogin */
extern const char* B_URL_TN3270;
/* application/x-vnd.Be.URL.tn3270 */
extern const char* B_URL_WAIS;
/* application/x-vnd.Be.URL.wais */
extern const char* B_URL_FILE;
/* application/x-vnd.Be.URL.file */
#endif // _TYPE_CONSTANTS_H
#endif /* _TYPE_CONSTANTS_H */
+20 -20
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2007, Haiku, Inc. All Rights Reserved. * Copyright 2007 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef _UTF8_H #ifndef _UTF8_H
@@ -11,9 +11,9 @@
#include <SupportDefs.h> #include <SupportDefs.h>
// Conversion Flavors /* Conversion Flavors */
enum { enum {
B_ISO1_CONVERSION, // ISO 8859-x B_ISO1_CONVERSION, /* ISO 8859-x */
B_ISO2_CONVERSION, B_ISO2_CONVERSION,
B_ISO3_CONVERSION, B_ISO3_CONVERSION,
B_ISO4_CONVERSION, B_ISO4_CONVERSION,
@@ -23,28 +23,28 @@ enum {
B_ISO8_CONVERSION, B_ISO8_CONVERSION,
B_ISO9_CONVERSION, B_ISO9_CONVERSION,
B_ISO10_CONVERSION, B_ISO10_CONVERSION,
B_MAC_ROMAN_CONVERSION, // Macintosh Roman B_MAC_ROMAN_CONVERSION, /* Macintosh Roman */
B_SJIS_CONVERSION, // Shift-JIS B_SJIS_CONVERSION, /* Shift-JIS */
B_EUC_CONVERSION, // EUC Packed Japanese B_EUC_CONVERSION, /* EUC Packed Japanese */
B_JIS_CONVERSION, // JIS X 0208-1990 B_JIS_CONVERSION, /* JIS X 0208-1990 */
B_MS_WINDOWS_CONVERSION, // Windows Latin-1 Codepage 1252 B_MS_WINDOWS_CONVERSION, /* Windows Latin-1 Codepage 1252 */
B_UNICODE_CONVERSION, // Unicode 2.0, UCS-2 B_UNICODE_CONVERSION, /* Unicode 2.0, UCS-2 */
B_KOI8R_CONVERSION, // KOI8-R B_KOI8R_CONVERSION, /* KOI8-R */
B_MS_WINDOWS_1251_CONVERSION, // Windows Cyrillic Codepage 1251 B_MS_WINDOWS_1251_CONVERSION, /* Windows Cyrillic Codepage 1251 */
B_MS_DOS_866_CONVERSION, // MS-DOS Codepage 866 B_MS_DOS_866_CONVERSION, /* MS-DOS Codepage 866 */
B_MS_DOS_CONVERSION, // MS-DOS Codepage 437 B_MS_DOS_CONVERSION, /* MS-DOS Codepage 437 */
B_EUC_KR_CONVERSION, // EUC Korean B_EUC_KR_CONVERSION, /* EUC Korean */
B_ISO13_CONVERSION, B_ISO13_CONVERSION,
B_ISO14_CONVERSION, B_ISO14_CONVERSION,
B_ISO15_CONVERSION, B_ISO15_CONVERSION,
B_BIG5_CONVERSION, // Chinese Big5 B_BIG5_CONVERSION, /* Chinese Big5 */
B_GBK_CONVERSION, // Chinese GB18030 B_GBK_CONVERSION, /* Chinese GB18030 */
B_UTF16_CONVERSION, // Unicode UTF-16 B_UTF16_CONVERSION, /* Unicode UTF-16 */
B_MS_WINDOWS_1250_CONVERSION // Windows Central European Codepage B_MS_WINDOWS_1250_CONVERSION /* Windows Central European Codepage */
}; };
// Conversion Functions /* Conversion Functions */
#ifdef __cplusplus #ifdef __cplusplus
@@ -56,6 +56,6 @@ status_t convert_from_utf8(uint32 destEncoding, const char* source,
int32* sourceLength, char* dest, int32* destLength, int32* state, int32* sourceLength, char* dest, int32* destLength, int32* state,
char substitute = B_SUBSTITUTE); char substitute = B_SUBSTITUTE);
#endif #endif /* __cplusplus */
#endif /* _UTF8_H */ #endif /* _UTF8_H */
+3 -3
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2007, Haiku, Inc. All Rights Reserved. * Copyright 2003-2007 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef _PARSEDATE_H #ifndef _PARSEDATE_H
@@ -19,7 +19,7 @@
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif /* __cplusplus */
extern time_t parsedate(const char *dateString, time_t now); extern time_t parsedate(const char *dateString, time_t now);
extern time_t parsedate_etc(const char *dateString, time_t now, int *_storedFlags); extern time_t parsedate_etc(const char *dateString, time_t now, int *_storedFlags);
@@ -29,6 +29,6 @@ extern const char **get_dateformats(void);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif /* __cplusplus */
#endif /* _PARSEDATE_H */ #endif /* _PARSEDATE_H */
+20 -19
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2001-2012, Haiku, Inc. * Copyright 2001-2012 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
@@ -237,9 +237,7 @@ check_signature(const char* signature, image_info& info)
} }
namespace BPrivate namespace BPrivate {
{
instantiation_func instantiation_func
find_instantiation_func(const char* className, const char* signature, find_instantiation_func(const char* className, const char* signature,
@@ -294,11 +292,10 @@ find_instantiation_func(const char* className, const char* signature,
return instantiationFunc; return instantiationFunc;
} }
} // namespace BPrivate
}
// #pragma mark - // #pragma mark - BArchivable
BArchivable::BArchivable() BArchivable::BArchivable()
@@ -374,6 +371,7 @@ BArchivable::Perform(perform_code d, void* arg)
return B_OK; return B_OK;
} }
} }
return B_NAME_NOT_FOUND; return B_NAME_NOT_FOUND;
} }
@@ -392,7 +390,7 @@ BArchivable::AllArchived(BMessage* archive) const
} }
// #pragma mark - // #pragma mark - BArchiver
BArchiver::BArchiver(BMessage* archive) BArchiver::BArchiver(BMessage* archive)
@@ -401,7 +399,7 @@ BArchiver::BArchiver(BMessage* archive)
fArchive(archive), fArchive(archive),
fFinished(false) fFinished(false)
{ {
if (!fManager) if (fManager == NULL)
fManager = new BArchiveManager(this); fManager = new BArchiveManager(this);
} }
@@ -467,7 +465,7 @@ BArchiver::RegisterArchivable(const BArchivable* archivable)
} }
// #pragma mark - // #pragma mark - BUnarchiver
BUnarchiver::BUnarchiver(const BMessage* archive) BUnarchiver::BUnarchiver(const BMessage* archive)
@@ -525,6 +523,7 @@ BUnarchiver::IsInstantiated(const char* field, int32 index)
int32 token; int32 token;
if (fArchive->FindInt32(field, index, &token) == B_OK) if (fArchive->FindInt32(field, index, &token) == B_OK)
return IsInstantiated(token); return IsInstantiated(token);
return false; return false;
} }
@@ -573,7 +572,7 @@ BUnarchiver::IsArchiveManaged(const BMessage* archive)
if (BManagerBase::ManagerPointer(archive)) if (BManagerBase::ManagerPointer(archive))
return true; return true;
if (!archive) if (archive == NULL)
return false; return false;
// managed top level archives return here // managed top level archives return here
@@ -588,7 +587,7 @@ BUnarchiver::IsArchiveManaged(const BMessage* archive)
template<> template<>
status_t status_t
BUnarchiver::InstantiateObject<BArchivable>(BMessage* from, BUnarchiver::InstantiateObject<BArchivable>(BMessage* from,
BArchivable*& object) BArchivable* &object)
{ {
BUnarchiver unarchiver(BUnarchiver::PrepareArchive(from)); BUnarchiver unarchiver(BUnarchiver::PrepareArchive(from));
object = instantiate_object(from); object = instantiate_object(from);
@@ -597,7 +596,7 @@ BUnarchiver::InstantiateObject<BArchivable>(BMessage* from,
BMessage* BMessage*
BUnarchiver::PrepareArchive(BMessage*& archive) BUnarchiver::PrepareArchive(BMessage* &archive)
{ {
// this check allows PrepareArchive to be // this check allows PrepareArchive to be
// called on new or old-style archives // called on new or old-style archives
@@ -605,8 +604,10 @@ BUnarchiver::PrepareArchive(BMessage*& archive)
BUnarchiveManager* manager = BManagerBase::UnarchiveManager(archive); BUnarchiveManager* manager = BManagerBase::UnarchiveManager(archive);
if (!manager) if (!manager)
manager = new BUnarchiveManager(archive); manager = new BUnarchiveManager(archive);
manager->Acquire(); manager->Acquire();
} }
return archive; return archive;
} }
@@ -744,6 +745,9 @@ instantiate_object(BMessage* from)
} }
// #pragma mark - support_globals
bool bool
validate_instantiation(BMessage* from, const char* className) validate_instantiation(BMessage* from, const char* className)
{ {
@@ -807,10 +811,11 @@ find_instantiation_func(BMessage* archive)
} }
// BArchivable binary compatibility // #pragma mark - BArchivable binary compatibility
#if __GNUC__ == 2
#if __GNUC__ == 2
extern "C" status_t extern "C" status_t
_ReservedArchivable1__11BArchivable(BArchivable* archivable, _ReservedArchivable1__11BArchivable(BArchivable* archivable,
const BMessage* archive) const BMessage* archive)
@@ -839,7 +844,6 @@ _ReservedArchivable2__11BArchivable(BArchivable* archivable,
#elif __GNUC__ > 2 #elif __GNUC__ > 2
extern "C" status_t extern "C" status_t
_ZN11BArchivable20_ReservedArchivable1Ev(BArchivable* archivable, _ZN11BArchivable20_ReservedArchivable1Ev(BArchivable* archivable,
const BMessage* archive) const BMessage* archive)
@@ -865,10 +869,7 @@ _ZN11BArchivable20_ReservedArchivable2Ev(BArchivable* archivable,
return performData.return_value; return performData.return_value;
} }
#endif // _GNUC__ > 2 #endif // _GNUC__ > 2
void BArchivable::_ReservedArchivable3() {} void BArchivable::_ReservedArchivable3() {}
+3 -2
View File
@@ -1,11 +1,12 @@
/* /*
* Copyright (c) 2010, Haiku, Inc. * Copyright 2010 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
* Alex Wilson (yourpalal2@gmail.com) * Alex Wilson, yourpalal2@gmail.com
*/ */
#include "ArchivingManagers.h" #include "ArchivingManagers.h"
#include <syslog.h> #include <syslog.h>
+3 -2
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010, Haiku, Inc. All Rights Reserved. * Copyright 2010 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef _ARCHIVING_MANAGERS_H #ifndef _ARCHIVING_MANAGERS_H
@@ -165,4 +165,5 @@ private:
} // namespace Archiving } // namespace Archiving
} // namespace BPrivate } // namespace BPrivate
#endif
#endif // _ARCHIVING_MANAGERS_H
+10 -11
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2011-2013, Haiku, Inc. All rights reserved. * Copyright 2011-2013 Haiku, Inc. All rights reserved.
* Copyright 2001-2003 Dr. Zoidberg Enterprises. All rights reserved. * Copyright 2001-2003 Dr. Zoidberg Enterprises. All rights reserved.
*/ */
@@ -12,14 +12,14 @@
static const char kBase64Alphabet[64] = { static const char kBase64Alphabet[64] = {
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'+', '+',
'/' '/'
}; };
ssize_t ssize_t
@@ -141,5 +141,4 @@ decode_base64(char *out, const char *in, off_t length)
{ {
return decode_base64(out, in, length); return decode_base64(out, in, length);
} }
#endif // __GNUC__ <= 2
#endif
-1
View File
@@ -57,4 +57,3 @@ add_system_beep_event(const char* name, uint32 flags)
return status; return status;
} }
+3 -3
View File
@@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2001-2008, Haiku * Copyright 2001-2008 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT license * Distributed under the terms of the MIT license
* *
* Authors: * Authors:
* Stefano Ceccherini (burton666@libero.it) * Stefano Ceccherini, burton666@libero.it
*/ */
@@ -253,7 +253,7 @@ BBufferIO::PrintToStream() const
} }
// #pragma mark - // #pragma mark - FBC padding
// These functions are here to maintain future binary // These functions are here to maintain future binary
+18 -12
View File
@@ -1,9 +1,9 @@
/* /*
* Copyright 2005-2014, Haiku, Inc. * Copyright 2005-2014 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
* Stefano Ceccherini (burton666@libero.it) * Stefano Ceccherini, burton666@libero.it
*/ */
@@ -145,7 +145,7 @@ BPositionIO::~BPositionIO()
ssize_t ssize_t
BPositionIO::Read(void *buffer, size_t size) BPositionIO::Read(void* buffer, size_t size)
{ {
off_t curPos = Position(); off_t curPos = Position();
ssize_t result = ReadAt(curPos, buffer, size); ssize_t result = ReadAt(curPos, buffer, size);
@@ -157,7 +157,7 @@ BPositionIO::Read(void *buffer, size_t size)
ssize_t ssize_t
BPositionIO::Write(const void *buffer, size_t size) BPositionIO::Write(const void* buffer, size_t size)
{ {
off_t curPos = Position(); off_t curPos = Position();
ssize_t result = WriteAt(curPos, buffer, size); ssize_t result = WriteAt(curPos, buffer, size);
@@ -216,7 +216,7 @@ void BPositionIO::_ReservedPositionIO12(){}
// #pragma mark - // #pragma mark -
BMemoryIO::BMemoryIO(void *buffer, size_t length) BMemoryIO::BMemoryIO(void* buffer, size_t length)
: :
fReadOnly(false), fReadOnly(false),
fBuffer(static_cast<char*>(buffer)), fBuffer(static_cast<char*>(buffer)),
@@ -227,7 +227,7 @@ BMemoryIO::BMemoryIO(void *buffer, size_t length)
} }
BMemoryIO::BMemoryIO(const void *buffer, size_t length) BMemoryIO::BMemoryIO(const void* buffer, size_t length)
: :
fReadOnly(true), fReadOnly(true),
fBuffer(const_cast<char*>(static_cast<const char*>(buffer))), fBuffer(const_cast<char*>(static_cast<const char*>(buffer))),
@@ -244,7 +244,7 @@ BMemoryIO::~BMemoryIO()
ssize_t ssize_t
BMemoryIO::ReadAt(off_t pos, void *buffer, size_t size) BMemoryIO::ReadAt(off_t pos, void* buffer, size_t size)
{ {
if (buffer == NULL || pos < 0) if (buffer == NULL || pos < 0)
return B_BAD_VALUE; return B_BAD_VALUE;
@@ -254,12 +254,13 @@ BMemoryIO::ReadAt(off_t pos, void *buffer, size_t size)
sizeRead = min_c((off_t)size, (off_t)fLength - pos); sizeRead = min_c((off_t)size, (off_t)fLength - pos);
memcpy(buffer, fBuffer + pos, sizeRead); memcpy(buffer, fBuffer + pos, sizeRead);
} }
return sizeRead; return sizeRead;
} }
ssize_t ssize_t
BMemoryIO::WriteAt(off_t pos, const void *buffer, size_t size) BMemoryIO::WriteAt(off_t pos, const void* buffer, size_t size)
{ {
if (fReadOnly) if (fReadOnly)
return B_NOT_ALLOWED; return B_NOT_ALLOWED;
@@ -296,6 +297,7 @@ BMemoryIO::Seek(off_t position, uint32 seek_mode)
default: default:
break; break;
} }
return fPosition; return fPosition;
} }
@@ -317,6 +319,7 @@ BMemoryIO::SetSize(off_t size)
return B_ERROR; return B_ERROR;
fLength = size; fLength = size;
return B_OK; return B_OK;
} }
@@ -363,7 +366,7 @@ BMallocIO::~BMallocIO()
ssize_t ssize_t
BMallocIO::ReadAt(off_t pos, void *buffer, size_t size) BMallocIO::ReadAt(off_t pos, void* buffer, size_t size)
{ {
if (buffer == NULL) if (buffer == NULL)
return B_BAD_VALUE; return B_BAD_VALUE;
@@ -373,12 +376,13 @@ BMallocIO::ReadAt(off_t pos, void *buffer, size_t size)
sizeRead = min_c((off_t)size, (off_t)fLength - pos); sizeRead = min_c((off_t)size, (off_t)fLength - pos);
memcpy(buffer, fData + pos, sizeRead); memcpy(buffer, fData + pos, sizeRead);
} }
return sizeRead; return sizeRead;
} }
ssize_t ssize_t
BMallocIO::WriteAt(off_t pos, const void *buffer, size_t size) BMallocIO::WriteAt(off_t pos, const void* buffer, size_t size)
{ {
if (buffer == NULL) if (buffer == NULL)
return B_BAD_VALUE; return B_BAD_VALUE;
@@ -394,6 +398,7 @@ BMallocIO::WriteAt(off_t pos, const void *buffer, size_t size)
if (pos + size > fLength) if (pos + size > fLength)
fLength = pos + size; fLength = pos + size;
} }
return error != B_OK ? error : size; return error != B_OK ? error : size;
} }
@@ -439,7 +444,7 @@ BMallocIO::SetSize(off_t size)
size_t newSize = (size + fBlockSize - 1) / fBlockSize * fBlockSize; size_t newSize = (size + fBlockSize - 1) / fBlockSize * fBlockSize;
if (size != (off_t)fMallocSize) { if (size != (off_t)fMallocSize) {
// we need to resize // we need to resize
if (char *newData = static_cast<char*>(realloc(fData, newSize))) { if (char* newData = static_cast<char*>(realloc(fData, newSize))) {
// set the new area to 0 // set the new area to 0
if (newSize > fMallocSize) if (newSize > fMallocSize)
memset(newData + fMallocSize, 0, newSize - fMallocSize); memset(newData + fMallocSize, 0, newSize - fMallocSize);
@@ -462,12 +467,13 @@ BMallocIO::SetBlockSize(size_t blockSize)
{ {
if (blockSize == 0) if (blockSize == 0)
blockSize = 1; blockSize = 1;
if (blockSize != fBlockSize) if (blockSize != fBlockSize)
fBlockSize = blockSize; fBlockSize = blockSize;
} }
const void * const void*
BMallocIO::Buffer() const BMallocIO::Buffer() const
{ {
return fData; return fData;
+4 -6
View File
@@ -1,10 +1,10 @@
/* /*
* Copyright 2007-2010, Haiku, Inc. All Rights Reserved. * Copyright 2007-2010 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
* Julun <host.haiku@gmx.de> * Stephan Aßmus, superstippi@gmx.de
* Stephan Aßmus <superstippi@gmx.de> * Julun, host.haiku@gmx.de
*/ */
#include "DateTime.h" #include "DateTime.h"
@@ -18,7 +18,6 @@
namespace BPrivate { namespace BPrivate {
const int32 kSecondsPerMinute = 60; const int32 kSecondsPerMinute = 60;
const int32 kHoursPerDay = 24; const int32 kHoursPerDay = 24;
@@ -1496,5 +1495,4 @@ BDateTime::operator>=(const BDateTime& dateTime) const
return false; return false;
} }
} /* namespace BPrivate */
} //namespace BPrivate
+43 -41
View File
@@ -1,12 +1,13 @@
/* /*
* Copyright 2001-2009, Haiku, Inc. All Rights Reserved. * Copyright 2001-2014 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
* The Storage kit Team * The Storage Kit Team
* Isaac Yonemoto
* Rene Gollent
* Stephan Aßmus * Stephan Aßmus
* Rene Gollent
* John Scipione, jscipione@gmail.com
* Isaac Yonemoto
*/ */
//! BList class provides storage for pointers. Not thread safe. //! BList class provides storage for pointers. Not thread safe.
@@ -42,14 +43,14 @@ BList::BList(int32 count)
} }
BList::BList(const BList& anotherList) BList::BList(const BList& other)
: :
fObjectList(NULL), fObjectList(NULL),
fPhysicalSize(0), fPhysicalSize(0),
fItemCount(0), fItemCount(0),
fBlockSize(anotherList.fBlockSize) fBlockSize(other.fBlockSize)
{ {
*this = anotherList; *this = other;
} }
@@ -60,13 +61,13 @@ BList::~BList()
BList& BList&
BList::operator=(const BList& list) BList::operator=(const BList& other)
{ {
if (&list != this) { if (&other != this) {
fBlockSize = list.fBlockSize; fBlockSize = other.fBlockSize;
if (_ResizeArray(list.fItemCount)) { if (_ResizeArray(other.fItemCount)) {
fItemCount = list.fItemCount; fItemCount = other.fItemCount;
memcpy(fObjectList, list.fObjectList, fItemCount * sizeof(void*)); memcpy(fObjectList, other.fObjectList, fItemCount * sizeof(void*));
} }
} }
@@ -75,16 +76,16 @@ BList::operator=(const BList& list)
bool bool
BList::operator==(const BList& list) const BList::operator==(const BList& other) const
{ {
if (&list == this) if (&other == this)
return true; return true;
if (list.fItemCount != fItemCount) if (other.fItemCount != fItemCount)
return false; return false;
if (fItemCount > 0) { if (fItemCount > 0) {
return memcmp(fObjectList, list.fObjectList, return memcmp(fObjectList, other.fObjectList,
fItemCount * sizeof(void*)) == 0; fItemCount * sizeof(void*)) == 0;
} }
@@ -93,9 +94,9 @@ BList::operator==(const BList& list) const
bool bool
BList::operator!=(const BList& list) const BList::operator!=(const BList& other) const
{ {
return !(*this == list); return !(*this == other);
} }
@@ -143,6 +144,7 @@ BList::AddList(const BList* list, int32 index)
int32 count = list->fItemCount; int32 count = list->fItemCount;
if (fItemCount + count > fPhysicalSize) if (fItemCount + count > fPhysicalSize)
result = _ResizeArray(fItemCount + count); result = _ResizeArray(fItemCount + count);
if (result) { if (result) {
fItemCount += count; fItemCount += count;
move_items(fObjectList + index, count, fItemCount - index - count); move_items(fObjectList + index, count, fItemCount - index - count);
@@ -150,6 +152,7 @@ BList::AddList(const BList* list, int32 index)
list->fItemCount * sizeof(void*)); list->fItemCount * sizeof(void*));
} }
} }
return result; return result;
} }
@@ -163,12 +166,14 @@ BList::AddList(const BList* list)
int32 count = list->fItemCount; int32 count = list->fItemCount;
if (fItemCount + count > fPhysicalSize) if (fItemCount + count > fPhysicalSize)
result = _ResizeArray(fItemCount + count); result = _ResizeArray(fItemCount + count);
if (result) { if (result) {
fItemCount += count; fItemCount += count;
memcpy(fObjectList + index, list->fObjectList, memcpy(fObjectList + index, list->fObjectList,
list->fItemCount * sizeof(void*)); list->fItemCount * sizeof(void*));
} }
} }
return result; return result;
} }
@@ -220,12 +225,12 @@ BList::RemoveItems(int32 index, int32 count)
bool bool
BList::ReplaceItem(int32 index, void* newItem) BList::ReplaceItem(int32 index, void* item)
{ {
bool result = false; bool result = false;
if (index >= 0 && index < fItemCount) { if (index >= 0 && index < fItemCount) {
fObjectList[index] = newItem; fObjectList[index] = item;
result = true; result = true;
} }
return result; return result;
@@ -278,22 +283,20 @@ BList::SwapItems(int32 indexA, int32 indexB)
A C D E F G B H I J A C D E F G B H I J
*/ */
bool bool
BList::MoveItem(int32 fromIndex, int32 toIndex) BList::MoveItem(int32 from, int32 to)
{ {
if ((fromIndex >= fItemCount) || (toIndex >= fItemCount) || (fromIndex < 0) if ((from >= fItemCount) || (to >= fItemCount) || (from < 0) || (to < 0))
|| (toIndex < 0)) {
return false; return false;
}
void* tmpMover = fObjectList[fromIndex]; void* tmpMover = fObjectList[from];
if (fromIndex < toIndex) { if (from < to) {
memmove(fObjectList + fromIndex, fObjectList + fromIndex + 1, memmove(fObjectList + from, fObjectList + from + 1,
(toIndex - fromIndex) * sizeof(void*)); (to - from) * sizeof(void*));
} else if (fromIndex > toIndex) { } else if (from > to) {
memmove(fObjectList + toIndex + 1, fObjectList + toIndex, memmove(fObjectList + to + 1, fObjectList + to,
(fromIndex - toIndex) * sizeof(void*)); (from - to) * sizeof(void*));
}; }
fObjectList[toIndex] = tmpMover; fObjectList[to] = tmpMover;
return true; return true;
} }
@@ -305,7 +308,7 @@ BList::MoveItem(int32 fromIndex, int32 toIndex)
void* void*
BList::ItemAt(int32 index) const BList::ItemAt(int32 index) const
{ {
void *item = NULL; void* item = NULL;
if (index >= 0 && index < fItemCount) if (index >= 0 && index < fItemCount)
item = fObjectList[index]; item = fObjectList[index];
return item; return item;
@@ -315,7 +318,7 @@ BList::ItemAt(int32 index) const
void* void*
BList::FirstItem() const BList::FirstItem() const
{ {
void *item = NULL; void* item = NULL;
if (fItemCount > 0) if (fItemCount > 0)
item = fObjectList[0]; item = fObjectList[0];
return item; return item;
@@ -467,8 +470,7 @@ void BList::_ReservedList1() {}
void BList::_ReservedList2() {} void BList::_ReservedList2() {}
/*! Resizes fObjectList to be large enough to contain count items. //! Resizes fObjectList to be large enough to contain count items.
*/
bool bool
BList::_ResizeArray(int32 count) BList::_ResizeArray(int32 count)
{ {
@@ -480,12 +482,12 @@ BList::_ResizeArray(int32 count)
int32 targetSize = count; int32 targetSize = count;
if (targetSize <= 0) if (targetSize <= 0)
targetSize = fBlockSize; targetSize = fBlockSize;
if (targetSize > fPhysicalSize) { if (targetSize > fPhysicalSize) {
while (newSize < targetSize) while (newSize < targetSize)
newSize <<= 1; newSize <<= 1;
} else if (targetSize <= fResizeThreshold) { } else if (targetSize <= fResizeThreshold)
newSize = fResizeThreshold; newSize = fResizeThreshold;
}
// resize if necessary // resize if necessary
if (newSize != fPhysicalSize) { if (newSize != fPhysicalSize) {
@@ -501,6 +503,6 @@ BList::_ResizeArray(int32 count)
} else } else
result = false; result = false;
} }
return result; return result;
} }
+2 -2
View File
@@ -1,9 +1,9 @@
/* /*
* Copyright 2001-2009, Haiku, Inc. * Copyright 2001-2009 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT license. * Distributed under the terms of the MIT license.
* *
* Authors: * Authors:
* Erik Jaesler <erik@cgsoftware.com> * Erik Jaesler, erik@cgsoftware.com
*/ */
+13 -11
View File
@@ -1,14 +1,14 @@
/* /*
* Copyright 2001-2010, Haiku, Inc. All Rights Reserved. * Copyright 2001-2014 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
* Marc Flerackers (mflerackers@androme.be) * Stefano Ceccherini, burton666@libero.it
* Stefano Ceccherini (burton666@libero.it)
* Oliver Tappe (openbeos@hirschkaefer.de)
* Axel Dörfler, axeld@pinc-software.de * Axel Dörfler, axeld@pinc-software.de
* Julun <host.haiku@gmx.de> * Marc Flerackers, mflerackers@androme.be
* Michael Lotz <mmlr@mlotz.ch> * Julun, host.haiku@gmx.de
* Michael Lotz, mmlr@mlotz.ch
* Oliver Tappe, openbeos@hirschkaefer.de
*/ */
@@ -54,10 +54,10 @@ min_clamp0(int32 num1, int32 num2)
//! Returns length of given string (but clamps to given maximum). //! Returns length of given string (but clamps to given maximum).
static inline int32 static inline int32
strlen_clamp(const char* str, int32 max) strlen_clamp(const char* string, int32 max)
{ {
// this should yield 0 for max<0: // this should yield 0 for max<0:
return max <= 0 ? 0 : strnlen(str, max); return max <= 0 ? 0 : strnlen(string, max);
} }
@@ -71,9 +71,9 @@ string_length(const char* string)
//! helper function, massages given pointer into a legal c-string: //! helper function, massages given pointer into a legal c-string:
static inline const char* static inline const char*
safestr(const char* str) safestr(const char* string)
{ {
return str ? str : ""; return string != NULL ? string : "";
} }
@@ -110,6 +110,7 @@ public:
} }
fBuffer[fSize++] = pos; fBuffer[fSize++] = pos;
return true; return true;
} }
@@ -134,7 +135,8 @@ private:
BStringRef::BStringRef(BString& string, int32 position) BStringRef::BStringRef(BString& string, int32 position)
: fString(string), fPosition(position) :
fString(string), fPosition(position)
{ {
} }
+1 -3
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2007-2009 Haiku Inc. All rights reserved. * Copyright 2007-2009 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
@@ -275,7 +275,5 @@ BUrl::Path() const
return fPath; return fPath;
} }
} // namespace Support } // namespace Support
} // namespace BPrivate } // namespace BPrivate
+4 -3
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2013, Haiku, Inc. * Copyright 2013 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -32,13 +32,13 @@ init_random_seed()
seed ^= (uint32)(addr_t)&time; seed ^= (uint32)(addr_t)&time;
srandom(seed); srandom(seed);
return true; return true;
} }
namespace BPrivate { namespace BPrivate {
BUuid::BUuid() BUuid::BUuid()
{ {
memset(fValue, 0, sizeof(fValue)); memset(fValue, 0, sizeof(fValue));
@@ -93,6 +93,7 @@ BUuid::ToString() const
buffer[2 * i] = kHexChars[fValue[i] >> 4]; buffer[2 * i] = kHexChars[fValue[i] >> 4];
buffer[2 * i + 1] = kHexChars[fValue[i] & 0xf]; buffer[2 * i + 1] = kHexChars[fValue[i] & 0xf];
} }
return BString().SetToFormat("%.8s-%.4s-%.4s-%.4s-%.12s", return BString().SetToFormat("%.8s-%.4s-%.4s-%.4s-%.12s",
buffer, buffer + 8, buffer + 12, buffer + 16, buffer + 20); buffer, buffer + 8, buffer + 12, buffer + 16, buffer + 20);
} }
@@ -109,6 +110,7 @@ BUuid&
BUuid::operator=(const BUuid& other) BUuid::operator=(const BUuid& other)
{ {
memcpy(fValue, other.fValue, sizeof(fValue)); memcpy(fValue, other.fValue, sizeof(fValue));
return *this; return *this;
} }
@@ -153,7 +155,6 @@ BUuid::_SetToRandomFallback()
fValue[4 * i] |= (bitsToMove << i) & 0x80; fValue[4 * i] |= (bitsToMove << i) & 0x80;
} }
} // namespace BPrivate } // namespace BPrivate