DeskCalc:
* Replace usage of strcpy by strlcpy (CID 6790) * Check the return value of FindApp before continuing (CID 2366) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40634 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
08a750214c
commit
14afc67b4c
@ -957,13 +957,13 @@ CalcView::_ParseCalcDesc(const char* keypadDescription)
|
|||||||
|
|
||||||
// set code
|
// set code
|
||||||
if (strcmp(key->label, "=") == 0)
|
if (strcmp(key->label, "=") == 0)
|
||||||
strcpy(key->code, "\n");
|
strlcpy(key->code, "\n", sizeof(key->code));
|
||||||
else
|
else
|
||||||
strcpy(key->code, key->label);
|
strlcpy(key->code, key->label, sizeof(key->code));
|
||||||
|
|
||||||
// set keymap
|
// set keymap
|
||||||
if (strlen(key->label) == 1)
|
if (strlen(key->label) == 1)
|
||||||
strcpy(key->keymap, key->label);
|
strlcpy(key->keymap, key->label, sizeof(key->keymap));
|
||||||
else
|
else
|
||||||
*key->keymap = '\0';
|
*key->keymap = '\0';
|
||||||
|
|
||||||
@ -1181,9 +1181,12 @@ void
|
|||||||
CalcView::_FetchAppIcon(BBitmap* into)
|
CalcView::_FetchAppIcon(BBitmap* into)
|
||||||
{
|
{
|
||||||
entry_ref appRef;
|
entry_ref appRef;
|
||||||
be_roster->FindApp(kAppSig, &appRef);
|
status_t status = be_roster->FindApp(kAppSig, &appRef);
|
||||||
BFile file(&appRef, B_READ_ONLY);
|
if (status == B_OK) {
|
||||||
BAppFileInfo appInfo(&file);
|
BFile file(&appRef, B_READ_ONLY);
|
||||||
if (appInfo.GetIcon(into, B_MINI_ICON) != B_OK)
|
BAppFileInfo appInfo(&file);
|
||||||
|
status = appInfo.GetIcon(into, B_MINI_ICON);
|
||||||
|
}
|
||||||
|
if (status != B_OK)
|
||||||
memset(into->Bits(), 0, into->BitsLength());
|
memset(into->Bits(), 0, into->BitsLength());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user