diff --git a/src/kits/interface/ZombieReplicantView.cpp b/src/kits/interface/ZombieReplicantView.cpp index 82d262dbcc..b01285c4ca 100644 --- a/src/kits/interface/ZombieReplicantView.cpp +++ b/src/kits/interface/ZombieReplicantView.cpp @@ -1,28 +1,10 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2001-2004, Haiku -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the "Software"), -// to deal in the Software without restriction, including without limitation -// the rights to use, copy, modify, merge, publish, distribute, sublicense, -// and/or sell copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. -// -// File Name: ZombieReplicantView.cpp -// Author: Marc Flerackers (mflerackers@androme.be) -// Description: Class for Zombie replicants -//------------------------------------------------------------------------------ +/* + * Copyright 2001-2006, Haiku. + * Distributed under the terms of the MIT License. + * + * Authors: + * Marc Flerackers (mflerackers@androme.be) + */ #include #include @@ -33,14 +15,17 @@ #include #include #include +#include + const static rgb_color kZombieColor = {220, 220, 220, 255}; -_BZombieReplicantView_::_BZombieReplicantView_(BRect frame, status_t error) - : BBox(frame, "", B_FOLLOW_NONE, B_WILL_DRAW) -{ - fError = error; +_BZombieReplicantView_::_BZombieReplicantView_(BRect frame, status_t error) + : + BBox(frame, "", B_FOLLOW_NONE, B_WILL_DRAW), + fError(error) +{ BFont font(be_bold_font); font.SetSize(9.0f); // TODO SetFont(&font); @@ -59,20 +44,23 @@ _BZombieReplicantView_::MessageReceived(BMessage *msg) switch (msg->what) { case B_ABOUT_REQUESTED: { - const char *add_on = NULL; + const char *addOn = NULL; char description[B_MIME_TYPE_LENGTH]; - if (fArchive->FindString("add_on", &add_on) == B_OK) { - BMimeType type(add_on); + if (fArchive->FindString("add_on", &addOn) == B_OK) { + BMimeType type(addOn); type.GetShortDescription(description); } char error[1024]; - - sprintf(error, "Can't create the \"%s\" replicant because the library is in the Trash. (%s)", + snprintf(error, sizeof(error), + "Can't create the \"%s\" replicant because the library is in the Trash. (%s)", description, strerror(fError)); - - (new BAlert("Error", error, "OK", NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go(); + + BAlert *alert = new (nothrow) BAlert("Error", error, "OK", NULL, NULL, + B_WIDTH_AS_USUAL, B_STOP_ALERT); + if (alert != NULL) + alert->Go(); break; }