Commit Graph

202 Commits

Author SHA1 Message Date
Axel Dörfler 19d8cb703c BDate: added time_t constructor.
* This class is pretty much useless as it is.
2015-09-04 17:33:07 +02:00
Adrien Destugues 404cb7e310 BReference: missing const cast when building a BReference<const>
* The internal BReference is on a non-const object so it can increment
and decrement the reference count, so we need to cast the const away.
2015-06-14 15:46:53 +02:00
Axel Dörfler e711e6e42f Moved BJob, and JobQueue into the support kit.
* Put it in the BSupportKit namespace, following the style introduced
  with the package kit for now.
* The BSupportKit::BJob class no longer knows about the package kit's
  Context class. However, the BPackageKit::BJob class does.
* Due to the namespace juggling, a lot of files had to be touched.
* The JobQueue class remains private.
* Due to the way Haiku is built on itself, you cannot build this change
  under Haiku with an older release.
2015-05-21 21:37:01 +02:00
François Revol 7dd1073833 ByteOrder.h: add explicit casts when using gcc builtins
Those return uintNN_t types instead of our own types,
but uint32 for example is long while uint32_t isn't,
giving some trouble with the PRI* macros for example on PPC.
2015-04-21 00:25:29 +02:00
Michael Lotz e25776bd83 Whitespace cleanup only. 2015-04-08 12:56:58 +02:00
Michael Lotz 5ae3af6cc5 SupportDefs: Add B_SCN* counterparts for some more types.
Namely for [s]size_t, [{phys|generic}_]addr_t and off_t.
2015-04-04 22:55:57 +02:00
Michael Lotz a05bfeb4a9 Whitespace cleanup only. 2015-04-04 22:55:56 +02:00
Adrien Destugues 49e8a3c652 BReferencable: implement const references with specialization
This is simpler and cleaner than my previous attempt. Thanks to Ingo for
suggesting this.
2015-01-27 10:31:08 +01:00
Adrien Destugues e9b8242868 Add a BConstReference class.
This is a BReference that allows only const access to the referenced
object. This was not easily possible with the existing BReference for
two reasons:
* BReference<const Type> would not work, as BReference needs to change
the reference count of the referenced object. Adding mutable and casting
where appropriate wouldwork but,
* It is now also possible to assign a BReference to a BConstReference
(to the same type, of course). The reverse is not allowed, making it
more difficult to "const cast" the referenced object (it's still
possible to "get" the object pointer and cast that).

BConstReference can be used to provide shared read-only access to an
object, for example this can be used to cache non-copiable or
expansive to create objects.
2015-01-26 10:50:48 +01:00
Adrien Destugues c299b09cff SupportDefs: make it C89-safe again
The atomic inlines were not implemented in a C89 safe way:
* Use of "static inline" not allowed, but static __inline__ is
* __inline__ is a GCC extension, but these are already in a __GNUC__
block (other compilers use a non-inline version)
* also fix a C++ style comment
2015-01-19 13:54:18 +01:00
Alexander von Gluck IV f2b20f8804 SupportDef: Add B_COUNT_OF to get array element count.
* We implement this in a lot of places in a lot of
  ways. Lets add it to the SupportDef
2014-11-09 14:47:39 -06:00
Michael Lotz 3fe7b3f72c BString: Add ScanWithFormat convenience method. 2014-11-02 11:38:45 +01:00
Michael Lotz 969af8044a BString: Add format attribute to SetToFormatVarArgs. 2014-11-02 11:38:44 +01:00
Adrien Destugues afd5ec11d2 Add setters to BDate and BCalendarView
* BDate setters don't perform any validation, use with caution.
* BCalendarView setters do perform validation checks, and will adjust
the day so it fits the requested month or year.
* Add tests for the BCalendarView setters.
2014-09-30 15:38:24 +02:00
Adrien Destugues 9e616c6b9e Fix HaikuBuildCompatibility to not define atmics anymore.
This reverts commit 34dbbb65fd.
Instead, we can remove thos from HaikuBuildCompatibility and things will work fine, unless one try t build Haiku on BeOS (this isn't
supported anymore) or a very old Haiku which esdon't have those.
2014-08-29 09:37:44 +02:00
Adrien Destugues 34dbbb65fd Make atomics extern "C" again.
Pawel changed the implementation but I see no reason to make those available only from C++, so it must be an oversight.
Fixes building Haiku on Haiku which otherwise hits a mismatch in build compatibility headers.
2014-08-28 17:44:09 +00:00
Paweł Dziepak a4cdc6072c build: remove B_USE_BUILTIN_ATOMIC_FUNCTIONS
No reason not to use GCC atomic support on non-x86 archs.

Signed-off-by: Paweł Dziepak <pdziepak@quarnos.org>
2014-08-25 23:06:58 +02:00
Paweł Dziepak 2e2c9bd3d0 os/support: implement atomic_*() using GCC builtin helpers
If GCC knows what these functions are actually doing the resulting
code can be optimized better what is especially noticeable in case of
invocations of atomic_{or,and}() that ignore the result. Obviously,
everything is inlined what also improves performance.

Signed-off-by: Paweł Dziepak <pdziepak@quarnos.org>
2014-08-25 23:05:07 +02:00
Ingo Weinhold 8546c4160e BPositionIO: Add {Read,Write}AtExactly()
Analoguous to {Read,Write}Exactly(), just for the *At() versions.
2014-07-12 15:40:21 +02:00
Ingo Weinhold b773d89eba BDataIO: Add Flush() 2014-06-30 21:55:40 +02:00
John Scipione 29e8fa5922 Style fixes to Support Kit files 2014-06-24 19:30:54 -04:00
Ingo Weinhold 0d8b44e25b BDataIO: Add methods {Read,Write}Exactly() 2014-06-23 22:58:15 +02:00
Ingo Weinhold dec78bb27c Add new error codes B_PARTIAL_{READ,WRITE} 2014-06-23 22:58:15 +02:00
Ingo Weinhold 98759fe6e6 BDataIO: Provide default implementations for Read()/Write()
This makes the interface somewhat more suitable for unidirectional use,
since one doesn't have to implement the other, not needed method.
2014-06-23 22:58:14 +02:00
Adrien Destugues b92e7f1512 Make BReferenceable public.
* The Network Kit now makes use of it for BUrlContext, so we need this
in the public headers.
* Problem caught by the new build bot by compiling the unit tests.
2014-06-11 17:08:05 +02:00
Jessica Hamilton fad4fc59f9 Revert "ByteOrder.h: remove use of __builtin_bswap16."
This reverts commit 040dc2eebc.
2014-05-30 20:39:43 +12:00
Jessica Hamilton 040dc2eebc ByteOrder.h: remove use of __builtin_bswap16.
* Fixes the build for host compilers older than gcc-4.8
2014-05-30 08:45:57 +12:00
Jessica Hamilton 44ec21c3ff ByteOrder.h: simplify compiler test
* A problem with our gcc requires adding casts for gcc4 when
  the __builtin_bswap functions are used with a format string
* Unlike gcc2, the __builtin_bswap functions do not get disabled
  despite using -fno-builtins, hence added compiler check in
  runtime_loader/utility.cpp
2014-05-30 00:15:38 +12:00
Jessica Hamilton 4ffdf2ed40 Use GCC builtins for byte-swapping. Fixes #10800.
* Introduced in gcc-4.3 for at least Intel platforms
* On ARM, full support added in gcc-4.8
* Other platforms untested, left as-is
* This introduces a breaking change to the ABI for gcc4
2014-05-27 05:35:38 +12:00
Pawel Dziepak 634bc98a3c libroot/x86[_64]: relax asm constraints in tls_*() functions 2014-05-04 02:40:04 +02:00
Pawel Dziepak d0f2d8282f Merge branch 'scheduler'
Conflicts:
	build/jam/packages/Haiku
	headers/os/kernel/OS.h
	headers/os/opengl/GLRenderer.h
	headers/private/shared/cpu_type.h
	src/add-ons/kernel/drivers/power/acpi_battery/acpi_battery.h
	src/bin/sysinfo.cpp
	src/bin/top.c
	src/system/kernel/arch/x86/arch_system_info.cpp
	src/system/kernel/port.cpp
2014-01-17 04:06:15 +01:00
Jonathan Schleifer 76b12d6056 StackOrHeapArray: Add missing include of cstddef.
Signed-off-by: Jérôme Duval <jerome.duval@gmail.com>
2014-01-13 19:14:49 +01:00
Jonathan Schleifer 4bda0212ce Add BStackOrHeapArray. 2014-01-10 22:31:46 +01:00
Alexander von Gluck IV aa4b5749d6 runtime_loader: Detect and trigger on PE binaries
* Previously PE binaries would trigger the "incorrectly
  executable" dialog. Now we get a special message for
  B_LEGACY_EXECUTABLE and B_UNKNOWN_EXECUTABLE
* Legacy at the moment is a R3 x86 PE binary. This could
  be extended to gcc2 binaries someday far, far, down the
  road though
* The check for legacy is based on a PE flag I see
  set on every R3 binary (that isn't set on dos ones)
* Unknown is something we know *is* an executable, but
  can't do anything with (such as an MSDOS or Windows
  application)
* No performance drops as we do the PE scan last
* Tested on x86 and x86_gcc2
2014-01-07 19:38:07 -06:00
Ingo Weinhold c39c9283aa Add get_architectures() and C++ versions
* get_architectures() returns the primary and the secondary
  architectures in one array. That turned out to be convenient.
* Add C++ versions for get[_secondary]_architectures(), returning a
  BStringList.
2013-11-17 02:09:37 +01:00
Ingo Weinhold 60b39cd741 Add get_*architecture() API, extend find_path*() API
* Add get_architecture(), get_primary_architecture(),
  get_secondary_architectures(), guess_architecture_for_path() to get
  the caller's architecture, the primary architecture, all secondary
  architectures, or the architecture associated with a specified path
  respectively.
* Rename the find_path*() functions to find_path*_etc() and add an
  optional architecture parameter. Add simplified find_path*()
  functions.
* BPathFinder: Add FindPath[s]() versions with an architecture
  parameter.
2013-11-17 02:09:36 +01:00
Pawel Dziepak 077c84eb27 kernel: atomic_*() functions rework
* No need for the atomically changed variables to be declared as
   volatile.
 * Drop support for atomically getting and setting unaligned data.
 * Introduce atomic_get_and_set[64]() which works the same as
   atomic_set[64]() used to. atomic_set[64]() does not return the
   previous value anymore.
2013-11-05 22:32:59 +01:00
Adrien Destugues d05f9e2d3d BDateTime: Time_T functions return or take a time_t
* They used an unsigned int, which led to overflows when trying to set
them to a time before January 1st, 1970 (local time)
 * Some things use January 1st, 1970, GMT (or UTC) as a reference point.
In my timezone this leads to such a negative date. An example is cookie
expiration dates which are set to this date to expire them immediately.
Spotted by Opera testsuite.
 * This makes the method unuseable for dates after 2036 (signed 32-bit
time_t will overflow then. This gives us just 33 years to switch to a
64-bit time_t. In te meantime, please try using other methods to set the
date and time for BDateTime objects if you need to go this far.
2013-10-11 08:32:26 +02:00
Ingo Weinhold 406ad5bece BString::SetToFormat(): Add printf format function attribute 2013-09-11 04:43:05 +02:00
Ingo Weinhold be3833c9a4 BString: Add SetToFormatVarArgs() 2013-08-28 00:36:27 +02:00
Ingo Weinhold c82776b2fa BString: Add Split() 2013-05-25 01:12:36 +02:00
Ingo Weinhold 8698ee4521 BStringList: Declare Join() const 2013-05-25 01:12:36 +02:00
Ingo Weinhold c663ca2171 Merge branch 'master' into package-management
Conflicts:
	build/jam/HaikuImage
	src/system/kernel/arch/x86/64/arch.S
2013-05-12 00:18:19 +02:00
Ingo Weinhold 25a7b01d15 Merge branch 'master' into package-management
Additional changes:
* Add src/system/kernel/lib/zlib, which builds a kernel version of zlib,
  needed by packagefs.
* BuildFeatures: Add a build feature "gcc2" to allow for easier checks.
* Referenceable.cpp: Include <OS.h> instead of <debugger.h>. The latter
  is not needed and prevents building for the build platform.
* zlib/zutil.h: Fix gcc 2 build. We really should use the external
  package instead.

Conflicts:
	.gitignore
	build/jam/BuildSetup
	build/jam/FileRules
	build/jam/FloppyBootImage
	build/jam/HaikuImage
	build/jam/ImageRules
	build/jam/KernelRules
	build/jam/NetBootArchive
	build/jam/OptionalBuildFeatures
	build/jam/OptionalLibPackages
	build/jam/OptionalPackageDependencies
	build/jam/OptionalPackages
	build/scripts/build_haiku_image
	configure
	data/bin/installoptionalpackage
	data/system/boot/Bootscript
	headers/os/app/Message.h
	headers/os/package/PackageInfo.h
	headers/os/package/PackageInfoAttributes.h
	headers/os/package/PackageInfoSet.h
	headers/os/package/PackageRoster.h
	headers/os/package/PackageVersion.h
	headers/os/package/hpkg/PackageInfoAttributeValue.h
	headers/os/storage/FindDirectory.h
	headers/os/storage/Node.h
	headers/os/support/StringList.h
	headers/private/system/directories.h
	src/add-ons/kernel/drivers/audio/ac97/es1370/Jamfile
	src/add-ons/kernel/file_systems/packagefs/AttributeIndex.cpp
	src/add-ons/kernel/file_systems/packagefs/Jamfile
	src/add-ons/kernel/file_systems/packagefs/Package.cpp
	src/add-ons/kernel/file_systems/packagefs/Package.h
	src/add-ons/kernel/file_systems/packagefs/PackageDomain.cpp
	src/add-ons/kernel/file_systems/packagefs/PackageDomain.h
	src/add-ons/kernel/file_systems/packagefs/PackageFSRoot.cpp
	src/add-ons/kernel/file_systems/packagefs/PackageLinkDirectory.cpp
	src/add-ons/kernel/file_systems/packagefs/PackageLinkDirectory.h
	src/add-ons/kernel/file_systems/packagefs/PackageLinkSymlink.cpp
	src/add-ons/kernel/file_systems/packagefs/PackageLinkSymlink.h
	src/add-ons/kernel/file_systems/packagefs/PackageLinksDirectory.cpp
	src/add-ons/kernel/file_systems/packagefs/PackageNode.h
	src/add-ons/kernel/file_systems/packagefs/ResolvableFamily.cpp
	src/add-ons/kernel/file_systems/packagefs/Version.cpp
	src/add-ons/kernel/file_systems/packagefs/Version.h
	src/add-ons/kernel/file_systems/packagefs/Volume.cpp
	src/add-ons/kernel/file_systems/packagefs/Volume.h
	src/add-ons/kernel/file_systems/packagefs/kernel_interface.cpp
	src/add-ons/kernel/file_systems/userlandfs/shared/driver_settings.c
	src/apps/deskbar/BarApp.cpp
	src/apps/deskbar/BarMenuBar.cpp
	src/apps/deskbar/BarMenuBar.h
	src/apps/deskbar/BarView.cpp
	src/apps/deskbar/BarView.h
	src/apps/deskbar/BarWindow.cpp
	src/apps/deskbar/BarWindow.h
	src/apps/deskbar/DeskbarMenu.cpp
	src/apps/deskbar/DeskbarMenu.h
	src/apps/deskbar/DeskbarUtils.cpp
	src/apps/deskbar/DeskbarUtils.h
	src/apps/deskbar/ExpandoMenuBar.cpp
	src/apps/deskbar/ExpandoMenuBar.h
	src/apps/deskbar/TeamMenu.cpp
	src/apps/processcontroller/ProcessController.cpp
	src/apps/remotedesktop/RemoteDesktop.cpp
	src/bin/bash/config-top.h
	src/bin/finddir.c
	src/bin/package/Jamfile
	src/bin/package/command_add.cpp
	src/bin/package/command_create.cpp
	src/bin/package/command_list.cpp
	src/bin/package_repo/command_list.cpp
	src/bin/pkgman/command_refresh.cpp
	src/build/libbe/support/Jamfile
	src/build/libpackage/Jamfile
	src/build/libroot/Jamfile
	src/build/libroot/fs.cpp
	src/build/libroot/remapped_functions.h
	src/kits/locale/MutableLocaleRoster.cpp
	src/kits/opengl/GLRendererRoster.cpp
	src/kits/package/PackageInfo.cpp
	src/kits/package/PackageInfoSet.cpp
	src/kits/package/PackageRoster.cpp
	src/kits/package/PackageVersion.cpp
	src/kits/package/RepositoryCache.cpp
	src/kits/package/hpkg/PackageWriterImpl.cpp
	src/kits/package/hpkg/ReaderImplBase.cpp
	src/kits/package/hpkg/WriterImplBase.cpp
	src/kits/print/PrintTransport.cpp
	src/kits/print/Printer.cpp
	src/kits/screensaver/ScreenSaverRunner.cpp
	src/kits/support/StringList.cpp
	src/kits/tracker/ContainerWindow.cpp
	src/kits/tracker/DeskWindow.cpp
	src/kits/tracker/PoseView.cpp
	src/libs/print/libprint/Transport.cpp
	src/preferences/printers/AddPrinterDialog.cpp
	src/preferences/screensaver/ScreenSaverWindow.cpp
	src/servers/debug/DebugServer.cpp
	src/servers/input/AddOnManager.cpp
	src/servers/media_addon/MediaAddonServer.cpp
	src/system/boot/Jamfile
	src/system/boot/loader/Jamfile
	src/system/boot/loader/loader.cpp
	src/system/boot/loader/vfs.cpp
	src/system/kernel/fs/vfs.cpp
	src/system/kernel/fs/vfs_boot.cpp
	src/system/libroot/os/find_directory.cpp
	src/system/runtime_loader/runtime_loader.cpp
	src/tools/package/Jamfile
2013-05-05 15:03:26 +02:00
Jérôme Duval dc4e3ce337 added B_PRIxOFF 2013-05-04 15:31:04 +02:00
Jérôme Duval 843a122fd9 MediaPlayer: some 64 bit fixes 2013-05-04 11:15:41 +02:00
Ingo Weinhold c10119fa42 BStringList: Add Join() 2013-04-29 19:32:23 +02:00
Ingo Weinhold c128275ede <Archivable.h>: Fix conflict with BPackageKit::BPrivate
... when "using BPackageKit::BPrivate".
2013-04-21 12:29:41 +02:00
Siarzhuk Zharski 1f8d927251 Make Windows-1250 encoding consistent with other
In sake of consistency with other Windows CP encodings:
* print_name is expanded to "Windows Central European (CP 1250)";
* B_MS_WINDOWS_1250_CONVERSION id looks like should be added into UTF8.h;
* mime_name set to NULL as other windows codepages have. That prevents
  at least from duplicating too much 1250's in the Terminal, Mail and
  StyledEdit encodings menus.
2013-04-14 21:39:13 +02:00
Ingo Weinhold 379131d97d BString: Add StartsWith() and EndsWith() methods 2013-04-08 15:44:31 +02:00