haikudepot: Fix style issues in hrev49418

This commit is contained in:
Alexander von Gluck IV
2015-07-19 09:56:54 -05:00
parent d52bb3081c
commit e34f263837
2 changed files with 14 additions and 14 deletions
@@ -324,14 +324,14 @@ static bool
arguments_is_url_valid(const BString& value) arguments_is_url_valid(const BString& value)
{ {
if (value.Length() < 8) { if (value.Length() < 8) {
fprintf(stderr,"the url is less than 8 characters in length\n"); fprintf(stderr, "the url is less than 8 characters in length\n");
return false; return false;
} }
int32 schemeEnd = value.FindFirst("://"); int32 schemeEnd = value.FindFirst("://");
if (schemeEnd == B_ERROR) { if (schemeEnd < B_OK) {
fprintf(stderr,"the url does not contain the '://' string\n"); fprintf(stderr, "the url does not contain the '://' string\n");
return false; return false;
} }
@@ -339,12 +339,12 @@ arguments_is_url_valid(const BString& value)
value.CopyInto(scheme, 0, schemeEnd); value.CopyInto(scheme, 0, schemeEnd);
if (scheme != "http" && scheme != "https") { if (scheme != "http" && scheme != "https") {
fprintf(stderr,"the url scheme should be 'http' or 'https'\n"); fprintf(stderr, "the url scheme should be 'http' or 'https'\n");
return false; return false;
} }
if (value.Length()-1 == value.FindLast("/")) { if (value.Length() - 1 == value.FindLast("/")) {
fprintf(stderr,"the url should be be terminated with a '/'\n"); fprintf(stderr, "the url should be be terminated with a '/'\n");
return false; return false;
} }
@@ -356,9 +356,9 @@ arguments_is_url_valid(const BString& value)
indicate if the URL was acceptable. indicate if the URL was acceptable.
\return B_OK if the base URL was valid and B_BAD_VALUE if not. \return B_OK if the base URL was valid and B_BAD_VALUE if not.
*/ */
status_t status_t
WebAppInterface::SetBaseUrl(const BString& url) { WebAppInterface::SetBaseUrl(const BString& url)
{
if (!arguments_is_url_valid(url)) if (!arguments_is_url_valid(url))
return B_BAD_VALUE; return B_BAD_VALUE;
@@ -691,7 +691,7 @@ BString
WebAppInterface::_FormFullUrl(const BString& suffix) const WebAppInterface::_FormFullUrl(const BString& suffix) const
{ {
if (fBaseUrl.IsEmpty()) { if (fBaseUrl.IsEmpty()) {
fprintf(stderr,"illegal state - missing web app base url\n"); fprintf(stderr, "illegal state - missing web app base url\n");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
+5 -5
View File
@@ -121,22 +121,22 @@ App::ArgvReceived(int32 argc, char* argv[])
for (int i = 1; i < argc;) { for (int i = 1; i < argc;) {
if (0 == strcmp("--webappbaseurl", argv[i])) { if (0 == strcmp("--webappbaseurl", argv[i])) {
if (i == argc-1) { if (i == argc-1) {
fprintf(stderr,"unexpected end of arguments; missing web app base url\n"); fprintf(stderr, "unexpected end of arguments; missing web app base url\n");
Quit(); Quit();
} }
if (B_OK != WebAppInterface::SetBaseUrl(argv[i+1])) { if (WebAppInterface::SetBaseUrl(argv[i + 1]) != B_OK) {
fprintf(stderr,"malformed web app base url; %s\n", argv[i+1]); fprintf(stderr, "malformed web app base url; %s\n", argv[i + 1]);
Quit(); Quit();
} }
else else
fprintf(stderr,"did configure the web base url; %s\n",argv[i+1]); fprintf(stderr, "did configure the web base url; %s\n",argv[i + 1]);
i += 2; i += 2;
} else { } else {
BEntry entry(argv[i], true); BEntry entry(argv[i], true);
_Open(entry); _Open(entry);
i ++; i++;
} }
} }
} }