Commit Graph

8280 Commits

Author SHA1 Message Date
Adrien Destugues
955d5259d0 Rewrite sample HashTable description to use the typedefs
This makes the code more readable (as KeyType and ValueType are clearer
than int and Foo) and easier to copypaste and edit.
2015-01-09 18:09:11 +01:00
Dario Casalinuovo
14896b937a Implement BMediaRoster::RollNode().
Fixes #9083.

Signed-off-by: Adrien Destugues <pulkomandy@gmail.com>
2015-01-08 08:57:01 +01:00
Axel Dörfler
d33e4744df IMAP: downloading mails is now working.
* Changed the way the attributes are written to make sure that everything
  that can be written once is in fact written just once.
* The rename code in BMailProtocol::_ProcessFetchedHeader() was broken,
  and caused the hang of the last commit.
2015-01-06 15:26:47 +01:00
Axel Dörfler
549949b26f Mail Kit: Changed how filter changes work.
* BMailFilter::HeaderFetched() now only alters the entry_ref, and returns
  B_MOVE_MAIL_ACTION to move a mail.
* Instead of potentially moving the file around several times, the
  BMailProtocol now takes care of carrying out the filter action just once,
  including trying to make the file name unique.
* This also allows the IMAP add-on to know the final location of the mail,
  and thus downloading a message actually works.
* However, with my test inbox, it currently hangs, and a current Debugger does
  not work on my older system -- I guess I need to update.
* Replaced the duplicated space mechanism within the "HaikuMailFormatFilter"
  that is substantially faster, and handles all whitespace, not just spaces.
  It will also replace tabs with spaces.
2015-01-06 15:26:37 +01:00
Axel Dörfler
f8b5e17a23 Minor cleanup. 2015-01-06 15:24:47 +01:00
Axel Dörfler
93608baf60 Clarified progress parameter names for the MailProtocol. 2015-01-06 15:24:14 +01:00
Axel Dörfler
4a8448ce34 Major coding style cleanup. 2015-01-06 15:23:33 +01:00
Axel Dörfler
1da1e5a166 Renamed BodyDownloadConfig to BodyDownloadConfigView. 2015-01-06 15:23:15 +01:00
Axel Dörfler
518698c7e7 Removed commented out method in BMailSettingsView. 2015-01-06 15:23:10 +01:00
Axel Dörfler
57b305558b MailProtocolConfigView now is a BMailSettingsView.
* Changed the private settings base classes to follow the new style.
* Made BodyDownloadConfig use the layout API.
* Adapted SMTP to these changes.
2015-01-06 15:23:06 +01:00
Axel Dörfler
ca3341c7b4 Major mail protocol/filter settings rework.
* Instead of abusing BArchive::Archive() we now use a BMailSettingsView as
  a base view for all filter/protocol settings that works with
  BMailAddOnSettings.
* Cleanups in E-mail which is now completely layout friendly. But also still
  crashes when changing the views.
2015-01-06 15:22:56 +01:00
Axel Dörfler
f90a3bbd67 Added support for letting user mail add-ons override system ones.
* The path will now be relativized before storing it.
* On load, the add-on will be tried to load from the user, then common
  and finally system add-on directory.
2015-01-06 15:22:37 +01:00
Axel Dörfler
1f87386b0a Now also loads mail settings from common.
* Also removed the superfluous and unused timeout argument from Save().
2015-01-06 15:22:28 +01:00
Axel Dörfler
bcf60bbb83 Fixed Mail build.
* The former kMsgBodyFetched (now B_MAIL_BODY_FETCHED, following the other
  message constant names in AppDefs.h) must be public.
2015-01-06 15:22:18 +01:00
Axel Dörfler
146357b547 Completed transition to the new mail API; ie. it compiles.
* Completely untested yet. Unlikely to work yet.
2015-01-06 15:21:55 +01:00
Axel Dörfler
383b34adac Moved ProtocolConfigView to headers/private/mail.
* This is by no means meant as a public header.
2015-01-06 15:21:50 +01:00
Axel Dörfler
715bf3d17a Work in progress of mail rework.
* Not everything compiles; all protocols, and inbound filters do, though.
* Renamed a few classes to give a better idea what they are for; prefixed
  public classes with the 'B' prefix.
* Moved ProtocolConfigView's classes into the BPrivate namespace.
* Moved BMailFilter into its own file.
* Added BMailFilter::DescriptiveName(). This is now used by the RuleFilter
  in order to give a description of what it's doing (ie. no more dozens of
  "Rule filter" entries in the preferences).
* Removed no longer used MailAddon.h.
* Renamed Addon to AddOn where found, since that is more consistent with the
  rest of the API.
* Merged the former MailProtocol with the former MailProtocolThread; the
  differentiation between those two was pretty messy.
* All configuration views touched so far are now using the layout kit.
* The RuleFilter is currently broken functionality wise; I have not yet decided
  how to solve the stuff it uses (TriggerFileMove() does not exist anymore,
  for example).
* BMailAddOnSettings (formerly known as AddonSettings) now directly subclass
  BMessage; there are no Settings() and EditSettings() method anymore. The
  class uses a copy of itself to determine whether or not it has been changed.
* Lots of cleanup.
2015-01-06 15:21:36 +01:00
Axel Dörfler
0f11280e6d Minor MailNotifier cleanup.
* Renamed to BMailNotifier, as it's part of the public API.
* Renamed Notifier.{cpp|h} to DefaultNotifier.{cpp|h} as that's the class it
  implements.
* Made the mail counts uint32, and the byte counts uint64.
2015-01-06 15:21:31 +01:00
Axel Dörfler
e0676bb982 Fixed typo. 2015-01-06 15:21:26 +01:00
Axel Dörfler
9192d4dcf3 Started working on the IMAP add-on itself.
* Renamed imap_config.cpp to ConfigView.cpp, IMAPFolderConfig.(h|cpp)
  to FolderConfigWindow.(h|cpp).
* Got the latter to build.
* Added Settings class to simplify and unify the BMessage based
  settings access.
* Removed the InboundProtocol[Thread] implementation from the build for now.
2015-01-06 15:20:35 +01:00
Adrien Destugues
a6f1bc984d BMessage::ReplaceData: potential corruption on realloc fail
The method would update the field offsets first, and would not restore
them in case of realloc failure, leaving them pointing to the wrong
place.
2014-12-24 11:52:02 +01:00
Jérôme Duval
d6aaebc757 x86: added two MSR definitions. 2014-12-23 19:14:52 +01:00
Adrien Destugues
207212972e BMessage: remove unimplemented GetPointer from headers and docs
* This was never implemented and no one noticed until now.
* A default value for a pointer doesn't make that much sense anyway, so
using the FindPointer method is fine.
2014-12-22 15:01:56 +01:00
Timothy Gu
d1dc9cf655 stdint.h: use correct type for INT64_MAX (#11647)
int64_t is signed. Although it does not make a difference by itself, because
INT64_MAX is still a valid number for uint64_t (UL), the later INT64_MIN
declaration depends on INT64_MAX, and therefore got implicitly casted to
unsigned type.

This fixes the following program on a x86_64 system:

	#include <stdint.h>

	int main() {
		int64_t test = 5;
		if (test < INT64_MIN)
			return 1;
		return 0;
	}

This is a regression since commit 1d13a609 ("stdint.h: define [U]INT64[MAX|MIN]
with [U]L on x86_64").

Signed-off-by: Jerome Duval <jerome.duval@gmail.com>
2014-12-20 10:06:21 +01:00
John Scipione
b825666f3f Rename method parameter in header to match implementation 2014-12-19 19:58:56 -05:00
John Scipione
65dfd2c67c Documentation fixes for BTab and BTabView 2014-12-19 19:51:42 -05:00
John Scipione
f466445917 Changes to BTextControl for docs.
Also remove the non-ControlLook drawing code.
2014-12-18 20:45:44 -05:00
Adrien Destugues
9a539f9e80 Outsource ncurses. 2014-12-18 10:18:39 +01:00
Puck Meerburg
a5f30beaad Fix #7008: Add a64l and l64a from glibc, and add some missing definitions in wchar.h and stdlib.h
Signed-off-by: Jérôme Duval <jerome.duval@gmail.com>
2014-12-14 18:06:09 +01:00
Jérôme Duval
1d13a60901 stdint.h: define [U]INT64[MAX|MIN] with [U]L on x86_64
instead of [U]LL
2014-12-14 15:55:14 +01:00
Puck Meerburg
e4e2ce4ce3 When testing screensaver, don't have mouse move exit the screen saver.
Fixes #7463

Signed-off-by: Adrien Destugues <pulkomandy@gmail.com>
2014-12-10 21:18:30 +01:00
John Scipione
4a31c32620 Update locale docs to match new reality.
Created docs for NumberFormat, DateFormat, DateTimeFormat, and TimeFormat
and moved the docs from BLocale to the respective new file. Also
DurationFormat was updated as well.

doxygen once again compiles the docs without warnings.
2014-12-04 19:13:46 -05:00
John Scipione
5ae0cde363 Style fixes to BStringView related to docs 2014-12-04 17:56:24 -05:00
Adrien Destugues
529cd177b5 BFilePanel: allow to change the node flavors
There doesn't seem to be anything ini the implementation that would
cause a problem, as long as you don't try to change this while the
window is already open.
2014-12-04 09:26:49 +01:00
Theodore Kokkoris
249a4944c3 Removed dead code (CID: 1255314) 2014-12-03 21:14:24 +01:00
John Scipione
539dc1bc53 A bunch of style fixes
No functional changes intended
2014-12-02 19:23:51 -05:00
Adrien Destugues
4c7f391f32 Add a <limits> header for gcc2.
Hacked from the gcc4 version. There may be wrong values returned in some
cases.

Fixes #6701.
2014-11-27 12:14:39 +01:00
Adrien Destugues
56abf4aa37 Fix std::isnan and friends for gcc2.
gcc2 was relying on the c99 functions being there, but they are not in
the std namespace.
* Disable the C99 functions and macros in C++ mode
* Redefine them as inline functions in cmath in the std namespace.

Fixes #7396.
2014-11-27 10:58:49 +01:00
Adrien Destugues
3d06e082bc BOptionPopUp: move mennu setup to AttachedToWindow
* There is no need to delay this to AllAttached
* Apps may want to override the SetDivider, and doing it as late as
AllAttached can be annoying.

Fixes #10734.
2014-11-27 09:00:23 +01:00
Adrien Destugues
af218cc4e1 Notifications default to enabled on first boot.
* The server did this right, but the preflet would not check the
checkbox when there was no settings file.
2014-11-25 08:50:47 +01:00
François Revol
12533060d0 stdio.h: add missing typedefs
I should sleep more and build more :D
2014-11-19 15:45:17 +01:00
François Revol
e1f303c5ec Add fopencookie() to stdio.h
We already export it in libroot, and libassuan seems to require it.
2014-11-19 15:13:45 +01:00
Adrien Destugues
1d48729397 There is no B_PRIdTHREAD 2014-11-17 19:18:55 +01:00
Adrien Destugues
2922c4ab90 userlandfs: more 64bit fixes. 2014-11-17 18:51:49 +01:00
Adrien Destugues
5b1f411f57 UserlandFS: 64-bit fix. 2014-11-17 10:58:03 +01:00
Adrien Destugues
a358634d15 Update udis86 to current version. 2014-11-12 11:25:41 +01:00
Augustin Cavalier
0a74147e1d BToolbar: Allow the toolbar's orientation to be set by its creator.
I already made this patch in Heidi's clone of BToolbar. Adding it here
allows me to drop Heidi's version altogether.

I also relicensed the header file at the permission of Stephan. The .cpp
file still lists him as author and copyright holder.

Signed-off-by: Jessica Hamilton <jessica.l.hamilton@gmail.com>
2014-11-10 13:21:13 +13:00
Alexander von Gluck IV
57bc65034a Everything: Update lots of code to use B_COUNT_OF macro
* Likely not everything, but the obvious uses of B_COUNT_OF
2014-11-09 14:52:19 -06: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
Adrien Destugues
8007a392cf BMessage: add AddFlat taking a const BFlattenable
It seems the const was forgotten in the BeOS version. But there is no
reason not to have it.
2014-11-09 13:51:29 +01:00
François Revol
1436fe7448 Add TIOCM_CAR as a synonym for TIOCM_CD
Gnokii uses it.
2014-11-09 02:28:06 +01:00
Adrien Destugues
5ee2151e2c BHttpRequest: propagate SSL errors to listener
This way it's possible to handle them in applications.
2014-11-06 15:02:00 +01:00
Adrien Destugues
c86ad7f93b Add more features in BCertificate class
* Make it possible to extract more useful data from the certificate
* Also get the OpenSSL error message when a certificate can't be
validated. Send it to the verification failure callback so it can be
shown to the user.
2014-11-06 15:01:59 +01:00
Jessica Hamilton
9f8197a872 BToolbar: move into BPrivate namespace, as it's not public yet 2014-11-06 16:44:02 +13:00
Augustin Cavalier
6d93638b37 ToolBarView: rename to BToolbar and move to libshared.
Also adjust ShowImage for this, it's the only thing that's using ToolBarView
right now.

Signed-off-by: Jessica Hamilton <jessica.l.hamilton@gmail.com>
2014-11-04 12:45:47 +13: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
Michael Lotz
bf685cdf2e kernel: Fix missing reference release in CreateThreadEvent.
CreateThreadEvent::DoDPC() missed a reference release to balance the
acquired reference before queuing the DPC, resulting in the
CreateThreadEvent objects being leaked.

This also removes the destructor that tried to cancel the DPC. Since
the class is reference counted and only destroyed when the DPC has
run and released the last reference, this didn't make much sense.
2014-11-01 16:32:04 +01:00
Michael Lotz
6a80e6889a kernel: Fix missing reference to team/thread in signal events.
The signal to the team/thread is only actually sent in a deferred
procedure. To ensure that the team/thread stays valid between the DPC
being queued and it actually running, we need to acquire a reference.

Fixes #11390, where the DPC was run after the team was already
destroyed.
2014-10-31 16:16:37 +01:00
Ithamar R. Adema
778611c7e6 fdt: humble beginnings of Flattened Device Tree
This isn't really a bus_manager yet, but just minimal support so
we can get rid of hardcoded ARM SoC support from the core kernel
code.

Needs lots of work, like proper handling of #address-cells and
the like. Also, generic attribute handling, device_manager
integration, and I could go on for hours ;)
2014-10-31 11:14:05 +01:00
Oliver Tappe
b9c8e3de1b string.h: include strings.h for compatibility.
* Partly reverting hrev47655, as the moved declarations are expected
  by many ports to be accessable via string.h. 
  Following standards is a good thing in general, but not if it causes 
  more problems than it helps ...
2014-10-30 00:20:13 +01:00
Ingo Weinhold
6bbd25f071 Make vfs_resize_fd_table() accessible in the kernel
Also update some types from int to uint32.
2014-10-29 21:07:02 +01:00
Ingo Weinhold
078a965f65 vm_soft_fault(): Avoid deadlock waiting for wired ranges
* VMArea::AddWaiterIfWired(): Replace the ignoreRange argument by a
flags argument and introduce (currently only) flag
IGNORE_WRITE_WIRED_RANGES. If specified, ranges wired for writing
are ignored. Ignoring just a single specified range doesn't cut it
in vm_soft_fault(), and there aren't any other users of that feature.
* vm_soft_fault(): When having to unmap a page of a lower cache, this
page cannot be wired for writing. So we can safely ignore all
writed-wired ranges, instead of just our own. We even have to do that
in case there's another thread that concurrently tries to write-wire
the same page, since otherwise we'd deadlock waiting for each other.
2014-10-29 12:37:25 +01:00
Ingo Weinhold
9da590f73e Add vm_page_free_etc()
It additionally gets a vm_page_reservation* argument. If not NULL, the
page count of the reservation is incremented for the freed page.
2014-10-29 02:36:08 +01:00
Michael Lotz
52d500e5b4 kernel: Workaround for double lock of spinlock in user timers.
The thread that is being [un]scheduled already has its time_lock locked
in {stop|continue}_cpu_timers(). When updating the TeamTimeUserTimer,
the team is asked for its cpu time. Team::CPUTime() then iterates the
threads of the team and locks the time_lock of the thread again.

This workaround passes a possibly locked thread through the relevant
functions so Team::CPUTime() can decide whether or not a thread it
iterates needs to be locked or not.

This works around #11032 and its duplicates #11314 and #11344.
2014-10-29 00:25:37 +01:00
Adrien Destugues
4ed39e6a62 disk device manager: check that partitions are unmounted before uninitializing.
when uninitializing a partition or a disk (removing the partition
table), check that all partitions from that table are unmounted, as they
are about to become invalid.

Fixes #8827.
2014-10-28 23:52:57 +01:00
Adrien Destugues
04dbe5b1c5 safemode.h: make it usable from C code. 2014-10-28 23:52:22 +01:00
Adrien Destugues
5d5ec05b1d B*Format: make immutable and remove locking
The language and formatting conventions can now only be set when
creating the objects. This removed the needs for locking them when
formatting to avoid some other thread changing the format while it's
being used.

Adjust tests and DeskBar TimeView to the API changes.
2014-10-27 14:08:42 +01:00
Ingo Weinhold
fa80e7b28f x86 kernel args: Increase number of page tables 2014-10-27 10:57:28 +01:00
Ithamar R. Adema
475f00372b ARM: remove annoying #warning
Although done with the best intentions, the usage of #warning in the
ARM build makes it hard to see what's going on, or see any "real"
warnings.

Remove at least this particularly often triggered one, so we can
have a relatively "quiet" build again...
2014-10-26 23:40:17 +01:00
Adrien Destugues
850f2d1e58 Add the at() method to C++ vectors.
* There is no reason not to have this.
2014-10-26 20:28:21 +01:00
Ingo Weinhold
d228f29f6e BPackageManager: Add SetDebugLevel()
Sets the debug level of the solver.
2014-10-26 00:19:35 +02:00
Ingo Weinhold
74b582a4e5 BSolver: Add SetDebugLevel()
In LibsolvSolver set the debug level of the pool.
2014-10-26 00:19:35 +02:00
Axel Dörfler
50d274f7f9 fs_shell: Added missing new permission check function.
* Fixes the build.
2014-10-25 19:31:15 +02:00
Axel Dörfler
5a95af70a2 vfs/{b|btr|package|b}fs/ext2/exfat: common access check.
* Added VFS helper function check_access_permissions() that combines
  several partially correct versions to the one true version (tm).
* All but BFS (since recently) missed the S_IXOTH for root on directories,
  and all but packagefs missed proper group handling.
2014-10-25 18:47:15 +02:00
Michael Lotz
e9922e775f haiku_loader: Fix wrong size of gBootGDT on x86_64.
The BOOT_GDT_SEGMENT_COUNT was based on USER_DATA_SEGMENT on both
x86 and x86_64. However, on x86_64 the order of the segments is
different, leading to a too small gBootGDT array. Move the define to
the arch specific headers so they can be setup correctly in either case.
Also add a STATIC_ASSERT() to check that the descriptors fit into the
array.

Pointed out by CID 1210898.
2014-10-22 21:06:07 +02:00
Adrien Destugues
015a928b88 Notifications: use a single settings file.
There were 3 setting files, each an archived BMessage. Now there is only
one with all the data inside.
* Rework the SettingsPane class to save and load settings from a
message, rather than having each panel pick a file path on its own
* Move saving the app filters to the preference app, rather than the
server (so it's done at the same place as other settings)
* Rework loading prefs in the server so the settings message is read
from the file once and all settings are loaded from it.

This turns out to be more changes than I anticipated.
Fixes #9424.
2014-10-21 18:53:06 +02:00
Adrien Destugues
9bf4e99477 BUrl: IDNA ToUnicode and ToASCII conversions.
* Since DNS are normally restricted to ASCII, the use of UTF-8 in domain
names is implemented using a "punycode" encoding.
* The request to the DNS server must be sent with the ASCII
representation of the domain name, however the Unicode one should be
used for user-visible parts.
* ICU provides an implementation of the conversion, which we use here.
* Conversion is currently done in-place and modifies the BUrl object
(this is similar to UrlEncode/UrlDecode).
* Adjust existing IDN test to make use of these methods. It's passing
now.
2014-10-21 14:43:13 +02:00
Adrien Destugues
06f436b3ac Use strict mode when url-decoding file requests.
We don't want '+' to become a space here.
Fixes #11109.
2014-10-21 11:31:48 +02:00
Adrien Destugues
9c5d1aa295 Fix infinite recursion in agg when drawing bezier with invalid points
* Patch extracted from http://trac.osgeo.org/mapserver/ticket/3862
* Fixes #6738
2014-10-20 15:54:58 +02:00
Adrien Destugues
b10790de44 Radeon: fix warnings on 64bit. 2014-10-19 12:51:53 +00:00
Adrien Destugues
13af65c402 intel_extreme: fix warnings on 64bit. 2014-10-19 12:51:51 +00:00
Adrien Destugues
a7f7bf3dc9 Radeon: fix warning. 2014-10-19 11:49:53 +02:00
Adrien Destugues
00640ac82e Forgot to fix LDBL_MIN... 2014-10-15 13:08:10 +02:00
Adrien Destugues
1f792e1852 gcc2 float.h: use decimal floats. 2014-10-15 11:29:54 +02:00
Adrien Destugues
7f6fdce3c1 Update haiku copy of gcc2 float.h
Shouldn't be needed, but we may as well use the correct version here
too.
2014-10-14 22:11:27 +02:00
Adrien Destugues
bdb4ae32fd Fix unarchiving of BScrollView with layout
* We archive views using "managed" archives, and the children are not
attached in the BView(BMessage*) constructor, but later. So it's not
possible to find the target and scrollbars in the constructor of
BScrollView.
* Make BScrollView override AllUnarchived and find the target and
scrollbars again there. The code is slightly different as there is no
guarantee that the first child will be the target in that case. The
existing code in the constructor is preserved for non-managed archives.
2014-10-12 16:02:34 +02:00
Adrien Destugues
4cada3807c BDragger: add layout-aware constructor.
Somehow no one needed this yet.
2014-10-11 11:18:56 +02:00
Adrien Destugues
26b0a53d12 Add parsing support to BTimeFormat. 2014-10-09 13:35:23 +02:00
Adrien Destugues
961fdd8cc3 BMessageFormat: parse the pattern at construction
* Instead of parsing the pattern everytime Format() is called, parse it
only once when the object is created.
* Adjust all callers to make use of the feature and reuse the instance
as much as possible. This also allows calling B_TRANSLATE only once
instead of everytime the formatting needs to be done. We use either a
static instance (when the message pattern is constant) or a field (when
it is not known to be constant).
* Since the BMessageFormat instances are now reused, add locking to
avoid race conditions (ICU itself is thread safe, but the format pattern
is recreated when the locale is changed)
2014-10-08 15:12:48 +02:00
Adrien Destugues
97d07c8af2 Add API for parsing dates. 2014-10-07 17:40:18 +02:00
Adrien Destugues
090a0d7686 Add an API to get month names. 2014-10-07 16:08:22 +02:00
Adrien Destugues
4a3a474224 Reimplement BDateTimeFormat using ICU support
* Avoid hardcoding the format to "date, time"
* Allows using DateTimePatternGenerator to create custom formats from a
set of fields.
2014-10-07 13:06:40 +02:00
Adrien Destugues
0da7796e6c Add BMessageFormat class.
This can be used to format complex messages properly. It moves the
complexity of handling plural forms, gender, and anything else needed
into the localizable string, rather than hardcoding it in the code.

This moves the difficulty of handling these things properly to people
doing translations, rather than relying on developers to do it.

Fixes #10755, but our localization must now be updated to make use of
the feature.
2014-10-07 08:51:23 +02:00
Adrien Destugues
136884d011 Remove references to NumberFormatImpl.
The class and header file are gone, so don't try to use them.
Fixes #11312.
2014-10-06 08:35:50 +02:00
Adrien Destugues
e3857211d3 Move DateTimeFormat and NumberFormat out of BLocale
* ... and adjust all callers
* Remove NumberFormatImpl: we rely on ICU to provide this and it can be
fully wrapped into the C++ file. The class was a stub anyway.
* "Monetary" format is included in NumberFormat for now. There may be a
more generic solution to handle monetary and BTimeUnitFormat (and other
arbitrary units)
2014-10-02 09:19:54 +02:00
Oliver Tappe
3006031ac2 Move Geolocation to kits/shared and make it private. 2014-10-02 00:32:48 +02:00
Adrien Destugues
03b2550ef1 Move time formatting to BTimeformat.
* Harmonize API for all B*Format to take an output BString by reference
as the first parameter,
* Move the FormatTime methods from BLocale to BTimeFormat
* Adjust all callers for BTimeFormat, BTimeUnitFormat and
BDurationFormat.
2014-10-01 18:13:35 +02:00
Adrien Destugues
44f11d0982 Make BDateFormat inherit from BFormat again
* Move relevant parts up into BFormat so other format classes can use
those
* Adjust BDurationFormat and BTimeUnitFormat for the changes
* Remove the "default" date format, it is better to keep only a default
locale and let applications create B*Formats from it as needed.
* Creating a B*Format without arguments to the constructor now
configures it for the default locale, which allows for easy use in
standard cases (formatting something with the current language and
format)
* Creating a B*Format is potentially an expansive operation, it is
advised to keep the instance around and reuse it whenever possible.
However it must be "refreshed" when the locale changes, for apps which
supports that, since it keeps a copy of the language and formatting
convention, rather than a pointer to the locale as it did before.
2014-10-01 16:29:12 +02:00
Adrien Destugues
13d147b12b Introduce "invalid" text controls.
* MarkAsInvalid is used to enable or disable the mark
* The B_INVALID BControlLook flag is used
* invalid BTextControls are drawn with a red border.
* You ar encouraged to let the user know more precisely what's wrong, by
showing an helpful error message next to the control or in a tooltip.
2014-10-01 12:12:16 +02: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
526d483999 Make BDateFormat mutable
* Add setters for the language and formatting conventions
* Add shortcut getter and setter for the date format
* Use those in the locale roster to make the BDateFormat actually use
the system preferred language and format.
* Applications can also use this to extract specific information from
the system format (eg. set date format to "LLLL" to extract month
names), or define specific formats more easily (eg. for parsing and
generating e-mail headers or HTTP cookies).
2014-09-30 11:49:47 +02:00
Adrien Destugues
f188c1defa BDateFormat: improve API
* Use a reference rather than a pointer for the output string, removing
the need for NULL checks (which were missing, anyway)
* Adjust callers to that change
* Add new Format variant taking a BDate argument
2014-09-30 09:47:02 +02:00
Adrien Destugues
1d38b7a86a Geolocation: avoid static init of BUrl
* Fixes #11290.
2014-09-27 19:20:39 +02:00
Adrien Destugues
2a5e33a980 Move date formatting from BLocale to BDateFormat
* There is a little code duplication. This will be moved to BFormat once
the time and datetime formatting is also moved out of BLocale
* The way to create a BDateFormat from a BLocale is still open for
discussion. I'm undecided between making BDateFormat a member of
BLocale, or adding a BDateFormat(const BLocale&) constructor.
* Adjust all users of the API.
2014-09-26 18:31:11 +02:00
Adrien Destugues
2f36873105 UrlRequest: add empty SetTimeout for ease of use.
* Requests that support this can implement it, NetworkRequest does
* Build fix: no need to return status_t.
2014-09-26 15:51:36 +02:00
Adrien Destugues
654ae69aa6 NetworkRequest: add a SetTimeout method. 2014-09-26 15:21:54 +02:00
Paweł Dziepak
ac97d35790 kernel/arch: remove leftover debug message
Polite fault handlers are nice, but we like the silent ones even more.

Signed-off-by: Paweł Dziepak <pdziepak@quarnos.org>
2014-09-25 21:57:32 +02:00
Adrien Destugues
13f0458896 Add BGeolocation experimental API.
A BGeolocation object can query an online service to get geolocation
and geotagging data:
 * LocateSelf() tries to locate the machine it is running on, by using an
online database of wifi access points
 * Locate() (not yet implemented) searches a BString and converts it to
lat/lon coordinates (reverse geotagging)
 * Name() (not yet implemented) finds a suitable name for the given
coordinates (address, building name, or anything fitting).

The default service used is openbmap.org, which is freely available but
not very accurate. A request has been sent to Mozilla to use MLS
(Mozilla Location Services), which is a bit more accurate but needs an
API key. MLS is used for geolocation on FirefoxOS, for mobile phones
which don't have a GPS, and the data can be contributed by Firefox for
Android or the dedicated MozStumbler app.

Alternatively, Google Maps also provide the service, but wants
people to pay for it. Google Maps data is more accurate as all Android
devices contribute data to it.

All 3 services use the same JSON-based API: we send a list of reachable
Wifi APs (mac address and signal strength), and we get lattitude and
longitude information, and possibly extra data which will currently be
unused.

This can be used to implement HTML5 geolocation with reasonably accurate
results, but it can also be used in other places. For example
FirstBootPrompt could try to guess a list of most likely languages and
keyboard layouts from it (if wifi is working at install time, that is).
2014-09-23 16:37:59 +02:00
Stefano Ceccherini
d553b90c86 BSynth/BSoftSynth: implemented GetAudio().
Patch by Pete Goodeve (modified by me, hopefully for the better and
without introducing bugs) which implements BSynth::GetAudio().
2014-09-21 19:46:04 +02:00
Adrien Destugues
c98378e51a Add HTTP proxy support.
* Move default context management to BUrlRequest since some code
(including the testsuite) bypass the BUrlProtocolRoster.
* Introduce proxy host and port in BUrlContext
* Have BHttpRequest use the proxy when making requests
2014-09-15 14:24:37 +02:00
Jessica Hamilton
fd7f53f049 storage kit: don't expose the dev_t in BPartition::Mount()
Comments to #9672 agree that there's really no need to
expose the dev_t handle, thus simplifying the API.

The dev_t handle, if required, can be retrieved via
BPartition::GetVolume() instead.
2014-09-15 16:28:41 +12:00
Paweł Dziepak
95e97463d2 kernel: add generic wrapper for accessing user memory
This patch adds user_access() which can be used to gracefully handle
page faults that may happen when accessing user memory. It is used
by arch_cpu_user{memcpy, memset, strlcpy}() to allow using optimized
functions from the standard library.

Currently only x64 uses this, but nothing really is arch specific here.

Signed-off-by: Paweł Dziepak <pdziepak@quarnos.org>
2014-09-14 22:39:07 +02:00
Paweł Dziepak
396b74228e kernel/x86_64: save fpu state at interrupts
The kernel is allowed to use fpu anywhere so we must make sure that
user state is not clobbered by saving fpu state at interrupt entry.
There is no need to do that in case of system calls since all fpu
data registers are caller saved.

We do not need, though, to save the whole fpu state at task swich
(again, thanks to calling convention). Only status and control
registers are preserved. This patch actually adds xmm0-15 register
to clobber list of task swich code, but the only reason of that is
to make sure that nothing bad happens inside the function that
executes that task swich. Inspection of the generated code shows
that no xmm registers are actually saved.

Signed-off-by: Paweł Dziepak <pdziepak@quarnos.org>
2014-09-14 19:16:52 +02:00
Paweł Dziepak
b41f281071 boot/x86_64: enable sse early
Enable SSE as a part of the "preparation of the environment to run any
C or C++ code" in the entry points of stage2 bootloader.

SSE2 is going to be used by memset() and memcpy().

Signed-off-by: Paweł Dziepak <pdziepak@quarnos.org>
2014-09-14 19:16:52 +02:00
Paweł Dziepak
f2f91078bd kernel/x86_64: remove memset and memcpy from commpage
There is absolutely no reason for these functions to be in commpage,
they don't do anything that involves the kernel in any way.

Additionaly, this patch rewrites memset and memcpy to C++, current
implementation is quite simple (though it may perform surprisingly
well when dealing with large buffers on cpus with ermsb). Better
versions are coming soon.

Signed-off-by: Paweł Dziepak <pdziepak@quarnos.org>
2014-09-14 19:16:52 +02:00
Paweł Dziepak
6156a508ad kernel/x86[_64]: remove get_optimized_functions from cpu modules
The possibility to specify custom memcpy and memset implementations
in cpu modules is currently unused and there is generally no point
in such feature.

There are only 2 x86 vendors that really matter and there isn't
very big difference in performance of the generic optmized versions
of these funcions across different models. Even if we wanted different
versions of memset and memcpy depending on the processor model or
features much better solution would be to use STT_GNU_IFUNC and save
one indirect call.

Long story short, we don't really benefit in any way from
get_optimized_functions and the feature it implements and it only adds
unnecessary complexity to the code.

Signed-off-by: Paweł Dziepak <pdziepak@quarnos.org>
2014-09-14 19:16:51 +02:00
Fredrik Holmqvist
3594baabf8 Add get_name and fix get_next_object.
TODO: Need to add defines or enum for nameType.
2014-09-14 00:01:10 +02:00
Puck Meerburg
8bfb30ceb3 BPartition: Move dev_t return value to an optional parameter
Signed-off-by: Jessica Hamilton <jessica.l.hamilton@gmail.com>
2014-09-12 18:07:53 +12:00
Fredrik Holmqvist
15d8a434d0 Add function to walk through children.
Without losing my sanity that is.
ACPI API refactoring will happen some day.
2014-09-10 21:39:46 +02:00
Ithamar R. Adema
eea45d0a32 ARM: cleanup of bootloader memory mapping
* Removes default mapping of a portion of the RAM (will be done
  as needed)
* Passes on the page directory area to kernel, so on early vm init
  the kernel can use the area for pagetable allocation.
* Leaves it to the platform to pass in physical memory range(s). This
  will ultimately come from FDT.
* Fix long standing issue with allocation of the heap, potentially
  causing other part of the bootloader to overwrite the heap.
* Implements pagetable allocator in kernel for early vm mapping.

This fixes the first PANIC seen, we now just get the same one later
on when the VM is up... more to come...
2014-09-07 20:56:15 +02:00
Ithamar R. Adema
6048591e9d Revert "Added check to ensure KDL does not include frames beyond kernel entry in the backtrace. This prevents KDL from faulting when printing backtrace on ARM."
This reverts commit 3fbb24680c.

As I mentioned in #11131, this fix is not correct, and works around
the problem. The real reason was that arch_debug_call_with_fault_handler
was not working properly, so the fault handler went crazy.

With commit eb92810 that is fixed so this can be reverted.
2014-09-07 19:15:01 +02:00
PulkoMandy
5de8dca2e4 Bootloader: fix loading of ARM ELF files
* Let the loader know about PT_ARM_UNWIND (and ignore it)
 * Allow up to 32K of space between sections of an ELF files as ARM ones
need that.
2014-09-02 18:15:50 +02:00
PulkoMandy
83f5e2a258 Fix stack alignment for bootloader.
The ARM SP is pointing to the top item of the stack, not the first free
byte. This was confusing dprintf making it fail to print 64bit integers.
2014-09-02 17:01:27 +02:00
Arvind S Raj
3fbb24680c Added check to ensure KDL does not include frames beyond kernel entry in the backtrace. This prevents KDL from faulting when printing backtrace on ARM. 2014-09-02 13:39:57 +02:00
Adrien Destugues
e94bd4810e Fix "strict aliasing rules" warnings
Treated as errors when trying to build the test_app_server for x86_64.
2014-09-02 10:16:01 +02:00
Stephan Aßmus
ffd7c6110b JSON parser: Improve by using exceptions to get exact error
Also strip redundant "_Parser_" prefix from private methods.
2014-08-30 23:42:02 +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
4b75a1e237 kernel/x86_64: implement x86_swap_pgdir in C++
No reason not to inline this function.

Signed-off-by: Paweł Dziepak <pdziepak@quarnos.org>
2014-08-25 23:07:29 +02: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
Stephan Aßmus
836bf24917 Json: Don't force someone including to use BPrivate. 2014-08-24 18:08:50 +02:00
Augustin Cavalier
e4d2963e01 libshared: Introduce JSON parser and MessageBuilder.
Based on an earlier piece of source code of mine that parsed JSON into
QObjects, this JSON parser creates a BMessage tree.

Will be used by Stephan in HaikuDepot for communication with the web app.
2014-08-24 17:36:20 +02:00
Oliver Tappe
87e8603d9f Merge branch 'gcc_syslibs'
* From now on, the gcc-specific system libraries (libgcc, libsupc++ and
  libstdc++) are provided by separate packages built along with gcc:
  - gcc_syslibs contains the shared libraries (libgcc_s.so, libsupc++.so and
    libstdc++.so)
  - gcc_syslibs_devel contains the static libraries and both c++ and gcc
    headers
  The shared libraries now make proper use of symbol versioning and there
  are version-specific symlinks
* The buildsystem has been adjusted to no longer use the libraries and
  headers from the cross-compiler, but use the ones provided by the
  above-mentioned packages. The only exception is that the 32-bit libraries
  required for the bootloader of the x86_64 architecture are still taken
  from the cross-compiler.
2014-08-13 13:50:29 +02:00
Oliver Tappe
37f558d5a3 Let runtime_loader ignore RT_RELRO program headers.
* The new libstdc++.so contains program headers of type PT_RELRO (for
  making segments read-only after relocation). While the actual feature
  has not been implemented, the runtime_loader should now silently
  accept (and ignore) those program headers.
2014-08-13 13:32:45 +02:00
John Scipione
0cf10e9dce Tracker: Style fixes to NavMenu.h
Pointer style, whitespace.

Convert TrackingHookData from a class to a struct (all members public)
2014-08-10 15:04:44 -04:00
Adrien Destugues
4ad7d95bac Revert "Add sys/ucontext.h"
This reverts commit 6ddf93bfbe.

As pointed out by Ingo, those were moved to sugnal.h in the latest issue
(issue 7) of the POSIX spec. Sorry!
2014-08-09 20:18:05 +02:00
Adrien Destugues
6ddf93bfbe Add sys/ucontext.h
* Move ucontext_t and mcontext_t there as that's where POSIX says they
should be.
2014-08-09 18:37:43 +02:00
Jérôme Duval
3aeed6607c include strings.h where appriopriate...
instead or additionally to string.h, in preparation for functions move.
* moves str[n]casecmp() functions and others to strings.h.
* strings.h doesn't include string.h anymore.
* this solves #10949
2014-08-08 22:40:37 +02:00
Arvind S Raj
82d287ddcb Reserve 8MB space for kernel before RAM_loader
...so that kernel does not overwrite the loader.

Signed-off-by: Adrien Destugues <pulkomandy@pulkomandy.tk>

Fixes #11067.
2014-08-08 17:39:33 +02:00
François Revol
295ded8c41 Fix gopher
fInputBuffer was shadowing the base class member...
2014-08-08 00:35:20 +02:00
Jérôme Duval
4dc5ce8fd8 mknod[at](): moves from unistd.h to sys/stat.h
* this solves #10883.
2014-08-04 19:03:08 +02:00
Adrien Destugues
89b4e98a8f Move signal hack to BNetworkRequest
* This is used to unlock sockets when a read is pending after a close
* It is not needed on requests that don't use a socket.
2014-08-04 16:25:48 +02:00
Adrien Destugues
2f9b187497 Factor out a BNetworkRequest
* Shares common behavior between the Gopher and HTTP request handlers.
* Most of this can be used when implemeting other protocols.
2014-08-04 15:59:53 +02:00
Jérôme Duval
92d556084c USB_massbulk.h: use a proper naming for a public header. 2014-08-03 18:39:35 +02:00
Jérôme Duval
d9ecf5f373 usb_disk: extract specs into a public header. 2014-08-03 18:10:51 +02:00
Colin Günther
22ea661b82 MediaKit: Extend media_[audio|video]_header structures.
- This allows a BMediaDecoder (e.g. FFMPEG Plugin) to communicate back format
  changes to its clients.
  For a more thorough explanation and discussion see haiku-development mailing
  list: http://www.freelists.org/post/haiku-development/Request-for-protest-Media-Kit-Extend-media-header-struct

- Backwards compatibility is taken into account and preserved by reducing the
  relevant _reserved[] fields.

- Code changes that will actually make use of these extensions are due for the
  following commits. As these structure extensions affect several Haiku
  components (e.g. media_server, MediaPlayer, etc.) and third party apps (e.g.
  StampTV, etc.) I refrain from committing them in one batch with this commit.
  This should make it easier to track down bugs originating in this code
  change.
(cherry picked from commit 806b6888d2dcf84b4934f8f137a48d3381864d1c)
2014-08-03 00:45:58 +02:00
Adrien Destugues
70f91e39aa Remove preprocessor checks from TestShell.h
* This is a header used by several parts of the code which should not
need to know about ELF symbol overriding and the fact that it is
optional.
* When the define is set, the methods will not be defined, but they
shouldn't be called, either
* This makes sure the memory layout of the class stays the same with the
define set or unset, and users can rely on it.

Fixes UnitTester on gcc2.
2014-07-29 23:05:52 +02:00
Adrien Destugues
a1cce97050 HttpRequest: more small fixes and cleanups
* Remove unneeded field fOutputHeaders and convert it to a local for the
only method that uses it,
* Don't return EOVERFLOW when flushing data from ZLib (the ZLib
decompressor returns this, but zlib docs states that this is NOT an
error condition).
* Replace unneeded temporary BNetBuffer of fixed size with BStackOrHeapArray.
2014-07-28 15:02:17 +02:00