vfs: check userland buffers before reading them.
[haiku.git] / src / apps / expander / ExpanderApp.cpp
blob700b5d28b02075d2be1731a18001f350389dbd71
1 /*
2 * Copyright 2004-2006, Jérôme Duval. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 */
7 #include "ExpanderApp.h"
9 #include "ExpanderWindow.h"
12 ExpanderApp::ExpanderApp()
14 BApplication("application/x-vnd.Haiku-Expander")
16 BPoint windowPosition = fSettings.Message().FindPoint("window_position");
17 BRect windowFrame(0, 0, 450, 120);
18 windowFrame.OffsetBy(windowPosition);
19 BMessage settings(fSettings.Message());
20 fWindow = new ExpanderWindow(windowFrame, NULL, &settings);
24 void
25 ExpanderApp::ArgvReceived(int32 argc, char** argv)
27 BMessage* message = NULL;
28 for (int32 i = 1; i < argc; i++) {
29 entry_ref ref;
30 status_t err = get_ref_for_path(argv[i], &ref);
31 if (err == B_OK) {
32 if (message == NULL) {
33 message = new BMessage;
34 message->what = B_REFS_RECEIVED;
36 message->AddRef("refs", &ref);
40 if (message != NULL)
41 RefsReceived(message);
45 void
46 ExpanderApp::RefsReceived(BMessage* message)
48 BMessenger messenger(fWindow);
49 message->AddBool("fromApp", true);
50 messenger.SendMessage(message);
54 void
55 ExpanderApp::UpdateSettingsFrom(BMessage* message)
57 fSettings.UpdateFrom(message);
61 // #pragma mark - main method
64 int
65 main(int argc, char** argv)
67 ExpanderApp theApp;
68 theApp.Run();
70 return 0;