style fixes

This commit is contained in:
Jérôme Duval
2018-05-17 22:23:36 +02:00
parent 9e095e1ef8
commit cd6365c7ce
24 changed files with 54 additions and 99 deletions
@@ -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
@@ -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);
}
@@ -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");
}
+5 -10
View File
@@ -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);
+1 -2
View File
@@ -79,8 +79,7 @@ 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;
@@ -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++]);
+1 -2
View File
@@ -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;
+1 -2
View File
@@ -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;
+6 -16
View File
@@ -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
View File
@@ -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;
+1 -2
View File
@@ -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;
+1 -2
View File
@@ -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);
}