added error handling
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8743 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -220,13 +220,18 @@ Keymap::Dump()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
status_t
|
||||||
Keymap::LoadCurrent()
|
Keymap::LoadCurrent()
|
||||||
{
|
{
|
||||||
key_map *keys;
|
key_map *keys = NULL;
|
||||||
get_key_map(&keys, &fChars);
|
get_key_map(&keys, &fChars);
|
||||||
|
if (!keys) {
|
||||||
|
fprintf(stderr, "error while getting current keymap!\n");
|
||||||
|
return B_ERROR;
|
||||||
|
}
|
||||||
memcpy(&fKeys, keys, sizeof(fKeys));
|
memcpy(&fKeys, keys, sizeof(fKeys));
|
||||||
delete keys;
|
delete keys;
|
||||||
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
class Keymap
|
class Keymap
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void LoadCurrent();
|
status_t LoadCurrent();
|
||||||
status_t Load(entry_ref &ref);
|
status_t Load(entry_ref &ref);
|
||||||
status_t Save(entry_ref &ref);
|
status_t Save(entry_ref &ref);
|
||||||
status_t LoadSource(FILE *f);
|
status_t LoadSource(FILE *f);
|
||||||
|
|||||||
@@ -46,7 +46,8 @@ int main(int argc, char **argv)
|
|||||||
break;
|
break;
|
||||||
if (operation == 'd') {
|
if (operation == 'd') {
|
||||||
Keymap keymap;
|
Keymap keymap;
|
||||||
keymap.LoadCurrent();
|
if (keymap.LoadCurrent() != B_OK)
|
||||||
|
return 1;
|
||||||
keymap.Dump();
|
keymap.Dump();
|
||||||
return 0;
|
return 0;
|
||||||
} else if (operation == 'r') {
|
} else if (operation == 'r') {
|
||||||
|
|||||||
Reference in New Issue
Block a user