History log of /haiku/src/kits/storage/mime/Database.cpp
Revision Date Author Comments
# 5fcf71f5 14-May-2021 X512 <danger_mail@list.ru>

Remove unneeded iostream includes

It cause adding new entry to executable init array for each translation unit.

Change-Id: I1e2d7946da03c001de7721948bc9af8188e8b317
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3981
Reviewed-by: X512 <danger_mail@list.ru>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# 0dbb85e2 09-Oct-2016 Adrien Destugues <pulkomandy@pulkomandy.tk>

Style fix


# 069c5697 09-Oct-2016 Adrien Destugues <pulkomandy@pulkomandy.tk>

Fix incorrect use of _SendMonitorUpdate

Icon size is only a boolean here (true for a large icon, false
otherwise). Using B_LARGE_ICON directly is not appropriate.

As found by Murai Takashi, but there was a second case in the same file
which I also fixed.

ticket : #12955


# ee2974da 25-Jan-2014 Ingo Weinhold <ingo_weinhold@gmx.de>

mime/Database: Add SetIcon[ForType]() BBitmap* version

When switching AppMetaMimeCreator from BMimeType to Database the
SetIcon[ForType]() calls with a BBitmap* ended up calling the vector
icon version with the icon_size as the data size argument, thus not only
not writing the bitmap icon attributes, but also clobbering the vector
icon attribute.


# 701a5d6b 20-Jan-2014 Rene Gollent <rene@gollent.com>

Resolve #10435.

Adjust Database{Location} to only attempt to create a mimetype when
actually necessary, and fail otherwise if a writable version doesn't yet
exist. Correspondingly, adjust callers such as
DatabaseLocation::DeleteAttribute(). Fixes a problem where a caller asking
to perform a mimeset could fail early due to SetSupportedTypes() attempting
to update the read-only mime database entry supplied by a package, and
consequently most of the mimeset operations would be skipped.


# ed92790c 07-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

mime/Database::Install(): Fix subtype without supertype case

If the supertype directory for a given subtype didn't exist yet, the
method would fail.


# b94857b3 07-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Refactor MIME DB access

* Add class DatabaseLocation. It contains a list of the MIME DB
directory paths plus methods to access type files.
* Move all low-level MIME DB access functions from
database_{support,access} to DatabaseLocation. All code that formerly
used those now requires a DatabaseLocation object. In BMimeType and in
the registrar the default object is used, but the low-level classes
can now be reused with different locations.
* Move get_icon_data() from database_access to database_support and
delete the former, which is now empty.


# 9cda9c99 07-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Move MIME DB code back from registrar to src/kits/storage/mime

* Together with database_{access,support}.cpp it is built into a static
library.
* Add new interfaces MimeSniffer and Database::NotificationListener for
plugging in registrar specific functionality (the sniffer add-on
support and the notification mechanism).


# f82c11c0 11-Jan-2008 Michael Lotz <mmlr@mlotz.ch>

bonefish+mmlr:
* Move most of MIME database support out of libbe and into registrar
* Use the (async) MessageDeliverer instead of a synchronous SendMessage in _SendMonitorUpdate

This fixes a deadlock when the message port of a MIME database watching
application gets full as documented in bug #1311.

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


# bae87c91 06-Nov-2006 Axel Dörfler <axeld@pinc-software.de>

Added a new type for the vector icon format 'VICN' or B_VECTOR_ICON_TYPE.
It's hopefully now used everywhere instead of B_RAW_TYPE where appropriate.


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


# 7fb6186f 29-Aug-2006 Stephan Aßmus <superstippi@gmx.de>

* integration of vector icons with the registrar and the mime data base
* additional versions of SetIcon[ForType] and GetIcon[ForType] in BMimeType
and BAppFileInfo, which handle flat vector icon data
* changes in Tracker to support scalable icons (currently broken for
non-vector icons and needs cleanup) and drawing icons correctly with alpha
channel (large parts of this work done by Michael Lotz)

If someone feels like looking over the changes, that would be much
appreciated! :-)


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


# 31dc79a1 03-Apr-2006 Axel Dörfler <axeld@pinc-software.de>

* Added B_MINI_ICON_TYPE and B_LARGE_ICON_TYPE to TypeConstants.h.
* Cleanup.


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


# e83935e5 03-Apr-2006 Axel Dörfler <axeld@pinc-software.de>

It no longer appears as if you need to delete file types twice until they
disappear. This fixes a part of bug #279.


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


# bf2657c5 08-Mar-2006 Axel Dörfler <axeld@pinc-software.de>

Database::Delete() now supports deleting super types as well (by deleting all
sub types first).
Also, if removing the type from the supporting application lists fails, this
is no longer propagated to the user - the MIME type got deleted after all,
and that's the purpose of this function.


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


# 208a6ce1 27-Feb-2006 Axel Dörfler <axeld@pinc-software.de>

We now set the preferred application of MIME types that are installed from
the supported types of an application to the one responsible.


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


# 98d9f1b4 16-Feb-2006 Axel Dörfler <axeld@pinc-software.de>

* Only allowed application hints of B_MIME_TYPE_LENGTH instead of B_PATH_NAME_LENGTH.
* Introduced a _SetStringValue() to avoid code duplication.
* The string types now check the original value, and don't write anything if the
contents stay unchanged (with the current exception of the sniffer rules).
* The monitor notfication methods no longer "clobber" the status result.
* Major cleanup.


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


# 17e6de7a 03-Aug-2003 shadow303 <shadow303@nowhere.fake>

gcc 3 fixes


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


# 86c6e9c1 01-Oct-2002 Tyler Dauwalder <tylerdauwalder@nowhere.fake>

+ Moved some code from SnifferRules::GuessMimeType(entry_ref*) that
really didn't belong there into Database::GuessMimeType(entry_ref*)
+ Added special meta mime file case to Database::GuessMimeType(entry_ref*)


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


# b690150e 29-Sep-2002 Tyler Dauwalder <tylerdauwalder@nowhere.fake>

Removed mime update code


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


# 1bd963b6 23-Sep-2002 Tyler Dauwalder <tylerdauwalder@nowhere.fake>

+ Added file-extension based mime type guessing
+ Added sniffer rule based mime type guessing
+ Added get_device_icon()
+ Added complete (synchronous, asynchronous; recursive,
non-recursive; forcing, non-forcing; you name it we got it :-)
update_mime_info() implementation.


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


# e3a2f206 09-Sep-2002 Tyler Dauwalder <tylerdauwalder@nowhere.fake>

+ Added SetSupportedTypes() test
+ Modified BMimeType::SetSupportedTypes functionality so it keeps track of
stranded types (i.e. previously supported types that have not had the now
unsupporting app signature removed from their supporting apps list yet due
to a false fullSync parameter) over consecutive SetSupportedTypes(...,
false) calls and updates all appropriate stranded types on the next
SetSupportedTypes(..., true) call.
+ Added fullSync parameter to BMimeType::DeleteSupportedTypes
+ Made BMimeType::Delete() do a DeleteSupportedTypes(..., true) call to
properly update the supporting apps lists when a mime type is deleted.
+ Added initial BMimeType::Get/SetSnifferRule
+ Updated BMimeType::CheckSnifferRule() to return B_BAD_VALUE when passed
a NULL rule string.
+ Brought CheckSnifferRule() tests up to date
+ Added lots of Mime::Database doxygen
+ Added any missing mime monitor notifications in Mime::Database
+ Possibly made some other changes as well... :-)


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


# 35ab40ee 30-Aug-2002 Ingo Weinhold <ingo_weinhold@gmx.de>

Database::SetSupportedTypes() now installs the not yet installed supported types.


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


# 41b9ba91 28-Aug-2002 Tyler Dauwalder <tylerdauwalder@nowhere.fake>

Added GetSupportingApps()/SetSupportedTypes() functionality


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


# 32f45afc 27-Aug-2002 Tyler Dauwalder <tylerdauwalder@nowhere.fake>

+ Added GetInstalled[Super]Types functionality
+ Cleaned up warnings
+ Added documentation


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


# e20a514a 23-Aug-2002 Tyler Dauwalder <tylerdauwalder@nowhere.fake>

After implementing the BMimeType::GetInstalled[Super]Types()
functionality, it became apparent that some restructuring was
needed if I wanted to keep things clean and managble.
storage/MimeDatabase.{h,cpp} have been broken into:

storage/mime/database_support.{h,cpp}
+ MIME database constants
+ high-level database access functions like open_type(),
read_mime_attr(), etc.

storage/mime/database_access.{h,cpp}
+ atomic read functions
+ is_installed()
+ get_icon_data()

storage/mime/Database.{h,cpp}
+ Mime::Database class, which is responsible for all write,
non-atomic read, and mime monitor functionality.

storage/mime/InstalledTypes.{h,cpp}
+ Helper class for Mime::Database::GetInstalled[Super]Types()

storage/mime/Supertype.{h,cpp}
+ Helper class for Mime::InstalledTypes

I haven't merged my intial, somewhat cludgy GetInstalled[Super]Types
implementation into the new setup yet. That comes next, and it ought
to be a more graceful implementation now.

I also implemented BMimeType::Get/SetSupportingTypes(), though
they haven't been tested yet (sorry).


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


# ee2974dadb9c6c99b8ad9b393f992fae42e4bc39 25-Jan-2014 Ingo Weinhold <ingo_weinhold@gmx.de>

mime/Database: Add SetIcon[ForType]() BBitmap* version

When switching AppMetaMimeCreator from BMimeType to Database the
SetIcon[ForType]() calls with a BBitmap* ended up calling the vector
icon version with the icon_size as the data size argument, thus not only
not writing the bitmap icon attributes, but also clobbering the vector
icon attribute.


# 701a5d6b7983b88c588594637fd09d2f746fcbf1 20-Jan-2014 Rene Gollent <rene@gollent.com>

Resolve #10435.

Adjust Database{Location} to only attempt to create a mimetype when
actually necessary, and fail otherwise if a writable version doesn't yet
exist. Correspondingly, adjust callers such as
DatabaseLocation::DeleteAttribute(). Fixes a problem where a caller asking
to perform a mimeset could fail early due to SetSupportedTypes() attempting
to update the read-only mime database entry supplied by a package, and
consequently most of the mimeset operations would be skipped.


# ed92790ce5832ef5431c1b36840900cb81186f08 07-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

mime/Database::Install(): Fix subtype without supertype case

If the supertype directory for a given subtype didn't exist yet, the
method would fail.


# b94857b322093c296230a18d47f6a98a2896b062 07-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Refactor MIME DB access

* Add class DatabaseLocation. It contains a list of the MIME DB
directory paths plus methods to access type files.
* Move all low-level MIME DB access functions from
database_{support,access} to DatabaseLocation. All code that formerly
used those now requires a DatabaseLocation object. In BMimeType and in
the registrar the default object is used, but the low-level classes
can now be reused with different locations.
* Move get_icon_data() from database_access to database_support and
delete the former, which is now empty.


# 9cda9c9905397675aec87ebc6bc9287df3ca2264 07-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Move MIME DB code back from registrar to src/kits/storage/mime

* Together with database_{access,support}.cpp it is built into a static
library.
* Add new interfaces MimeSniffer and Database::NotificationListener for
plugging in registrar specific functionality (the sniffer add-on
support and the notification mechanism).


# f82c11c0793269f483e03fc6f1a3a93aa1d092f0 11-Jan-2008 Michael Lotz <mmlr@mlotz.ch>

bonefish+mmlr:
* Move most of MIME database support out of libbe and into registrar
* Use the (async) MessageDeliverer instead of a synchronous SendMessage in _SendMonitorUpdate

This fixes a deadlock when the message port of a MIME database watching
application gets full as documented in bug #1311.

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


# bae87c9140b843a16dd71b5ed9cf467f44b57b98 06-Nov-2006 Axel Dörfler <axeld@pinc-software.de>

Added a new type for the vector icon format 'VICN' or B_VECTOR_ICON_TYPE.
It's hopefully now used everywhere instead of B_RAW_TYPE where appropriate.


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


# 7fb6186f3cb93a14ea0f96a82bdfc3d18f3ad56e 29-Aug-2006 Stephan Aßmus <superstippi@gmx.de>

* integration of vector icons with the registrar and the mime data base
* additional versions of SetIcon[ForType] and GetIcon[ForType] in BMimeType
and BAppFileInfo, which handle flat vector icon data
* changes in Tracker to support scalable icons (currently broken for
non-vector icons and needs cleanup) and drawing icons correctly with alpha
channel (large parts of this work done by Michael Lotz)

If someone feels like looking over the changes, that would be much
appreciated! :-)


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


# 31dc79a18b4e73cddd78b71b7d74e8edb680b6f0 03-Apr-2006 Axel Dörfler <axeld@pinc-software.de>

* Added B_MINI_ICON_TYPE and B_LARGE_ICON_TYPE to TypeConstants.h.
* Cleanup.


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


# e83935e59b2ed9bbde75e2751c95824943f9e9cf 03-Apr-2006 Axel Dörfler <axeld@pinc-software.de>

It no longer appears as if you need to delete file types twice until they
disappear. This fixes a part of bug #279.


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


# bf2657c5d7fa78dca270519c7e77b8a43ba7b9de 08-Mar-2006 Axel Dörfler <axeld@pinc-software.de>

Database::Delete() now supports deleting super types as well (by deleting all
sub types first).
Also, if removing the type from the supporting application lists fails, this
is no longer propagated to the user - the MIME type got deleted after all,
and that's the purpose of this function.


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


# 208a6ce11b7e79452a432be62bd410fd711a05ce 27-Feb-2006 Axel Dörfler <axeld@pinc-software.de>

We now set the preferred application of MIME types that are installed from
the supported types of an application to the one responsible.


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


# 98d9f1b483cf3c74e88f393f6d551b077fc2c8af 16-Feb-2006 Axel Dörfler <axeld@pinc-software.de>

* Only allowed application hints of B_MIME_TYPE_LENGTH instead of B_PATH_NAME_LENGTH.
* Introduced a _SetStringValue() to avoid code duplication.
* The string types now check the original value, and don't write anything if the
contents stay unchanged (with the current exception of the sniffer rules).
* The monitor notfication methods no longer "clobber" the status result.
* Major cleanup.


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


# 17e6de7a37c5c61f45eb724de108daa70905cb8f 03-Aug-2003 shadow303 <shadow303@nowhere.fake>

gcc 3 fixes


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


# 86c6e9c1c185239a8ed3639aabcea4b7aec412eb 01-Oct-2002 Tyler Dauwalder <tylerdauwalder@nowhere.fake>

+ Moved some code from SnifferRules::GuessMimeType(entry_ref*) that
really didn't belong there into Database::GuessMimeType(entry_ref*)
+ Added special meta mime file case to Database::GuessMimeType(entry_ref*)


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


# b690150ecf088935c13c18a2f8ac66ebec24d246 29-Sep-2002 Tyler Dauwalder <tylerdauwalder@nowhere.fake>

Removed mime update code


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


# 1bd963b6c27017324c3589c8ea29d635e1552b7f 23-Sep-2002 Tyler Dauwalder <tylerdauwalder@nowhere.fake>

+ Added file-extension based mime type guessing
+ Added sniffer rule based mime type guessing
+ Added get_device_icon()
+ Added complete (synchronous, asynchronous; recursive,
non-recursive; forcing, non-forcing; you name it we got it :-)
update_mime_info() implementation.


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


# e3a2f2069e5e2614e2a96c24502c91b482ec8e65 09-Sep-2002 Tyler Dauwalder <tylerdauwalder@nowhere.fake>

+ Added SetSupportedTypes() test
+ Modified BMimeType::SetSupportedTypes functionality so it keeps track of
stranded types (i.e. previously supported types that have not had the now
unsupporting app signature removed from their supporting apps list yet due
to a false fullSync parameter) over consecutive SetSupportedTypes(...,
false) calls and updates all appropriate stranded types on the next
SetSupportedTypes(..., true) call.
+ Added fullSync parameter to BMimeType::DeleteSupportedTypes
+ Made BMimeType::Delete() do a DeleteSupportedTypes(..., true) call to
properly update the supporting apps lists when a mime type is deleted.
+ Added initial BMimeType::Get/SetSnifferRule
+ Updated BMimeType::CheckSnifferRule() to return B_BAD_VALUE when passed
a NULL rule string.
+ Brought CheckSnifferRule() tests up to date
+ Added lots of Mime::Database doxygen
+ Added any missing mime monitor notifications in Mime::Database
+ Possibly made some other changes as well... :-)


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


# 35ab40ee3e0a39c4a9958a165f27baa339635ea9 30-Aug-2002 Ingo Weinhold <ingo_weinhold@gmx.de>

Database::SetSupportedTypes() now installs the not yet installed supported types.


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


# 41b9ba915590dbf113a8a12059135a6c5a209a0f 28-Aug-2002 Tyler Dauwalder <tylerdauwalder@nowhere.fake>

Added GetSupportingApps()/SetSupportedTypes() functionality


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


# 32f45afc2650a8b92c41a10a0fb552752d6b4036 27-Aug-2002 Tyler Dauwalder <tylerdauwalder@nowhere.fake>

+ Added GetInstalled[Super]Types functionality
+ Cleaned up warnings
+ Added documentation


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


# e20a514ae90bd65d06ff19517a1220b3f92760ee 23-Aug-2002 Tyler Dauwalder <tylerdauwalder@nowhere.fake>

After implementing the BMimeType::GetInstalled[Super]Types()
functionality, it became apparent that some restructuring was
needed if I wanted to keep things clean and managble.
storage/MimeDatabase.{h,cpp} have been broken into:

storage/mime/database_support.{h,cpp}
+ MIME database constants
+ high-level database access functions like open_type(),
read_mime_attr(), etc.

storage/mime/database_access.{h,cpp}
+ atomic read functions
+ is_installed()
+ get_icon_data()

storage/mime/Database.{h,cpp}
+ Mime::Database class, which is responsible for all write,
non-atomic read, and mime monitor functionality.

storage/mime/InstalledTypes.{h,cpp}
+ Helper class for Mime::Database::GetInstalled[Super]Types()

storage/mime/Supertype.{h,cpp}
+ Helper class for Mime::InstalledTypes

I haven't merged my intial, somewhat cludgy GetInstalled[Super]Types
implementation into the new setup yet. That comes next, and it ought
to be a more graceful implementation now.

I also implemented BMimeType::Get/SetSupportingTypes(), though
they haven't been tested yet (sorry).


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