Style fix: compare to 0 in strcmp() explicitly.

This commit is contained in:
John Scipione 2012-12-04 19:29:29 -05:00
parent 2005db27ff
commit cfd9c96db5
4 changed files with 21 additions and 18 deletions

View File

@ -225,8 +225,8 @@ AppearancePrefView::AttachedToWindow()
_SetCurrentColorScheme(fColorSchemeField);
bool enableCustomColors =
!strcmp(fColorSchemeField->Menu()->FindMarked()->Label(),
gCustomColorScheme.name);
strcmp(fColorSchemeField->Menu()->FindMarked()->Label(),
gCustomColorScheme.name) == 0;
_EnableCustomColors(enableCustomColors);
}
@ -250,18 +250,18 @@ AppearancePrefView::MessageReceived(BMessage* msg)
= pref->getString(PREF_HALF_FONT_FAMILY);
const char* currentStyle
= pref->getString(PREF_HALF_FONT_STYLE);
if (currentFamily == NULL || strcmp(currentFamily, family)
|| currentStyle == NULL || strcmp(currentStyle, style)) {
if (currentFamily == NULL || strcmp(currentFamily, family) != 0
|| currentStyle == NULL || strcmp(currentStyle, style) != 0) {
pref->setString(PREF_HALF_FONT_FAMILY, family);
pref->setString(PREF_HALF_FONT_STYLE, style);
modified = true;
}
break;
}
case MSG_HALF_SIZE_CHANGED:
if (strcmp(PrefHandler::Default()->getString(PREF_HALF_FONT_SIZE),
fFontSize->Menu()->FindMarked()->Label())) {
fFontSize->Menu()->FindMarked()->Label()) != 0) {
PrefHandler::Default()->setString(PREF_HALF_FONT_SIZE,
fFontSize->Menu()->FindMarked()->Label());
modified = true;
@ -405,7 +405,7 @@ AppearancePrefView::_SetCurrentColorScheme(BMenuField* field)
for (int32 i = 0; i < fColorSchemeField->Menu()->CountItems(); i++) {
BMenuItem* item = fColorSchemeField->Menu()->ItemAt(i);
if (!strcmp(item->Label(), currentSchemeName)) {
if (strcmp(item->Label(), currentSchemeName) == 0) {
item->SetMarked(true);
break;
}
@ -440,8 +440,8 @@ AppearancePrefView::_MakeFontMenu(uint32 command,
BMenuItem* item = new BMenuItem(itemLabel,
message);
menu->AddItem(item);
if (!strcmp(defaultFamily, family)
&& !strcmp(defaultStyle, style))
if (strcmp(defaultFamily, family) == 0
&& strcmp(defaultStyle, style) == 0)
item->SetMarked(true);
}
}
@ -502,7 +502,7 @@ AppearancePrefView::_MakeMenu(uint32 msg, const char** items,
int32 i = 0;
while (*items) {
if (!strcmp((*items), ""))
if (strcmp((*items), "") == 0)
menu->AddSeparatorItem();
else {
BMessage* message = new BMessage(msg);
@ -529,7 +529,7 @@ AppearancePrefView::_MakeColorSchemeMenu(uint32 msg, const color_scheme** items,
int32 i = 0;
while (*items) {
if (!strcmp((*items)->name, ""))
if (strcmp((*items)->name, "") == 0)
menu->AddSeparatorItem();
else {
BMessage* message = new BMessage(msg);

View File

@ -242,7 +242,7 @@ PrefHandler::getBool(const char *key)
if (value == NULL)
return false;
return !strcmp(value, PREF_TRUE);
return strcmp(value, PREF_TRUE) == 0;
}
@ -352,7 +352,7 @@ PrefHandler::_ConfirmFont(const char *key, const BFont *fallback)
if (get_font_family(i, &family) != B_OK)
continue;
if (!strcmp(family, font)) {
if (strcmp(family, font) == 0) {
// found font family: we can safely use this font
return;
}

View File

@ -200,7 +200,7 @@ TermApp::RefsReceived(BMessage* message)
info.GetType(mimetype);
// if App opened by Pref file
if (!strcmp(mimetype, PREFFILE_MIMETYPE)) {
if (strcmp(mimetype, PREFFILE_MIMETYPE) == 0) {
BEntry ent(&ref);
BPath path(&ent);
@ -209,7 +209,7 @@ TermApp::RefsReceived(BMessage* message)
}
// if App opened by Shell Script
if (!strcmp(mimetype, "text/x-haiku-shscript")){
if (strcmp(mimetype, "text/x-haiku-shscript") == 0) {
// Not implemented.
// beep();
return;

View File

@ -1862,7 +1862,8 @@ TermView::MessageReceived(BMessage *msg)
int32 encodingID;
BMessage specifier;
if (msg->GetCurrentSpecifier(&i, &specifier) == B_OK
&& !strcmp("encoding", specifier.FindString("property", i))) {
&& !strcmp("encoding",
specifier.FindString("property", i)) == 0) {
msg->FindInt32 ("data", &encodingID);
SetEncoding(encodingID);
msg->SendReply(B_REPLY);
@ -1877,11 +1878,13 @@ TermView::MessageReceived(BMessage *msg)
int32 i;
BMessage specifier;
if (msg->GetCurrentSpecifier(&i, &specifier) == B_OK
&& !strcmp("encoding", specifier.FindString("property", i))) {
&& strcmp("encoding",
specifier.FindString("property", i)) == 0) {
BMessage reply(B_REPLY);
reply.AddInt32("result", Encoding());
msg->SendReply(&reply);
} else if (!strcmp("tty", specifier.FindString("property", i))) {
} else if (strcmp("tty",
specifier.FindString("property", i)) == 0) {
BMessage reply(B_REPLY);
reply.AddString("result", TerminalName());
msg->SendReply(&reply);