vfs: check userland buffers before reading them.
[haiku.git] / src / apps / mediaplayer / support / AbstractLOAdapter.cpp
blobfca20b7354ed649093c456ac88b926c169eab495
1 /*
2 * Copyright 2006, Haiku.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Ingo Weinhold <bonefish@cs.tu-berlin.de>
7 */
9 #include "AbstractLOAdapter.h"
11 #include <Handler.h>
12 #include <Looper.h>
13 #include <Messenger.h>
15 // constructor
16 AbstractLOAdapter::AbstractLOAdapter(BHandler* handler)
17 : fHandler(handler),
18 fMessenger(NULL)
22 // constructor
23 AbstractLOAdapter::AbstractLOAdapter(const BMessenger& messenger)
24 : fHandler(NULL),
25 fMessenger(new BMessenger(messenger))
29 // destructor
30 AbstractLOAdapter::~AbstractLOAdapter()
32 delete fMessenger;
35 // DeliverMessage
36 void
37 AbstractLOAdapter::DeliverMessage(BMessage* message)
39 if (fHandler) {
40 if (BLooper* looper = fHandler->Looper())
41 looper->PostMessage(message, fHandler);
42 } else if (fMessenger)
43 fMessenger->SendMessage(message);
46 // DeliverMessage
47 void
48 AbstractLOAdapter::DeliverMessage(BMessage& message)
50 DeliverMessage(&message);
53 // DeliverMessage
54 void
55 AbstractLOAdapter::DeliverMessage(uint32 command)
57 BMessage message(command);
58 DeliverMessage(&message);