From 1fc4ba42c2506df02005e96813838992dcfcb7be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Sundstr=C3=B6m?= Date: Thu, 24 Feb 2011 08:33:35 +0000 Subject: [PATCH] CID 9835 UNINIT_CTOR - removing leftovers from 12/24 interval option CID 8960 STRING_OVERFLOW CID 6788, 6789 SECURE_CODING git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40657 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/deskbar/TimeView.cpp | 11 +++++------ src/apps/deskbar/TimeView.h | 1 - 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/apps/deskbar/TimeView.cpp b/src/apps/deskbar/TimeView.cpp index 16c4982c08..5a2c43e373 100644 --- a/src/apps/deskbar/TimeView.cpp +++ b/src/apps/deskbar/TimeView.cpp @@ -80,6 +80,8 @@ TTimeView::TTimeView(float maxWidth, float height, bool showSeconds, { fTime = fLastTime = time(NULL); fSeconds = fMinute = fHour = 0; + fTimeStr[0] = 0; + fDateStr[0] = 0; fLastTimeStr[0] = 0; fLastDateStr[0] = 0; fNeedToUpdate = true; @@ -94,7 +96,6 @@ TTimeView::TTimeView(BMessage* data) { fTime = fLastTime = time(NULL); data->FindBool("seconds", &fShowSeconds); - data->FindBool("interval", &fInterval); fLocale = *BLocale::Default(); } @@ -122,7 +123,6 @@ TTimeView::Archive(BMessage* data, bool deep) const { BView::Archive(data, deep); data->AddBool("seconds", fShowSeconds); - data->AddBool("interval", fInterval); data->AddInt32("deskbar:private_align", B_ALIGN_RIGHT); return B_OK; @@ -268,7 +268,7 @@ TTimeView::GetCurrentDate() if (str[0] == '0') str++; - strcpy(fDateStr, str); + strlcpy(fDateStr, str, sizeof(fDateStr)); } @@ -329,8 +329,8 @@ TTimeView::Pulse() || !fLastTimeStr[0]) Update(); - strcpy(fLastTimeStr, fTimeStr); - strcpy(fLastDateStr, fDateStr); + strlcpy(fLastTimeStr, fTimeStr, sizeof(fLastTimeStr)); + strlcpy(fLastDateStr, fDateStr, sizeof(fLastDateStr)); fNeedToUpdate = true; } @@ -338,7 +338,6 @@ TTimeView::Pulse() fSeconds = ct->tm_sec; fMinute = ct->tm_min; fHour = ct->tm_hour; - fInterval = ct->tm_hour >= 12; Draw(Bounds()); fNeedToUpdate = false; diff --git a/src/apps/deskbar/TimeView.h b/src/apps/deskbar/TimeView.h index 6034fb0fbd..64c658dbd7 100644 --- a/src/apps/deskbar/TimeView.h +++ b/src/apps/deskbar/TimeView.h @@ -103,7 +103,6 @@ class TTimeView : public BView { int fSeconds; int fMinute; int fHour; - bool fInterval; bool fShowInterval; bool fShowSeconds;