From 4239ee5d669aef3b3713560d1f9b797f74140eee Mon Sep 17 00:00:00 2001 From: Ryan Leavengood Date: Fri, 12 Sep 2008 06:21:34 +0000 Subject: [PATCH] Fixed CID 1290 and 1291: the temp BString is initialized with a new BString and then immediately replaced. A later null check ensures it is OK to initialize it to NULL. Also fixed a GCC warning about comparison between signed and unsigned. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27434 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/device/Joystick.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/kits/device/Joystick.cpp b/src/kits/device/Joystick.cpp index 5712c11601..372184c9e8 100644 --- a/src/kits/device/Joystick.cpp +++ b/src/kits/device/Joystick.cpp @@ -165,14 +165,14 @@ status_t BJoystick::GetDeviceName(int32 n, char *name, size_t bufSize) { CALLED(); - BString *temp = new BString(); + BString *temp = NULL; if (fDevices != NULL && fDevices->CountItems() > n) temp = static_cast(fDevices->ItemAt(n)); else return B_BAD_INDEX; if (temp != NULL && name != NULL) { - if(temp->Length() > bufSize) + if(temp->Length() > (int32)bufSize) return B_NAME_TOO_LONG; strncpy(name, temp->String(), bufSize); name[bufSize - 1] = '\0';