Commit Graph

256 Commits

Author SHA1 Message Date
Rene Gollent
860c710c4b Add some additional BReferenceable debugging.
- When libbe is built in debug mode, BReferenceable now issues a
  debugger call if it's destroyed without all references having been
  released.
2012-12-04 21:17:30 -05:00
Alex Smith
049d149cf7 Handle 64-bit types correctly. 2012-08-04 18:58:26 +01:00
Alex Smith
9be774b553 Compilation and 64-bit fixes to libbe.so sources.
Fixed the usual issues - printf format strings, uint32 instead of
addr_t, etc. One thing that isn't so nice is several places where
BList is used to store (u)int32, these require a double cast to addr_t
then void* to silence a warning on x86_64.
2012-07-30 21:27:21 +01:00
Rene Gollent
36c85ca8df Fix add-on image unloading for shelf replicants (ticket #8708).
- The version of instantiate_object() that returns the image id from which
  the object was reinstantiated was not correctly returning it in all
  circumstances, only if it had to find/load the add-on itself. This caused
  problems for BShelf since the latter relies on that image id in order to
  determine what image to unload when replicants are removed. To remedy this,
  introduce an additional version of find_instantiation_func() that returns
  the image id in which the instantiation function was found, and make use
  of it in instantiate_object() in order to also be able to return the image
  id in that case.
2012-07-10 18:41:49 -04:00
Alex Wilson
4ca2a44779 Make ownership-taking idempotent during unarchiving.
The previous scheme made it hard to deal with reference-counted objects,
which may be owned by many objects.
2012-05-03 08:45:29 +12:00
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
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
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