History log of /haiku/src/kits/support/Archivable.cpp
Revision Date Author Comments
# 7037b5d9 20-Jan-2020 Kyle Ambroff-Kao <kyle@ambroffkao.com>

support/Archivable: Reset errno in validate_instantiation()

validate_instantiation(BMessage*, const char*) sets errno for invalid
input, or if the requested class is not found, but it doesn't reset
errno to B_OK if validation succeeds.

I verified that in BeOS R5, errno is set to B_OK if
validate_instantiation succeeds.

This fixes BHandler::Instantiate2 and BHandler::Instantiate3 tests.

Change-Id: I531777e6ba47e9635da2da1fc8c8103bb233b0f3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2136
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# 2f863948 26-Jul-2015 Adrien Destugues <pulkomandy@gmail.com>

PVS 170: use boolean for if comparison

Direct use of strcmp result in if is against our coding style.


# 29e8fa59 24-Jun-2014 John Scipione <jscipione@gmail.com>

Style fixes to Support Kit files


# 36c85ca8 10-Jul-2012 Rene Gollent <anevilyak@gmail.com>

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.


# 1b6bc267 08-Feb-2012 Alexander von Gluck IV <kallisti5@unixzen.com>

kits: Some spelling cleanup of common mistyped words

* Little whitespace cleanup
* No functional change


# aa818be6 12-Aug-2010 Alex Wilson <yourpalal2@gmail.com>

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


# 45a167a9 26-Jul-2010 Alex Wilson <yourpalal2@gmail.com>

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


# c216fe9d 25-Jul-2010 Alex Wilson <yourpalal2@gmail.com>

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


# b137ab3e 16-Jul-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

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


# fbb6335d 08-Jul-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Style cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37432 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e5150e28 08-Jul-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

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


# 13bbfe42 26-Apr-2008 Axel Dörfler <axeld@pinc-software.de>

* 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


# 89eb861a 24-Apr-2008 Axel Dörfler <axeld@pinc-software.de>

* 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


# 7bc5a06b 29-Aug-2007 Axel Dörfler <axeld@pinc-software.de>

* 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


# 511b265e 23-Oct-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

commented out annoying debug messages

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19095 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d479db55 28-Sep-2006 Jérôme Duval <korli@users.berlios.de>

added mangling for gcc4, deskbar replicants are now loaded correctly


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18975 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9ecf9d1c 26-Aug-2006 Ingo Weinhold <ingo_weinhold@gmx.de>

Merge from layout management branch.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18649 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ff1ade6b 21-Aug-2002 ejakowatz <ejakowatz@nowhere.fake>

More tests and fixes for bugs exposed by them. Also removed spurious
instantiation of BRoster from BArchivable, line 323, as per Tyler's
mention. =)


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@852 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 52a38012 08-Jul-2002 ejakowatz <ejakowatz@nowhere.fake>

It is accomplished ...


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2f8639483aa51409240e29679543881cd2a223f2 26-Jul-2015 Adrien Destugues <pulkomandy@gmail.com>

PVS 170: use boolean for if comparison

Direct use of strcmp result in if is against our coding style.


# 29e8fa5922c9f9a5eb09a2fcc92e7fb321d4cc59 24-Jun-2014 John Scipione <jscipione@gmail.com>

Style fixes to Support Kit files


# 36c85ca8df5a43d6e716579099c25018e41bedf8 10-Jul-2012 Rene Gollent <anevilyak@gmail.com>

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.


# 1b6bc2675fe3691538c8764ab016593f3b06ca53 08-Feb-2012 Alexander von Gluck IV <kallisti5@unixzen.com>

kits: Some spelling cleanup of common mistyped words

* Little whitespace cleanup
* No functional change


# aa818be69a46065327a75ec383e7b6b3ae2df17f 12-Aug-2010 Alex Wilson <yourpalal2@gmail.com>

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


# 45a167a94d4a9c16e060ff830a271bb654405b81 26-Jul-2010 Alex Wilson <yourpalal2@gmail.com>

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


# c216fe9d1328f6fb771fcb531778adb7f4220015 25-Jul-2010 Alex Wilson <yourpalal2@gmail.com>

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


# b137ab3eb34e8c43c76dab64c09d2718569cf1d5 16-Jul-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

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


# fbb6335d2aaed254a08573b9af14adcc9432ef8e 08-Jul-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Style cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37432 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e5150e28472204582c41b3d3cd5b4eabdbef323e 08-Jul-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

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


# 13bbfe422b13d808b182a3abf187800d4d80e631 26-Apr-2008 Axel Dörfler <axeld@pinc-software.de>

* 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


# 89eb861a3e15748d432ed7fd2b1a4eb1e6542bdc 24-Apr-2008 Axel Dörfler <axeld@pinc-software.de>

* 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


# 7bc5a06be607c250e4644a3270f47ac6e882aa4d 29-Aug-2007 Axel Dörfler <axeld@pinc-software.de>

* 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


# 511b265ed85d7abfe5aa5f09dffdaf355579d699 23-Oct-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

commented out annoying debug messages

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19095 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d479db5589905a8fa304347ee659fa2108dd5c1c 28-Sep-2006 Jérôme Duval <korli@users.berlios.de>

added mangling for gcc4, deskbar replicants are now loaded correctly


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18975 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9ecf9d1c1d4888d341a6eac72112c72d1ae3a4cb 26-Aug-2006 Ingo Weinhold <ingo_weinhold@gmx.de>

Merge from layout management branch.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18649 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ff1ade6b3d1195d3065cd2ecd1b6064e06f9e17f 21-Aug-2002 ejakowatz <ejakowatz@nowhere.fake>

More tests and fixes for bugs exposed by them. Also removed spurious
instantiation of BRoster from BArchivable, line 323, as per Tyler's
mention. =)


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@852 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 52a380120846174213ccce9c4aab0dda17c72083 08-Jul-2002 ejakowatz <ejakowatz@nowhere.fake>

It is accomplished ...


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10 a95241bf-73f2-0310-859d-f6bbb57e9c96