From e1ca67697e7e6701ff621c3639e3d0111b7cf1ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Thu, 26 Oct 2017 19:30:33 +0200 Subject: [PATCH] libbnetapi: style fixes only. --- src/kits/network/libnetapi/DataRequest.cpp | 3 +-- src/kits/network/libnetapi/HttpHeaders.cpp | 6 ++--- src/kits/network/libnetapi/HttpResult.cpp | 2 -- src/kits/network/libnetapi/NetworkCookie.cpp | 6 ++--- .../network/libnetapi/NetworkCookieJar.cpp | 20 +++++++------- src/kits/network/libnetapi/SecureSocket.cpp | 27 +++++++++---------- 6 files changed, 26 insertions(+), 38 deletions(-) diff --git a/src/kits/network/libnetapi/DataRequest.cpp b/src/kits/network/libnetapi/DataRequest.cpp index 627f7b957b..2870b9f725 100644 --- a/src/kits/network/libnetapi/DataRequest.cpp +++ b/src/kits/network/libnetapi/DataRequest.cpp @@ -60,8 +60,7 @@ BDataRequest::_ProtocolLoop() data.Remove(0, separatorPosition + 1); int pos = 0; - while (meta.Length() > 0) - { + while (meta.Length() > 0) { // Extract next parameter pos = meta.FindFirst(';', pos); diff --git a/src/kits/network/libnetapi/HttpHeaders.cpp b/src/kits/network/libnetapi/HttpHeaders.cpp index fa17809992..9f87efccba 100644 --- a/src/kits/network/libnetapi/HttpHeaders.cpp +++ b/src/kits/network/libnetapi/HttpHeaders.cpp @@ -255,7 +255,7 @@ BHttpHeaders::PopulateFromArchive(BMessage* archive) int32 index = 0; char* nameFound; - for(;;) { + for (;;) { if (archive->GetInfo(B_STRING_TYPE, index, &nameFound, NULL) != B_OK) return; @@ -271,10 +271,8 @@ void BHttpHeaders::Archive(BMessage* message) const { int32 count = CountHeaders(); - int32 i; - for (i = 0; i < count; i++) - { + for (int32 i = 0; i < count; i++) { BHttpHeader& header = HeaderAt(i); message->AddString(header.Name(), header.Value()); } diff --git a/src/kits/network/libnetapi/HttpResult.cpp b/src/kits/network/libnetapi/HttpResult.cpp index 04ee6e1c35..6af7fb730b 100644 --- a/src/kits/network/libnetapi/HttpResult.cpp +++ b/src/kits/network/libnetapi/HttpResult.cpp @@ -162,9 +162,7 @@ BHttpResult::Archive(BMessage* target, bool deep) const BHttpResult::Instantiate(BMessage* archive) { if (!validate_instantiation(archive, "BHttpResult")) - { return NULL; - } return new BHttpResult(archive); } diff --git a/src/kits/network/libnetapi/NetworkCookie.cpp b/src/kits/network/libnetapi/NetworkCookie.cpp index 23dc702ecd..41e341d184 100644 --- a/src/kits/network/libnetapi/NetworkCookie.cpp +++ b/src/kits/network/libnetapi/NetworkCookie.cpp @@ -42,8 +42,7 @@ BNetworkCookie::BNetworkCookie(const char* name, const char* value, SetDomain(url.Host()); - if (url.Protocol() == "file" && url.Host().Length() == 0) - { + if (url.Protocol() == "file" && url.Host().Length() == 0) { SetDomain("localhost"); // make sure cookies set from a file:// URL are stored somewhere. } @@ -110,8 +109,7 @@ BNetworkCookie::ParseCookieString(const BString& string, const BUrl& url) SetPath(_DefaultPathForUrl(url)); SetDomain(url.Host()); fHostOnly = true; - if (url.Protocol() == "file" && url.Host().Length() == 0) - { + if (url.Protocol() == "file" && url.Host().Length() == 0) { fDomain = "localhost"; // make sure cookies set from a file:// URL are stored somewhere. // not going through SetDomain as it requires at least one '.' diff --git a/src/kits/network/libnetapi/NetworkCookieJar.cpp b/src/kits/network/libnetapi/NetworkCookieJar.cpp index 5da474487e..f21977781f 100644 --- a/src/kits/network/libnetapi/NetworkCookieJar.cpp +++ b/src/kits/network/libnetapi/NetworkCookieJar.cpp @@ -77,14 +77,13 @@ BNetworkCookieJar::BNetworkCookieJar(BMessage* archive) BNetworkCookieJar::~BNetworkCookieJar() { - for (Iterator it = GetIterator(); it.Next() != NULL;) { + for (Iterator it = GetIterator(); it.Next() != NULL;) delete it.Remove(); - } fCookieHashMap->Lock(); PrivateHashMap::Iterator it = fCookieHashMap->GetIterator(); - while(it.HasNext()) { + while (it.HasNext()) { BNetworkCookieList* list = *it.NextValue(); it.Remove(); list->LockForWriting(); @@ -603,7 +602,8 @@ BNetworkCookieJar::Iterator::NextDomain() fList = *fIterator->fCookieMapIterator.NextValue(); fList->LockForReading(); - while (fList->CountItems() == 0 && fIterator->fCookieMapIterator.HasNext()) { + while (fList->CountItems() == 0 + && fIterator->fCookieMapIterator.HasNext()) { // Empty list. Skip it fList->Unlock(); fList = *fIterator->fCookieMapIterator.NextValue(); @@ -632,8 +632,7 @@ BNetworkCookieJar::Iterator::Remove() // We are on the first item of fList, so we need to remove the // last of fLastList fLastList->Unlock(); - if (fLastList->LockForWriting() == B_OK) - { + if (fLastList->LockForWriting() == B_OK) { fLastList->RemoveItemAt(fLastList->CountItems() - 1); // TODO if the list became empty, we could remove it from the // map, but this can be a problem if other iterators are still @@ -650,8 +649,7 @@ BNetworkCookieJar::Iterator::Remove() if (fCookieJar->fCookieHashMap->Lock()) { // Switch to a write lock fList->Unlock(); - if (fList->LockForWriting() == B_OK) - { + if (fList->LockForWriting() == B_OK) { fList->RemoveItemAt(fIndex); fList->Unlock(); } @@ -693,7 +691,8 @@ BNetworkCookieJar::Iterator::_FindNext() fList = *(fIterator->fCookieMapIterator.NextValue()); fList->LockForReading(); - while (fList->CountItems() == 0 && fIterator->fCookieMapIterator.HasNext()) { + while (fList->CountItems() == 0 + && fIterator->fCookieMapIterator.HasNext()) { // Empty list. Skip it fList->Unlock(); fList = *fIterator->fCookieMapIterator.NextValue(); @@ -784,8 +783,7 @@ BNetworkCookieJar::UrlIterator::Remove() if (fCookieJar->fCookieHashMap->Lock()) { fLastList->Unlock(); - if (fLastList->LockForWriting() == B_OK) - { + if (fLastList->LockForWriting() == B_OK) { fLastList->RemoveItemAt(fLastIndex); if (fLastList->CountItems() == 0) { diff --git a/src/kits/network/libnetapi/SecureSocket.cpp b/src/kits/network/libnetapi/SecureSocket.cpp index 261fe592a3..ae8d6fd454 100644 --- a/src/kits/network/libnetapi/SecureSocket.cpp +++ b/src/kits/network/libnetapi/SecureSocket.cpp @@ -281,29 +281,26 @@ static void apps_ssl_info_callback(const SSL *s, int where, int ret) w=where& ~SSL_ST_MASK; - if (w & SSL_ST_CONNECT) str="SSL_connect"; - else if (w & SSL_ST_ACCEPT) str="SSL_accept"; - else str="undefined"; + if (w & SSL_ST_CONNECT) + str="SSL_connect"; + else if (w & SSL_ST_ACCEPT) + str="SSL_accept"; + else + str="undefined"; - if (where & SSL_CB_LOOP) - { - fprintf(stderr,"%s:%s\n",str,SSL_state_string_long(s)); - } - else if (where & SSL_CB_ALERT) - { - str=(where & SSL_CB_READ)?"read":"write"; + if (where & SSL_CB_LOOP) { + fprintf(stderr,"%s:%s\n", str, SSL_state_string_long(s)); + } else if (where & SSL_CB_ALERT) { + str = (where & SSL_CB_READ) ? "read" : "write"; fprintf(stderr,"SSL3 alert %s:%s:%s\n", str, SSL_alert_type_string_long(ret), SSL_alert_desc_string_long(ret)); - } - else if (where & SSL_CB_EXIT) - { + } else if (where & SSL_CB_EXIT) { if (ret == 0) fprintf(stderr,"%s:failed in %s\n", str,SSL_state_string_long(s)); - else if (ret < 0) - { + else if (ret < 0) { fprintf(stderr,"%s:error in %s\n", str,SSL_state_string_long(s)); }