libbnetapi: style fixes only.

This commit is contained in:
Jérôme Duval 2017-10-26 19:30:33 +02:00
parent a6c6dd77f3
commit e1ca67697e
6 changed files with 26 additions and 38 deletions

View File

@ -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);

View File

@ -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());
}

View File

@ -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);
}

View File

@ -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 '.'

View File

@ -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) {

View File

@ -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));
}