Style fix: compare to 0 in strcmp() explicitly.
This commit is contained in:
@@ -225,8 +225,8 @@ AppearancePrefView::AttachedToWindow()
|
|||||||
|
|
||||||
_SetCurrentColorScheme(fColorSchemeField);
|
_SetCurrentColorScheme(fColorSchemeField);
|
||||||
bool enableCustomColors =
|
bool enableCustomColors =
|
||||||
!strcmp(fColorSchemeField->Menu()->FindMarked()->Label(),
|
strcmp(fColorSchemeField->Menu()->FindMarked()->Label(),
|
||||||
gCustomColorScheme.name);
|
gCustomColorScheme.name) == 0;
|
||||||
|
|
||||||
_EnableCustomColors(enableCustomColors);
|
_EnableCustomColors(enableCustomColors);
|
||||||
}
|
}
|
||||||
@@ -250,18 +250,18 @@ AppearancePrefView::MessageReceived(BMessage* msg)
|
|||||||
= pref->getString(PREF_HALF_FONT_FAMILY);
|
= pref->getString(PREF_HALF_FONT_FAMILY);
|
||||||
const char* currentStyle
|
const char* currentStyle
|
||||||
= pref->getString(PREF_HALF_FONT_STYLE);
|
= pref->getString(PREF_HALF_FONT_STYLE);
|
||||||
if (currentFamily == NULL || strcmp(currentFamily, family)
|
if (currentFamily == NULL || strcmp(currentFamily, family) != 0
|
||||||
|| currentStyle == NULL || strcmp(currentStyle, style)) {
|
|| currentStyle == NULL || strcmp(currentStyle, style) != 0) {
|
||||||
pref->setString(PREF_HALF_FONT_FAMILY, family);
|
pref->setString(PREF_HALF_FONT_FAMILY, family);
|
||||||
pref->setString(PREF_HALF_FONT_STYLE, style);
|
pref->setString(PREF_HALF_FONT_STYLE, style);
|
||||||
modified = true;
|
modified = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case MSG_HALF_SIZE_CHANGED:
|
case MSG_HALF_SIZE_CHANGED:
|
||||||
if (strcmp(PrefHandler::Default()->getString(PREF_HALF_FONT_SIZE),
|
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,
|
PrefHandler::Default()->setString(PREF_HALF_FONT_SIZE,
|
||||||
fFontSize->Menu()->FindMarked()->Label());
|
fFontSize->Menu()->FindMarked()->Label());
|
||||||
modified = true;
|
modified = true;
|
||||||
@@ -405,7 +405,7 @@ AppearancePrefView::_SetCurrentColorScheme(BMenuField* field)
|
|||||||
|
|
||||||
for (int32 i = 0; i < fColorSchemeField->Menu()->CountItems(); i++) {
|
for (int32 i = 0; i < fColorSchemeField->Menu()->CountItems(); i++) {
|
||||||
BMenuItem* item = fColorSchemeField->Menu()->ItemAt(i);
|
BMenuItem* item = fColorSchemeField->Menu()->ItemAt(i);
|
||||||
if (!strcmp(item->Label(), currentSchemeName)) {
|
if (strcmp(item->Label(), currentSchemeName) == 0) {
|
||||||
item->SetMarked(true);
|
item->SetMarked(true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -440,8 +440,8 @@ AppearancePrefView::_MakeFontMenu(uint32 command,
|
|||||||
BMenuItem* item = new BMenuItem(itemLabel,
|
BMenuItem* item = new BMenuItem(itemLabel,
|
||||||
message);
|
message);
|
||||||
menu->AddItem(item);
|
menu->AddItem(item);
|
||||||
if (!strcmp(defaultFamily, family)
|
if (strcmp(defaultFamily, family) == 0
|
||||||
&& !strcmp(defaultStyle, style))
|
&& strcmp(defaultStyle, style) == 0)
|
||||||
item->SetMarked(true);
|
item->SetMarked(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -502,7 +502,7 @@ AppearancePrefView::_MakeMenu(uint32 msg, const char** items,
|
|||||||
|
|
||||||
int32 i = 0;
|
int32 i = 0;
|
||||||
while (*items) {
|
while (*items) {
|
||||||
if (!strcmp((*items), ""))
|
if (strcmp((*items), "") == 0)
|
||||||
menu->AddSeparatorItem();
|
menu->AddSeparatorItem();
|
||||||
else {
|
else {
|
||||||
BMessage* message = new BMessage(msg);
|
BMessage* message = new BMessage(msg);
|
||||||
@@ -529,7 +529,7 @@ AppearancePrefView::_MakeColorSchemeMenu(uint32 msg, const color_scheme** items,
|
|||||||
|
|
||||||
int32 i = 0;
|
int32 i = 0;
|
||||||
while (*items) {
|
while (*items) {
|
||||||
if (!strcmp((*items)->name, ""))
|
if (strcmp((*items)->name, "") == 0)
|
||||||
menu->AddSeparatorItem();
|
menu->AddSeparatorItem();
|
||||||
else {
|
else {
|
||||||
BMessage* message = new BMessage(msg);
|
BMessage* message = new BMessage(msg);
|
||||||
|
|||||||
@@ -242,7 +242,7 @@ PrefHandler::getBool(const char *key)
|
|||||||
if (value == NULL)
|
if (value == NULL)
|
||||||
return false;
|
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)
|
if (get_font_family(i, &family) != B_OK)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!strcmp(family, font)) {
|
if (strcmp(family, font) == 0) {
|
||||||
// found font family: we can safely use this font
|
// found font family: we can safely use this font
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -200,7 +200,7 @@ TermApp::RefsReceived(BMessage* message)
|
|||||||
info.GetType(mimetype);
|
info.GetType(mimetype);
|
||||||
|
|
||||||
// if App opened by Pref file
|
// if App opened by Pref file
|
||||||
if (!strcmp(mimetype, PREFFILE_MIMETYPE)) {
|
if (strcmp(mimetype, PREFFILE_MIMETYPE) == 0) {
|
||||||
|
|
||||||
BEntry ent(&ref);
|
BEntry ent(&ref);
|
||||||
BPath path(&ent);
|
BPath path(&ent);
|
||||||
@@ -209,7 +209,7 @@ TermApp::RefsReceived(BMessage* message)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if App opened by Shell Script
|
// if App opened by Shell Script
|
||||||
if (!strcmp(mimetype, "text/x-haiku-shscript")){
|
if (strcmp(mimetype, "text/x-haiku-shscript") == 0) {
|
||||||
// Not implemented.
|
// Not implemented.
|
||||||
// beep();
|
// beep();
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1862,7 +1862,8 @@ TermView::MessageReceived(BMessage *msg)
|
|||||||
int32 encodingID;
|
int32 encodingID;
|
||||||
BMessage specifier;
|
BMessage specifier;
|
||||||
if (msg->GetCurrentSpecifier(&i, &specifier) == B_OK
|
if (msg->GetCurrentSpecifier(&i, &specifier) == B_OK
|
||||||
&& !strcmp("encoding", specifier.FindString("property", i))) {
|
&& !strcmp("encoding",
|
||||||
|
specifier.FindString("property", i)) == 0) {
|
||||||
msg->FindInt32 ("data", &encodingID);
|
msg->FindInt32 ("data", &encodingID);
|
||||||
SetEncoding(encodingID);
|
SetEncoding(encodingID);
|
||||||
msg->SendReply(B_REPLY);
|
msg->SendReply(B_REPLY);
|
||||||
@@ -1877,11 +1878,13 @@ TermView::MessageReceived(BMessage *msg)
|
|||||||
int32 i;
|
int32 i;
|
||||||
BMessage specifier;
|
BMessage specifier;
|
||||||
if (msg->GetCurrentSpecifier(&i, &specifier) == B_OK
|
if (msg->GetCurrentSpecifier(&i, &specifier) == B_OK
|
||||||
&& !strcmp("encoding", specifier.FindString("property", i))) {
|
&& strcmp("encoding",
|
||||||
|
specifier.FindString("property", i)) == 0) {
|
||||||
BMessage reply(B_REPLY);
|
BMessage reply(B_REPLY);
|
||||||
reply.AddInt32("result", Encoding());
|
reply.AddInt32("result", Encoding());
|
||||||
msg->SendReply(&reply);
|
msg->SendReply(&reply);
|
||||||
} else if (!strcmp("tty", specifier.FindString("property", i))) {
|
} else if (strcmp("tty",
|
||||||
|
specifier.FindString("property", i)) == 0) {
|
||||||
BMessage reply(B_REPLY);
|
BMessage reply(B_REPLY);
|
||||||
reply.AddString("result", TerminalName());
|
reply.AddString("result", TerminalName());
|
||||||
msg->SendReply(&reply);
|
msg->SendReply(&reply);
|
||||||
|
|||||||
Reference in New Issue
Block a user