Commit Graph

305 Commits

Author SHA1 Message Date
Fredrik Holmqvist
11ff194b97 Use strnlen instead of own impl, as it probably will have platform specific optimisation. 2012-04-27 22:15:48 +02:00
Alexander von Gluck IV
1b6bc2675f kits: Some spelling cleanup of common mistyped words
* Little whitespace cleanup
* No functional change
2012-02-08 16:50:18 -06:00
Philippe Saint-Pierre
b6e4d1a9dc BufferedDataIO::Flush(), use ssize_t rather than size_t
Write() was returing an ssize_t and Flush() was expecting a ssize_t,
but a size_t was instead used. CID 11052.
2011-12-29 13:43:15 -05:00
Urias McCullough
4ad0585ebc Partial fix for DEBUG=1 build on a 64bit host
Signed-off-by: Matt Madia <mattmadia@gmail.com>
2011-12-21 17:21:38 +00:00
czeidler
9472a1d6f7 Small style changes. Thanks Axel. 2011-12-21 17:21:51 +13:00
czeidler
14fc524be2 Style and performance fixes. Thanks Ingo and Stephan. 2011-12-17 14:36:36 +13:00
czeidler
ed77847ca4 Remove private BStringList implementation from mail. Tested it but however please be careful an review. This fixes bug #8174. 2011-12-15 19:45:07 +13:00
czeidler
779061f0cd Make BStringList derive from BFlattenable. The implementation is more or less copied from the mail version to stay compatible. Fix IndexOf which
was the implementation of HasString.
2011-12-15 19:45:06 +13:00
Michael Lotz
011002e5e4 Fix uses of member after deleting the object. CID 10535, 10534. 2011-12-06 19:37:46 +01:00
Ingo Weinhold
7de6af25e9 Add a BStringList class 2011-11-25 06:19:45 +01:00
Ingo Weinhold
ad07ecd821 BString::Private class to access BString internals 2011-11-25 06:19:45 +01:00
Ingo Weinhold
156ea481b3 Add HashValue() methods to BString 2011-11-25 06:19:44 +01:00
Oliver Tappe
02606f712c Provide BReferenceable in libreferenceable.a, too.
* the upcoming multibyte-implementation in libroot's ICU locale
  backend is going to use this, so it's not good enough to provide
  BReferenceable only in libbe.so
2011-11-22 16:43:53 +01:00
Axel Dörfler
29e07dd0eb Added a buffered DataIO subclass.
* Only the read path is tested so far.
2011-11-21 23:55:13 +01:00
Ingo Weinhold
19ae20e67e Merge branch 'master' into pm-flat
Conflicts:
	build/jam/HaikuImage
	build/jam/OptionalBuildFeatures
	build/jam/OptionalPackages
	build/jam/UserBuildConfig.sample
	data/bin/installoptionalpackage
	src/apps/deskbar/DeskbarMenu.cpp
	src/servers/debug/DebugServer.cpp
	src/system/kernel/fs/vfs.cpp
2011-11-05 17:00:01 +01:00
Oliver Tappe
aac8a4c3c4 Fix clamping in BDate::AddMonths():
* use _DaysInMonth() instead of DaysInMonth(), as the latter only works
  for valid dates, which we do not have if the day needs to be clamped
  to the maximum value for the current month


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42719 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-09-07 21:31:06 +00:00
Oliver Tappe
04c60f4472 * fix stuck loops in Replace...() on single chars in case the old and new character
are the same (Eclipse was complaining about 'assignment to self', which got me 
  looking at the code ...)

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42682 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-08-23 19:59:50 +00:00
Clemens Zeidler
f7953fa769 Add MoveItem method to easily move a item within a list. Fix line limit.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42475 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-07-24 23:49:30 +00:00
Ingo Weinhold
808a51161a Add a BStringList class 2011-07-17 16:55:20 +02:00
Ingo Weinhold
d0c417848b BString::Private class to access BString internals 2011-07-17 16:55:20 +02:00
Ingo Weinhold
5a54e156e5 Add HashValue() methods to BString 2011-07-17 16:55:19 +02:00
Ingo Weinhold
85b41b15d9 * Added bool and double BString::operator<<() versions.
* Removed the clashing operator in JobSetupDlg. Automatic whitespace
  cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42387 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-07-07 10:17:15 +00:00
Ingo Weinhold
e76046d3f9 Use casts that are more portable.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42177 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-06-14 11:27:24 +00:00
Ingo Weinhold
a928c3f001 operation <<(): Use the standard types [unsigned] long [long] instead of
[u]int32 and [u]int64 to avoid clashes with the int/unsigned int versions.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42165 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-06-14 01:07:16 +00:00
Rene Gollent
8c3c117201 Adjust ReleaseReference() to also return the previous ref count as
AcquireReference() now does, and adjust all callers that relied on the previous
return type.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42091 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-06-10 22:31:33 +00:00
Rene Gollent
a99d0dd7b7 AcquireReference() now returns the previous ref count.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42079 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-06-10 01:55:12 +00:00
Clemens Zeidler
8066fbc766 Remove semi unused variable.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41094 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-03-23 21:28:14 +00:00
Clemens Zeidler
9d214f419d Switch back to isspace for now. Have to read some utf8 stuff first. Feel free to fix it, though! will not do it in the near future...
Fix header order, ups never changed a libbe file before ;) thx Oliver. Add small optimization as pointed out by Ingo.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41093 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-03-23 21:22:42 +00:00
Clemens Zeidler
b5ddb5072e Switch to iswspace. Fix space detection at the right. Thanks Jérôme and Ingo. Please review, though.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41084 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-03-22 20:38:13 +00:00
Clemens Zeidler
37ffb53fb4 Fix Trim() method for empty strings and strings only containing spaces. Fixes #7392.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41076 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-03-22 03:05:39 +00:00
Jonas Sundström
146d274d81 Return of the on-stack buffer.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40767 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-03-01 20:24:04 +00:00
Jonas Sundström
a29fb9388d Rename and a small simplification. Thanks, Clemens and Ingo.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40756 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-03-01 08:26:00 +00:00
Jonas Sundström
3838fb9359 Using the buffer of the string instead of one on the stack.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40726 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-02-27 15:19:54 +00:00
Jonas Sundström
c9e27adabf Cleanup. Efficiency makerover.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40720 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-02-27 09:25:26 +00:00
Jonas Sundström
c91c2de735 Printf-like assignment method for BString.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40695 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-02-26 07:26:19 +00:00
Oliver Tappe
9f209e77b8 Fix minor issue in BString I noticed when researching #7226:
* if _MakeWritable() fails, LockBuffer() must return NULL, not what
  happens to be in fPrivateData

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40525 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-02-16 10:11:49 +00:00
Jérôme Duval
23281fb2c1 Moved Easter holidays methods to a Holiday class, an hopefully better place.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40125 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-01-05 18:00:31 +00:00
Jérôme Duval
96827f2620 Ooops. Fix AscensionDay and PentecostDay.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40117 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-01-04 19:49:46 +00:00
Jérôme Duval
daf3c50529 * changed some methods to static as that's what they are in the end.
* added some methods to find out easter sunday, ascension and pentecost days.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40116 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-01-04 19:43:23 +00:00
Ingo Weinhold
756b64fd83 * Removed the obsolescent [B]Reference[able] API and replaced the remaining
uses. Fixes the gcc 2 acpi build.
* Renamed WeakReferenceable::{Add,Remove}Reference() to
  {Acquire,Release}Reference() for consistency.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39871 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-12-16 16:35:42 +00:00
Ingo Weinhold
8510499a79 Fixed the FindLast() char versions. They wouldn't find a character at the
beginning of the string.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39470 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-11-17 23:17:40 +00:00
Axel Dörfler
d32f94f43c * Added optional tracing support which can be very useful when debugging
reference count problems.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38866 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-10-01 06:49:24 +00:00
Oliver Tappe
559cf371bc * fix oversight that gmtime() and localtime() may return NULL, which would lead
to a crash


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38143 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-08-16 14:52:37 +00:00
Alex Wilson
aa818be69a Update BView to call debugger when passed a NULL archive for its archive constructor. This means there is no need to check for a NULL archive in BSeparatorView. Also update BUnarchiver and friends to be NULL safe. Pointed out by Adrien, fixes CID 1754.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38063 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-08-12 14:50:57 +00:00
Alex Wilson
45a167a94d In BUnarchiver::IsInstantiated(), catch a possible NULL dereference, make archive parameter to BUnarchiver::IsArchiveManaged() const.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37751 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-07-26 08:02:33 +00:00
Alex Wilson
c216fe9d13 Update (de)mangle_class_name() functions to be compiler version aware.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37750 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-07-26 05:10:17 +00:00
Ingo Weinhold
b137ab3eb3 Patch by Alex Wilson (minor changes by myself) related to the new archiving
features:
* Some cosmetic adjustments of the API, like using references instead of
  pointers, argument order, method names, etc.
* Added convenience template methods for archiving and unarchiving to BArchiver
  and BUnarchiver.
* BUnarchiver (respectively the private BUnarchiveManager) explicitly deals with
  object ownership, now. This is necessary since an error while unarchiving
  could leave an already unarchived object without owning object, which would
  result in it being leaked. The BUnarchiver::{Get,Find}Object() methods do now
  have an optional parameter to specify whether object ownership shall be
  transferred.
* Fixed incorrect header guard in headers/private/binary_compatibility/Global.h.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37538 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-07-16 16:49:42 +00:00
Ingo Weinhold
fbb6335d2a Style cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37432 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-07-08 15:04:38 +00:00
Ingo Weinhold
e5150e2847 Patch by Alex Wilson (compilation fixes by myself): Extended the archiving/
unarchiving protocol to support archival of arbitrary object graphs.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37431 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-07-08 14:54:25 +00:00
Stephan Aßmus
1e16c00279 * Don't store a possibly negative return value in an unsigned size_t, which
is later used as parameter to memcpy(). Should fix r5623 (untested).
 * Fixed coding style for some comments.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35944 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-24 16:48:33 +00:00
Stephan Aßmus
bbba047c2d * Added copy constructors.
* Let the AddHours(), Add*() return itself, so that they can be chained.
 * Made the previous *Name() methods static and added non-static versions that
   take the day/month of the object.
 * Make BDateTime::Date/Time() return references (const or non-const).
 * Fixed the BDateTime comparison operators.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35894 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-17 18:51:41 +00:00
Stephan Aßmus
a070cf5306 * Indentation update in DateTime.h
* Extended BTime, BDate and BDateTime with archiving functionality.
 * Adjusted code which uses these classes, since including DateTime.h
   already imports the classes from the BPrivate namespace.
 * Moved DateTime.h into Support Kit. It is still in the BPrivate namespace,
   as I am uncertain what to do with time_type and diff_type. I'd favor
   moving the constants into the classes itself. Possibly removing the B_
   prefix from them. Feedback welcome.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35772 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-07 12:08:47 +00:00
Michael Lotz
a9038d00b4 The withLength variable wasn't initialized properly.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35613 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-02-25 01:50:29 +00:00
Michael Lotz
a5b7cbe331 Adding utf-8 aware version of most functions to BString. They are named after
the corresponding normal functions but have a "Chars" in the name like
"MoveCharsInto" or "AppendChars". Also added CountBytes() and CharAt().
This should make everyday string handling with multibyte strings a bit easier.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35371 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-02-01 04:20:01 +00:00
Jérôme Duval
534bebec39 When BString assignment operator is called with a NULL argument we should use an empty string instead. I checked this against Dano.
This fixed #4713


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34983 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-09 23:06:30 +00:00
Axel Dörfler
4e1e966ad7 * Forgot to check in Beep.cpp. Sorry!
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34602 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-09 19:06:24 +00:00
Ingo Weinhold
1cab99bc10 Apparently someone forgot to commit something. Build fix hack.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34600 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-09 17:56:51 +00:00
Stephan Aßmus
b0850e9ba1 * Code and header indentation cleanup
* Added operator== and !=
 * Added check for list != this in operator=
 * Added HasItem() and IndexOf() versions that take const void*, duplicating
   the code, since I didn't want to introduce another function call in these
   potentially time critical methods.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34520 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-06 12:44:38 +00:00
Ingo Weinhold
4736b6b9e5 * Made BReferenceable the class implementation and BPrivate::Referenceable the
typedef, so it's clearer which one is the preferred one.
* Added BReference, a clone of BPrivate::Reference.

BPrivate::{Referenceable,Reference} are being phased out. Only the B* versions
should be used.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33879 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-04 15:08:53 +00:00
Axel Dörfler
6f6dceac96 * Minor cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32758 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-27 14:36:31 +00:00
Axel Dörfler
e90b90daf6 * Added desperately missing Trim() method.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32035 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-31 21:13:19 +00:00
Ingo Weinhold
1746066cde * Made _Allocate() static.
* Moved the private inline methods up in the source file, so they can actually
  be inlined.
* UnlockBuffer(): Removed superfluous "if". Maybe the one who wrote it can have
  a look and check whether something else was intended originally.
* _MakeWritable() (both versions): Removed the superfluous ref count increment
  and the matching decrements.
* _Resize(): Fixed ref count ASSERT. It would always be triggered when called
  from UnlockBuffer(), since the ref count is -1 in that case.
* Clarified some comments.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31662 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-21 00:04:46 +00:00
Ingo Weinhold
7aa7cb4b54 * Renamed {Add,Remove}Reference() to {Acquire,Release}Reference(). Methods with
the old names still exist as deprecated aliases for the time being.
* Introduced hooks FirstReferenceAcquired() and LastReferenceReleased(). Besides
  added flexibility this also makes the deleteWhenUnreferenced constructor
  parameter and the fDeleteWhenUnreferenced attribute superfluous, since the
  "don't delete" behavior can be obtained by overriding LastReferenceReleased().
  Parameter and attribute will be removed eventually.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31367 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-01 21:59:27 +00:00
Axel Dörfler
e52400cf24 * Fixed a race condition in the former _Detach*() functions: since atomic_get()
was used, two different threads could decide to share the same mutable string.
* Renamed some functions to make clearer what they do, ie. _Detach() is now
  called _MakeWritable().
* Cleaned up some questionable semantics, like the const char* parameter in
  _DetachWith() - you can now choose to copy the original string or not with
  a boolean. This also makes sure that the string is actually copied when it
  has to, which wasn't the case before (but that was no problem with the way
  that function was used).
* Made the header compliant with our style guide.
* Further cleanup.
* All BString related unit tests are passed, so I guess I didn't break too
  much :-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30980 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-06 11:23:17 +00:00
Axel Dörfler
584ba8989e * Fixed debug build.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30956 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-04 09:57:31 +00:00
Jonas Sundström
03458c01a2 More style guide fixes. Removed a lot of preprocessing / conditional building, with intent to fix or remove. Moved urlwrapper class declaration to its header file. Renamed things for clarity. Removed 5 extra mimetypes for IE shortcuts. (We have one, with sniffing rule and extension.) Moved the UnurlString() back to urlwrapper.cpp and renamed it _DecodeUrlString(). Tweaked copyright clauses. A lot more needs fixing, esp. in urlwrapper but also in BUrl, and I intend to keep working on this until we're satisfied. Let me know of any remaining/added style violations! Feedback welcome.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30757 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-13 22:19:42 +00:00
Jonas Sundström
a243916712 Hopefully fixed indentation in BUrl header. Made data members in BUrl private. Added some class methods. Adapted urlwrapper to use the BUrl class. Removed a few obvious comments and some code that was defined away. Turned off debugging. Stripped App suffix from class name. No intentional changes to the core functionality of urlwrapper.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30739 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-13 01:05:42 +00:00
Jonas Sundström
28e8dc8e80 Move Url class out of /bin/urlwrapper into BPrivate::Support. I plan to add a Launch()-method that will make it useful to /bin/open, AboutSystem, People and other applications.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30702 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-11 00:48:03 +00:00
Ingo Weinhold
96b5480b3f Simplification.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30646 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-06 15:26:30 +00:00
Ingo Weinhold
113a493073 * Removed the non-STL version of the code.
* Removed the _PointerList_ definition -- instead include <ObjectList.h>.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30291 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-21 11:45:19 +00:00
Axel Dörfler
28a650e94d * Made the WeakReferenceable class templatized. Not really sure yet I like that
better, though :-)
* Also fixed a mixup of the unintuitive argument order of our
  atomic_test_and_set(); I guess I will change that sooner or later.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29994 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-07 15:14:15 +00:00
Axel Dörfler
e1fed132d2 * Added a WeakReferenceable implementation, completely untested yet.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29990 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-07 12:01:30 +00:00
Ingo Weinhold
f451e14bc2 Added InitCheck() method.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29487 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-13 02:05:10 +00:00
Axel Dörfler
c58463ff10 * Seek() must always fail when the resulting offset would be smaller than 0
- "correcting" the offset to 0 is not what should happen.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28688 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-11-18 21:29:04 +00:00
Axel Dörfler
1b21be7091 * BBufferIO did not implement Seek() and Position() correctly; it just passed
it to the stream. This caused Read()/Write() to need two syscalls for nothing
  (this only caused the actual stream to share the same position with the
  BBufferIO, something you just cannot rely on when using buffered I/O).
* Anyway, this reduces the time VirtualBox needs to open some RAW test images
  from over 4 minutes to less than 15 seconds...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28662 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-11-16 21:23:45 +00:00
Karsten Heimrich
23f4249171 * should have been part of r27883
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27892 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-10-06 19:51:17 +00:00
Karsten Heimrich
a4da9c8634 * fix of by one bug while moving from front to back
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27883 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-10-05 22:44:33 +00:00
Karsten Heimrich
68f40fccf7 * cleanup
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27882 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-10-05 22:41:36 +00:00
Michael Lotz
0b559106bf * Only copy over the list content if resizing/allocating the list succeded.
Fixes CID 1268.
* Remove no more correct comment.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27710 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-09-23 19:07:13 +00:00
Ingo Weinhold
f974514476 BString::Append(, int32) methods have been broken in r26378. A local
variable "length" shadowed the "length" parameter.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26554 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-21 23:21:47 +00:00
Stephan Aßmus
2cbb2916a7 * _DoAppend() no longer checks the string and the string length, which resulted
in duplicate work/checks. Instead the length is checked in the calling
  functions.
* operator=(const char*) now checks if the passed pointer is the strings
  own data pointer. I think it would have freed the memory before, not
  sure though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26378 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-11 11:32:07 +00:00
Rene Gollent
fe83a98715 Remove unneeded header.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25947 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-12 21:33:13 +00:00
Rene Gollent
0c8bdbafd5 Revamp BList somewhat to further optimize the resizing behavior.
We now keep track of a lower bound as to when the list should scale
itself back down. When increasing the list size, we double the current,
with the lower bound set to 1/4 of the current size, not allowing it to
go any smaller than the block size. These combined allow us to do very
cheap tests to see if an operation requires a resize at all, and minimize
how often the list actually needs to be resized, since the difference in upper
and lower bounds prevents bouncing back and forth between a size in the case
of adding/removing an item while close to a boundary. All in all this should
make BList noticably more scalable when doing large numbers of add/remove
operations.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25946 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-12 21:30:28 +00:00
Rene Gollent
819eb21bbf Remove (invalid) TODO note. Rename variable more meaningfully. Remove stray whitespace that crept into previous commit.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25927 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-11 14:29:59 +00:00
Rene Gollent
34380ac48c Tracked down issue with previous commit. For some reason, modifying the passed in parameter's value directly results in a segfault in registrar, and I cannot see why. Thoughts?
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25920 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-11 00:32:48 +00:00
Rene Gollent
22aef42481 Revert this change until I determine why it now crashes the app_server when it didn't during my tests.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25919 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-10 23:25:33 +00:00
Rene Gollent
864ace1845 Rework BList's Resize() functionality: instead of altering the size of the list a block at a time,
we now double/halve the current size of the list, starting with the constructor blocksize as a baseline.
This has the net effect that when doing large numbers of inserts/removes, the number of resize operations 
needed scales logarithmically to the number of operations, which should yield a decent performance 
improvement in such cases.

Review welcome. This does not yet affect ticket #2363 that I'm aware of, as I'm currently in the process
of attempting to find a copy of said app to test with.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25916 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-10 22:10:13 +00:00
François Revol
8e3f5e8959 Make the BString& version of SetTo() behave like BeOS, that length < 0 is means "until the end". This makes CopyInto() acting alike too. Note the char * version crashes in BeOS, instead we act like the other version for consistency.
There are many other calls that crash in BeOS when called with invalid args, should we attempt to sanitize them or call debugger() instead ?


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25372 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-08 12:56:55 +00:00
Axel Dörfler
13bbfe422b * validate_instantiation() also needs to add the BPrivate namespace in case
it couldn't find the class on first try. This fixes the problems mentioned
  by Shinta as part of bug #2086.
* Got rid of GetNumber() - there is a POSIX function strtoul() for exactly
  this purpose.
* demangle_class_name() can now fail.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25179 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-26 14:28:16 +00:00
Axel Dörfler
89eb861a3e * Large cleanup. Removed inconsistent usage of errno in instantiate_object();
instead, it will now use the image_id parameter to store errors in.
* find_instantiation_func() and validate_instantiation() will no longer
  overwrite errno with B_OK.
* Made private functions static, and moved them to the top.
* If the class name starts with '_', it will now try to add a BPrivate namespace
  in case it could not find the class. This should help with the compatibility
  issues Shinta reported (also part of ticket #2086).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25124 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-24 09:56:03 +00:00
Ingo Weinhold
0970b97bed Added support_kit_config.h configuration header. ATM it only contains a
setting to force BLockers to be semaphore style. This may help with
debugging deadlocks.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25096 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-22 15:04:01 +00:00
Axel Dörfler
4b83262008 * _Realloc() did not initialize the reference count either.
* _Alloc() can now preserve the original reference count, only _Clone()
  still initializes it to 1. As Karsten pointed out, this is necessary to
  preserve the "shareable" status of the private data.
* I hope that's finally it. What happened to our testing suite, anyway? :-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24355 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-10 22:56:27 +00:00
Axel Dörfler
bf4ddb61e1 * As found by Karsten, the reference count was not initialized in
_ReplaceAtPositions(), and _DoCharacterEscape() (we don't need to preserve
  it, though, as it must be 1).
* Factored out an _Alloc() method which is now always called when the private
  data is allocated. It also takes care of correct initialization (and thus
  fixes the above problem).
* This fix finally allows turning on reference counting again, thanks Karsten!
* Minor cleanup, renamed "oldAdr"/"newAdr" to "oldString", resp. "newString".


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24348 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-10 19:14:05 +00:00
Axel Dörfler
7c58a46830 The result of some more proof-reading caused by Stephan's comments:
* _Realloc(), and _Detach[With]() may fail, but that wasn't accounted for
  everywhere.
* The Append(), Prepend(), and Insert() char versions all caused their
  backends to access invalid data (must use strncpy() instead of memcpy()
  here). 
* All Append(), Prepend(), and Insert() BString variants used an invalid
  check, and would therefore just do nothing in certain situations like this
  one:
    BString a = "-";
    BString b = a;
    a.Append(b);


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24347 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-10 16:41:43 +00:00
Axel Dörfler
688c14266c * After my last change, _IsShareable() was called on the wrong string in the
copy constructors, effectively turning of references completely.
* Since that caused troubles (NetPositive now crashes when started), I
  temporarily disabled references by letting _IsShareable() always return
  false until the issue is resolved.
* _FreePrivateData() now sets the fPrivateData member to NULL, and is also
  safe to be called when fPrivateData is NULL.
* Removed my comment about the threading problem in _Detach() and _DetachWith()
  as that just couldn't happen.
* _Clone() must not use memcpy() as the string pointed to by "data" might not
  be as long as "length".
* LockBuffer() now marks a string as unshareable.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24345 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-10 14:14:44 +00:00
Axel Dörfler
a1dac092fa Followed suggestion by Stephan.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24314 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-08 20:49:30 +00:00
Axel Dörfler
002b33b720 * Fixed a bunch or concurreny bugs and memory leaks of the new reference
string stuff.
* It's still not thread-safe for all usage patterns, though, so we might want
  to remove or disable it: if a string is shared between several threads, and
  one of those starts to use a reference, all kinds of problems can happen.
* Some cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24312 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-08 19:05:09 +00:00
Stephan Aßmus
43361fc860 * Fixed "missing virtual constructor" warning (which is probably even a
correct warning) for AbstractPointerListHelper. (libbe_build.so)
* I have had problems with implementing virtual functions inline in the
  class declaration before, so I implemented the virtual destructor
  externally.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24168 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-28 14:39:19 +00:00
Stefano Ceccherini
576e2bf833 Patch by Julun: implements a refcounted BString. Thank You!
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24102 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-24 21:16:58 +00:00
Axel Dörfler
7bc5a06be6 * BShelf::_AddReplicant() did not recognize zombies if their object was not
inherited from BView.
* BShelf::_AddReplicant() did not honour the fAllowZombies flag correctly; if
  it wasn't allowed, no error message was given.
* Both of these changes fixes the crashing of the Deskbar as described in
  bug #555.
* instantiate_object() now also fires a message to the syslog if the object's
  image could not been loaded. Some cleanup, no longer resets errno.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22117 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-08-30 01:03:33 +00:00