style fixes
This commit is contained in:
@@ -168,8 +168,7 @@ get_synaptics_movment(synaptics_cookie *cookie, mouse_movement *movement)
|
||||
if (sTouchpadInfo.capMiddleButton || sTouchpadInfo.capFourButtons)
|
||||
event.buttons |= ((event_buffer[0] ^ event_buffer[3]) & 0x01) << 2;
|
||||
|
||||
if (sTouchpadInfo.nExtendedButtons > 0)
|
||||
{
|
||||
if (sTouchpadInfo.nExtendedButtons > 0) {
|
||||
if (((event_buffer[0] ^ event_buffer[3]) & 0x02) != 0) {
|
||||
// This packet includes extended buttons state. The state is
|
||||
// only reported once when one of the buttons is pressed or
|
||||
|
||||
@@ -306,7 +306,7 @@ BTree::Node::MoveEntries(uint32 start, uint32 end, int length) const
|
||||
if (Level() == 0) {
|
||||
// moving item data
|
||||
int num = start - end;
|
||||
for(uint32 i = start; i < ItemCount() + num; ++i)
|
||||
for (uint32 i = start; i < ItemCount() + num; ++i)
|
||||
Item(i)->SetOffset(Item(i)->Offset() - length);
|
||||
|
||||
memmove(ItemData(ItemCount() - 1) - length, ItemData(ItemCount() - 1),
|
||||
@@ -855,7 +855,7 @@ BTree::PreviousLeaf(Path* path) const
|
||||
return B_NO_MEMORY;
|
||||
slot = node->ItemCount() - 1;
|
||||
level--;
|
||||
} while(level != 0);
|
||||
} while (level != 0);
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
@@ -894,7 +894,7 @@ BTree::NextLeaf(Path* path) const
|
||||
return B_NO_MEMORY;
|
||||
slot = 0;
|
||||
level--;
|
||||
} while(level != 0);
|
||||
} while (level != 0);
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@@ -411,7 +411,7 @@ BlockGroup::Initialize(uint64 flag)
|
||||
fKey.SetOffset(0);
|
||||
status_t status;
|
||||
|
||||
while(true) {
|
||||
while (true) {
|
||||
status = fCurrentExtentTree->FindNext(&path, fKey, (void**)&fItem);
|
||||
if ((Flags() & flag) == flag || status != B_OK)
|
||||
break;
|
||||
@@ -451,7 +451,7 @@ BlockGroup::LoadExtent(CachedExtentTree* tree, bool inverse)
|
||||
|
||||
TreeIterator iterator(fCurrentExtentTree, key);
|
||||
status_t status;
|
||||
while(true) {
|
||||
while (true) {
|
||||
status = iterator.GetNextEntry(&data);
|
||||
key = iterator.Key();
|
||||
if (status != B_OK) {
|
||||
@@ -614,7 +614,7 @@ ExtentAllocator::_Allocate(uint64& found, uint64 start, uint64 size,
|
||||
B_PRIu64 "\n", start, size, type);
|
||||
CachedExtent* chosen;
|
||||
status_t status;
|
||||
while(true) {
|
||||
while (true) {
|
||||
status = fTree->FindNext(&chosen, start, size, type);
|
||||
if (status != B_OK)
|
||||
return status;
|
||||
|
||||
@@ -234,7 +234,7 @@ Journal::Lock(Transaction* owner, bool separateSubTransactions)
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
if(separateSubTransactions)
|
||||
if (separateSubTransactions)
|
||||
fSeparateSubTransactions = true;
|
||||
|
||||
if (owner != NULL)
|
||||
@@ -478,7 +478,7 @@ Journal::_WriteTransactionToLog()
|
||||
TRACE("Journal::_WriteTransactionToLog(): main transaction size: %"
|
||||
B_PRIuSIZE "\n", size);
|
||||
|
||||
if(fHasSubTransaction && size < fMaxTransactionSize) {
|
||||
if (fHasSubTransaction && size < fMaxTransactionSize) {
|
||||
TRACE("Journal::_WriteTransactionToLog(): transaction doesn't fit, "
|
||||
"but it can be separated\n");
|
||||
detached = true;
|
||||
|
||||
@@ -765,7 +765,7 @@ Volume::RemoveOrphan(Transaction& transaction, ino_t id)
|
||||
currentID = inode->NextOrphan();
|
||||
if (currentID == 0)
|
||||
return B_OK;
|
||||
} while(currentID != id);
|
||||
} while (currentID != id);
|
||||
|
||||
CachedBlock cachedRemoved(this);
|
||||
|
||||
|
||||
@@ -644,7 +644,7 @@ ext2_write_stat(fs_volume* _volume, fs_vnode* _node, const struct stat* stat,
|
||||
off_t oldSize = inode->Size();
|
||||
|
||||
status_t status = inode->Resize(transaction, stat->st_size);
|
||||
if(status != B_OK)
|
||||
if (status != B_OK)
|
||||
return status;
|
||||
|
||||
if ((mask & B_STAT_SIZE_INSECURE) == 0) {
|
||||
|
||||
@@ -255,8 +255,7 @@ walk_volume_descriptor_sequence(extent_address descriptorSequence,
|
||||
uint8 uniquePartitions = 0;
|
||||
status_t error = B_OK;
|
||||
|
||||
for (uint32 i = 0; i < count; i++)
|
||||
{
|
||||
for (uint32 i = 0; i < count; i++) {
|
||||
off_t block = descriptorSequence.location()+i;
|
||||
off_t address = block << blockShift;
|
||||
MemoryChunk chunk(blockSize);
|
||||
@@ -304,8 +303,7 @@ walk_volume_descriptor_sequence(extent_address descriptorSequence,
|
||||
// Check for a matching implementation id string (note that the
|
||||
// revision version is not checked)
|
||||
if (impUse->tag().init_check(block) == B_OK
|
||||
&& impUse->implementation_id().matches(kLogicalVolumeInfoId201))
|
||||
{
|
||||
&& impUse->implementation_id().matches(kLogicalVolumeInfoId201)) {
|
||||
foundUdfImplementationUseDescriptor = true;
|
||||
}
|
||||
break;
|
||||
@@ -323,12 +321,10 @@ walk_volume_descriptor_sequence(extent_address descriptorSequence,
|
||||
int num;
|
||||
for (num = 0; num < uniquePartitions; num++) {
|
||||
if (partitionDescriptors[num].partition_number()
|
||||
== partition->partition_number())
|
||||
{
|
||||
== partition->partition_number()) {
|
||||
foundDuplicate = true;
|
||||
if (partitionDescriptors[num].vds_number()
|
||||
< partition->vds_number())
|
||||
{
|
||||
< partition->vds_number()) {
|
||||
partitionDescriptors[num] = *partition;
|
||||
PRINT(("Replacing previous partition #%d (vds_number: %ld) with "
|
||||
"new partition #%d (vds_number: %ld)\n",
|
||||
@@ -360,8 +356,7 @@ walk_volume_descriptor_sequence(extent_address descriptorSequence,
|
||||
bool foundReplacement = false;
|
||||
for (int j = 0; j < uniquePartitions; j++) {
|
||||
if (partitionDescriptors[j].vds_number()
|
||||
< partition->vds_number())
|
||||
{
|
||||
< partition->vds_number()) {
|
||||
foundReplacement = true;
|
||||
partitionDescriptors[j] = *partition;
|
||||
PRINT(("Replacing partition #%d (vds_number: %ld) "
|
||||
@@ -467,8 +462,7 @@ walk_integrity_sequence(int device, uint32 blockSize, uint32 blockShift,
|
||||
bool lastDescriptorWasClosed = false;
|
||||
uint16 highestMinimumUDFReadRevision = 0x0000;
|
||||
status_t error = count > 0 ? B_OK : B_ENTRY_NOT_FOUND;
|
||||
for (uint32 i = 0; error == B_OK && i < count; i++)
|
||||
{
|
||||
for (uint32 i = 0; error == B_OK && i < count; i++) {
|
||||
off_t block = descriptorSequence.location()+i;
|
||||
off_t address = block << blockShift;
|
||||
MemoryChunk chunk(blockSize);
|
||||
|
||||
@@ -80,8 +80,7 @@ struct Volume::VNode {
|
||||
protected: // should be private, but gcc 2.95.3 issues a warning
|
||||
~VNode()
|
||||
{
|
||||
if (fileCache != NULL)
|
||||
{
|
||||
if (fileCache != NULL) {
|
||||
ERROR(("VNode %" B_PRId64 " still has a file cache!\n", id));
|
||||
file_cache_delete(fileCache);
|
||||
}
|
||||
@@ -4518,7 +4517,7 @@ PRINT(("Volume::_PutAllPendingVNodes()\n"));
|
||||
|
||||
MutexLocker locker(fLock);
|
||||
|
||||
if (!fVNodeCountingEnabled) {
|
||||
if (!fVNodeCountingEnabled) {
|
||||
PRINT(("Volume::_PutAllPendingVNodes() failed: vnode counting "
|
||||
"disabled\n"));
|
||||
return USERLAND_IOCTL_VNODE_COUNTING_DISABLED;
|
||||
|
||||
@@ -315,8 +315,7 @@ IPCP::ReceiveIPPacket(net_buffer *packet, uint16 protocolNumber)
|
||||
|
||||
// TODO: add VJC support (the packet would be decoded here)
|
||||
|
||||
if (packet)
|
||||
{
|
||||
if (packet) {
|
||||
#if DEBUG
|
||||
dump_packet(packet, "incoming");
|
||||
#endif
|
||||
|
||||
@@ -637,8 +637,7 @@ KPPPInterface::Control(uint32 op, void *data, size_t length)
|
||||
return B_ERROR;
|
||||
|
||||
ppp_control_info *controlInfo = (ppp_control_info*) control->data;
|
||||
if (controlInfo->index != 0 || !Device())
|
||||
{
|
||||
if (controlInfo->index != 0 || !Device()) {
|
||||
dprintf("index is 0 or no Device\n");
|
||||
return B_BAD_INDEX;
|
||||
}
|
||||
|
||||
@@ -204,8 +204,7 @@ connection_thread(void*)
|
||||
|
||||
// TODO: Keep this a static var
|
||||
port_id fPort = find_port(BLUETOOTH_CONNECTION_SCHED_PORT);
|
||||
if (fPort == B_NAME_NOT_FOUND)
|
||||
{
|
||||
if (fPort == B_NAME_NOT_FOUND) {
|
||||
panic("BT Connection port has been deleted");
|
||||
}
|
||||
|
||||
|
||||
@@ -2390,7 +2390,7 @@ TCPEndpoint::_Retransmit()
|
||||
void
|
||||
TCPEndpoint::_UpdateRoundTripTime(int32 roundTripTime, int32 expectedSamples)
|
||||
{
|
||||
if(fSmoothedRoundTripTime == 0) {
|
||||
if (fSmoothedRoundTripTime == 0) {
|
||||
fSmoothedRoundTripTime = roundTripTime;
|
||||
fRoundTripVariation = roundTripTime / 2;
|
||||
fRetransmitTimeout = (fSmoothedRoundTripTime + max_c(100, fRoundTripVariation * 4))
|
||||
|
||||
@@ -339,20 +339,17 @@ setPalette()
|
||||
// << 16 | (uint8)(i * 6/10) << 8;
|
||||
// | (uint8)(i * 3 / 10);
|
||||
|
||||
for (i = 128;i < 256;i++)
|
||||
{
|
||||
for (i = 128;i < 256; i++) {
|
||||
uint8 r = i;
|
||||
uint8 c = (uint8)((cos((i - 256) / 42.0) * 0.5 + 0.5) * 225);
|
||||
|
||||
gPalette[i] = ((r << 16) | (c << 8) | c);
|
||||
}
|
||||
/* for (i = 192; i < 224; i++)
|
||||
{
|
||||
/* for (i = 192; i < 224; i++) {
|
||||
uint8 c = (i - 192);
|
||||
gPalette[i] = gPalette[i] & 0xff0000 | c << 8 | c;
|
||||
}
|
||||
for (i = 224; i < 256; i++)
|
||||
{
|
||||
for (i = 224; i < 256; i++) {
|
||||
uint8 c = (i-224) / 2;
|
||||
c = 32 + c * c * 6 / 10;
|
||||
gPalette[i] = gPalette[i] & 0xff0000 | c << 8 | c;
|
||||
@@ -401,8 +398,7 @@ setPalette()
|
||||
}
|
||||
break;
|
||||
}
|
||||
/* for (i = 0;i < 256;i++)
|
||||
{
|
||||
/* for (i = 0;i < 256; i++) {
|
||||
uint8 r = (i);
|
||||
uint8 g = (i * i >> 8); //(i * 8 / 10);
|
||||
uint8 b = 0; //(i * 2 / 10);
|
||||
@@ -730,8 +726,7 @@ Nebula::StartSaver(BView* view, bool preview)
|
||||
}
|
||||
|
||||
// uniforme cubique
|
||||
/* for (i = 0;i < GMAX;i++)
|
||||
{
|
||||
/* for (i = 0;i < GMAX; i++) {
|
||||
gal[i].x = 1 * ((rand()&1023) - 512);
|
||||
gal[i].y = 1 * ((rand()&1023) - 512);
|
||||
gal[i].z = 1 * ((rand()&1023) - 512);
|
||||
|
||||
@@ -130,8 +130,7 @@ Activity::Draw(BRect rect)
|
||||
void
|
||||
Activity::_DrawOnBitmap(bool running)
|
||||
{
|
||||
if (fBitmap->Lock())
|
||||
{
|
||||
if (fBitmap->Lock()) {
|
||||
BRect bounds = fBitmap->Bounds();
|
||||
|
||||
fBitmapView->SetDrawingMode(B_OP_COPY);
|
||||
|
||||
@@ -79,15 +79,14 @@ ICNSLoader::ICNSLoader(BPositionIO *stream)
|
||||
icns_byte_t *dataPtr = (icns_byte_t*)fIconFamily;
|
||||
off_t dataOffset = sizeof(icns_type_t) + sizeof(icns_size_t);
|
||||
|
||||
while ((dataOffset+8) < fIconFamily->resourceSize)
|
||||
{
|
||||
while ((dataOffset+8) < fIconFamily->resourceSize) {
|
||||
icns_element_t iconElement;
|
||||
icns_size_t iconDataSize;
|
||||
|
||||
memcpy(&iconElement, (dataPtr + dataOffset), 8);
|
||||
iconDataSize = iconElement.elementSize - 8;
|
||||
|
||||
if(IS_SPUPPORTED_TYPE(iconElement.elementType)) {
|
||||
if (IS_SPUPPORTED_TYPE(iconElement.elementType)) {
|
||||
icns_type_t* newTypeItem = new icns_type_t;
|
||||
*newTypeItem = iconElement.elementType;
|
||||
fFormatList.AddItem(newTypeItem);
|
||||
|
||||
@@ -445,8 +445,7 @@ write_rgba32b(jas_matrix_t** pixels, uchar* scanline, int width)
|
||||
{
|
||||
int32 index = 0;
|
||||
int32 x = 0;
|
||||
while (x < width)
|
||||
{
|
||||
while (x < width) {
|
||||
jas_matrix_setv(pixels[0], x, scanline[index++]);
|
||||
jas_matrix_setv(pixels[1], x, scanline[index++]);
|
||||
jas_matrix_setv(pixels[2], x, scanline[index++]);
|
||||
|
||||
@@ -265,8 +265,7 @@ HashMapCatalog::ComputeFingerprint() const
|
||||
int32 hash;
|
||||
CatMap::Iterator iter = fCatMap.GetIterator();
|
||||
CatMap::Entry entry;
|
||||
while (iter.HasNext())
|
||||
{
|
||||
while (iter.HasNext()) {
|
||||
entry = iter.Next();
|
||||
hash = B_HOST_TO_LENDIAN_INT32(entry.key.fHashVal);
|
||||
checksum += hash;
|
||||
|
||||
@@ -53,8 +53,7 @@ BDaemonClient::GetInstallationLocationInfo(
|
||||
// Get our filesystem root node. If we are in a chroot this is not the same
|
||||
// as the package_daemon root node, so we must provide it.
|
||||
struct stat st;
|
||||
if (stat("/boot", &st) == 0)
|
||||
{
|
||||
if (stat("/boot", &st) == 0) {
|
||||
error = request.AddInt32("volume", st.st_dev);
|
||||
if (error != B_OK)
|
||||
return error;
|
||||
|
||||
@@ -131,9 +131,7 @@ SnifferRules::SnifferRules(DatabaseLocation* databaseLocation,
|
||||
SnifferRules::~SnifferRules()
|
||||
{
|
||||
for (std::list<sniffer_rule>::iterator i = fRuleList.begin();
|
||||
i != fRuleList.end();
|
||||
i++)
|
||||
{
|
||||
i != fRuleList.end(); i++) {
|
||||
delete i->rule;
|
||||
i->rule = NULL;
|
||||
}
|
||||
@@ -262,8 +260,7 @@ SnifferRules::SetSnifferRule(const char *type, const char *rule)
|
||||
// operator<(sniffer_rule&, sniffer_rule&))
|
||||
if (!err) {
|
||||
std::list<sniffer_rule>::iterator i;
|
||||
for (i = fRuleList.begin(); i != fRuleList.end(); i++)
|
||||
{
|
||||
for (i = fRuleList.begin(); i != fRuleList.end(); i++) {
|
||||
if (item < (*i)) {
|
||||
fRuleList.insert(i, item);
|
||||
break;
|
||||
@@ -292,9 +289,7 @@ SnifferRules::DeleteSnifferRule(const char *type)
|
||||
|
||||
// Find the rule in the list and remove it
|
||||
for (std::list<sniffer_rule>::iterator i = fRuleList.begin();
|
||||
i != fRuleList.end();
|
||||
i++)
|
||||
{
|
||||
i != fRuleList.end(); i++) {
|
||||
if (i->type == type) {
|
||||
fRuleList.erase(i);
|
||||
break;
|
||||
@@ -316,9 +311,7 @@ SnifferRules::PrintToStream() const
|
||||
|
||||
if (fHaveDoneFullBuild) {
|
||||
for (std::list<sniffer_rule>::const_iterator i = fRuleList.begin();
|
||||
i != fRuleList.end();
|
||||
i++)
|
||||
{
|
||||
i != fRuleList.end(); i++) {
|
||||
printf("%s: '%s'\n", i->type.c_str(), i->rule_string.c_str());
|
||||
}
|
||||
} else {
|
||||
@@ -357,8 +350,7 @@ SnifferRules::BuildRuleList()
|
||||
char supertype[B_PATH_NAME_LENGTH];
|
||||
if (entry.IsDirectory()
|
||||
&& entry.GetName(supertype) == B_OK
|
||||
&& BMimeType::IsValid(supertype))
|
||||
{
|
||||
&& BMimeType::IsValid(supertype)) {
|
||||
// Make sure the supertype string is all lowercase
|
||||
BPrivate::Storage::to_lower(supertype);
|
||||
|
||||
@@ -468,9 +460,7 @@ SnifferRules::GuessMimeType(BFile* file, const void *buffer, int32 length,
|
||||
// descreasing priority, and see if one of the rules sniffs
|
||||
// out a match
|
||||
for (std::list<sniffer_rule>::const_iterator i = fRuleList.begin();
|
||||
i != fRuleList.end();
|
||||
i++)
|
||||
{
|
||||
i != fRuleList.end(); i++) {
|
||||
if (i->rule) {
|
||||
// If an add-on identified the type with a priority at least
|
||||
// as great as the remaining rules, we can stop further
|
||||
|
||||
+10
-20
@@ -283,57 +283,48 @@ BUrl::SetPath(const BString& path)
|
||||
BString input(path);
|
||||
|
||||
// 2.
|
||||
while(!input.IsEmpty())
|
||||
{
|
||||
while (!input.IsEmpty()) {
|
||||
// 2.A.
|
||||
if (input.StartsWith("./"))
|
||||
{
|
||||
if (input.StartsWith("./")) {
|
||||
input.Remove(0, 2);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (input.StartsWith("../"))
|
||||
{
|
||||
if (input.StartsWith("../")) {
|
||||
input.Remove(0, 3);
|
||||
continue;
|
||||
}
|
||||
|
||||
// 2.B.
|
||||
if (input.StartsWith("/./"))
|
||||
{
|
||||
if (input.StartsWith("/./")) {
|
||||
input.Remove(0, 2);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (input == "/.")
|
||||
{
|
||||
if (input == "/.") {
|
||||
input.Remove(1, 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
// 2.C.
|
||||
if (input.StartsWith("/../"))
|
||||
{
|
||||
if (input.StartsWith("/../")) {
|
||||
input.Remove(0, 3);
|
||||
output.Truncate(output.FindLast('/'));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (input == "/..")
|
||||
{
|
||||
if (input == "/..") {
|
||||
input.Remove(1, 2);
|
||||
output.Truncate(output.FindLast('/'));
|
||||
continue;
|
||||
}
|
||||
|
||||
// 2.D.
|
||||
if (input == "." || input == "..")
|
||||
{
|
||||
if (input == "." || input == "..") {
|
||||
break;
|
||||
}
|
||||
|
||||
if (input == "/.")
|
||||
{
|
||||
if (input == "/.") {
|
||||
input.Remove(1, 1);
|
||||
continue;
|
||||
}
|
||||
@@ -1100,8 +1091,7 @@ BString
|
||||
BUrl::_MergePath(const BString& relative) const
|
||||
{
|
||||
// This implements RFC3986, Section 5.2.3.
|
||||
if (HasAuthority() && fPath == "")
|
||||
{
|
||||
if (HasAuthority() && fPath == "") {
|
||||
BString result("/");
|
||||
result << relative;
|
||||
return result;
|
||||
|
||||
@@ -333,8 +333,7 @@ GlyphLayoutEngine::_WriteLockAndAcquireFallbackEntry(
|
||||
int i = 0;
|
||||
|
||||
// Try to get the glyph from the fallback fonts
|
||||
while(fallbacks[i] != NULL)
|
||||
{
|
||||
while (fallbacks[i] != NULL) {
|
||||
if (gFontManager->Lock()) {
|
||||
FontStyle* fallbackStyle = gFontManager->GetStyleByIndex(
|
||||
fallbacks[i], 0);
|
||||
|
||||
@@ -31,8 +31,7 @@ HCITransportAccessor::HCITransportAccessor(BPath* path) : HCIDelegate(path)
|
||||
|
||||
HCITransportAccessor::~HCITransportAccessor()
|
||||
{
|
||||
if (fDescriptor > 0)
|
||||
{
|
||||
if (fDescriptor > 0) {
|
||||
close(fDescriptor);
|
||||
fDescriptor = -1;
|
||||
fIdentifier = B_ERROR;
|
||||
|
||||
@@ -72,8 +72,7 @@ status_t our_image(image_info* image)
|
||||
{
|
||||
int32 cookie = 0;
|
||||
status_t ret;
|
||||
while ((ret = get_next_image_info(0,&cookie,image)) == B_OK)
|
||||
{
|
||||
while ((ret = get_next_image_info(0, &cookie,image)) == B_OK) {
|
||||
if ((char*)our_image >= (char*)image->text_part &&
|
||||
(char*)our_image <= (char*)image->text_part + image->text_part_size)
|
||||
break;
|
||||
|
||||
@@ -263,8 +263,7 @@ NotificationView::Draw(BRect updateRect)
|
||||
float iy = (Bounds().Height() - fIconSize) / 4.0;
|
||||
// Icon is vertically centered in view
|
||||
|
||||
if (fNotification->Type() == B_PROGRESS_NOTIFICATION)
|
||||
{
|
||||
if (fNotification->Type() == B_PROGRESS_NOTIFICATION) {
|
||||
// Move icon up by half progress bar height if it's present
|
||||
iy -= (progRect.Height() + kEdgePadding);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user