diff --git a/build/jam/BuildSetup b/build/jam/BuildSetup index a9c2dc432a..c91efe4d08 100644 --- a/build/jam/BuildSetup +++ b/build/jam/BuildSetup @@ -1033,15 +1033,12 @@ if $(HAIKU_GCC_VERSION[1]) = 2 { : $(scope) ; } } else { -# TODO: Enable after updating to a newer gcc 4 version that supports -Wno-error! # -Wuninitialized gives too many false positives. -# rule EnableWerror dirTokens : scope { -# AppendToConfigVar CCFLAGS : HAIKU_TOP $(dirTokens) -# : -Werror -Wno-error=uninitialized : $(scope) ; -# AppendToConfigVar C++FLAGS : HAIKU_TOP $(dirTokens) -# : -Werror -Wno-error=uninitialized : $(scope) ; -# } rule EnableWerror dirTokens : scope { + AppendToConfigVar CCFLAGS : HAIKU_TOP $(dirTokens) + : -Werror -Wno-error=uninitialized : $(scope) ; + AppendToConfigVar C++FLAGS : HAIKU_TOP $(dirTokens) + : -Werror -Wno-error=uninitialized : $(scope) ; } } diff --git a/headers/os/app/PropertyInfo.h b/headers/os/app/PropertyInfo.h index 780903c511..5990dde892 100644 --- a/headers/os/app/PropertyInfo.h +++ b/headers/os/app/PropertyInfo.h @@ -42,7 +42,7 @@ struct _oproperty_info_; struct compound_type { struct field_pair { #if __GNUC__ > 2 - const + const #endif char *name; // name of entry in message type_code type; // type_code of entry in message diff --git a/headers/private/storage/sniffer/Parser.h b/headers/private/storage/sniffer/Parser.h index 2e2e7d86a4..0d5629aa09 100644 --- a/headers/private/storage/sniffer/Parser.h +++ b/headers/private/storage/sniffer/Parser.h @@ -54,7 +54,7 @@ typedef enum TokenType { CharacterString, Integer, FloatingPoint -}; +} TokenType; /*! \brief Returns a NULL-terminated string contating the name of the given token type diff --git a/src/kits/app/Application.cpp b/src/kits/app/Application.cpp index 51b944941e..3ef471b054 100644 --- a/src/kits/app/Application.cpp +++ b/src/kits/app/Application.cpp @@ -1498,7 +1498,7 @@ BApplication::_WindowAt(uint32 index, bool includeMenus) const uint32 count = gLooperList.CountLoopers(); for (uint32 i = 0; i < count && index < count; i++) { BWindow* window = dynamic_cast(gLooperList.LooperAt(i)); - if (window == NULL || window != NULL && window->fOffscreen + if (window == NULL || (window != NULL && window->fOffscreen) || (!includeMenus && dynamic_cast(window) != NULL)) { index++; continue; diff --git a/src/kits/app/Messenger.cpp b/src/kits/app/Messenger.cpp index 828df46353..3c005642e7 100644 --- a/src/kits/app/Messenger.cpp +++ b/src/kits/app/Messenger.cpp @@ -572,11 +572,11 @@ operator<(const BMessenger &_a, const BMessenger &_b) // 3. fPreferredTarget // fTeam is insignificant return (a.Port() < b.Port() - || a.Port() == b.Port() + || (a.Port() == b.Port() && (a.Token() < b.Token() - || a.Token() == b.Token() + || (a.Token() == b.Token() && !a.IsPreferredTarget() - && b.IsPreferredTarget())); + && b.IsPreferredTarget())))); } diff --git a/src/kits/app/PropertyInfo.cpp b/src/kits/app/PropertyInfo.cpp index afb5e0791c..10f45b3e09 100644 --- a/src/kits/app/PropertyInfo.cpp +++ b/src/kits/app/PropertyInfo.cpp @@ -501,15 +501,15 @@ BPropertyInfo::FreeMem() if (fPropInfo != NULL) { for (i = 0; i < fPropCount; i++) { - free(fPropInfo[i].name); - free(fPropInfo[i].usage); + free((char *)fPropInfo[i].name); + free((char *)fPropInfo[i].usage); for (j = 0; j < 3; j++) { for (k = 0; k < 5; k++) { if (fPropInfo[i].ctypes[j].pairs[k].name == NULL) break; - free(fPropInfo[i].ctypes[j].pairs[k].name); + free((char *)fPropInfo[i].ctypes[j].pairs[k].name); } if (fPropInfo[i].ctypes[j].pairs[0].name == NULL) @@ -523,8 +523,8 @@ BPropertyInfo::FreeMem() if (fValueInfo != NULL) { for (i = 0; i < fValueCount; i++) { - free(fValueInfo[i].name); - free(fValueInfo[i].usage); + free((char *)fValueInfo[i].name); + free((char *)fValueInfo[i].usage); } free(fValueInfo); fValueInfo = NULL; diff --git a/src/kits/interface/ColorConversion.cpp b/src/kits/interface/ColorConversion.cpp index baa6aa9040..d332a1f855 100644 --- a/src/kits/interface/ColorConversion.cpp +++ b/src/kits/interface/ColorConversion.cpp @@ -250,7 +250,7 @@ inline uint8 PaletteConverter::IndexForRGB16(uint16 rgb) const { - return fColorMap->index_map[(rgb >> 1) & 0x7fe0 | rgb & 0x1f]; + return fColorMap->index_map[((rgb >> 1) & 0x7fe0) | (rgb & 0x1f)]; } @@ -487,7 +487,7 @@ ReadRGB24(const uint8 **source, int32 index) void WriteGray8(uint8 **dest, uint8 *data, int32 index) { - **dest = data[2] * 308 + data[1] * 600 + data[0] * 116 >> 10; + **dest = (data[2] * 308 + data[1] * 600 + data[0] * 116) >> 10; // this would boost the speed but is less accurate: //*dest = (data[2] << 8) + (data[1] << 9) + (data[0] << 8) >> 10; (*dest)++; @@ -584,9 +584,9 @@ ConvertBits(const srcByte *srcBits, dstByte *dstBits, int32 srcBitsLength, } srcBits = (srcByte*)((uint8*)srcBits + (srcOffsetY * srcBitsPerRow + srcOffsetX - * srcBitsPerPixel >> 3)); + * (srcBitsPerPixel >> 3))); dstBits = (dstByte*)((uint8*)dstBits + (dstOffsetY * dstBitsPerRow + dstOffsetX - * dstBitsPerPixel >> 3)); + * (dstBitsPerPixel >> 3))); // Ensure that the width fits int32 srcWidth = (srcBitsPerRow - srcOffsetX * srcBitsPerPixel) diff --git a/src/kits/interface/ListView.cpp b/src/kits/interface/ListView.cpp index 3b2e0ad595..0eecf2a9c3 100644 --- a/src/kits/interface/ListView.cpp +++ b/src/kits/interface/ListView.cpp @@ -1527,7 +1527,7 @@ BListView::_DeselectAll(int32 exceptFrom, int32 exceptTo) bool BListView::_TryInitiateDrag(BPoint where) { - if (!fTrack->try_drag | fTrack->item_index < 0) + if (!fTrack->try_drag || fTrack->item_index < 0) return false; BPoint offset = where - fTrack->drag_start; diff --git a/src/kits/interface/Menu.cpp b/src/kits/interface/Menu.cpp index e2590e9946..6f9808d637 100644 --- a/src/kits/interface/Menu.cpp +++ b/src/kits/interface/Menu.cpp @@ -2626,8 +2626,8 @@ BMenu::_OkToProceed(BMenuItem* item) // TODO: I added the check for BMenuBar to solve a problem with Deskbar. // BeOS seems to do something similar. This could also be a bug in Deskbar, though. if ((buttons != 0 && stickyMode) - || (dynamic_cast(this) == NULL - && (buttons == 0 && !stickyMode) || _HitTestItems(where) != item)) + || ((dynamic_cast(this) == NULL + && (buttons == 0 && !stickyMode)) || _HitTestItems(where) != item)) return false; return true; diff --git a/src/kits/interface/MenuItem.cpp b/src/kits/interface/MenuItem.cpp index 22a0721cce..b99f952a31 100644 --- a/src/kits/interface/MenuItem.cpp +++ b/src/kits/interface/MenuItem.cpp @@ -755,7 +755,7 @@ BMenuItem::_DrawShortcutSymbol() where.x -= fBounds.Height() - 3; const float ascent = MenuPrivate(fSuper).Ascent(); - if (fShortcutChar < B_SPACE && kUTF8ControlMap[fShortcutChar]) + if (fShortcutChar < B_SPACE && kUTF8ControlMap[(int)fShortcutChar]) _DrawControlChar(fShortcutChar, where + BPoint(0, ascent)); else fSuper->DrawChar(fShortcutChar, where + BPoint(0, ascent)); @@ -849,8 +849,8 @@ BMenuItem::_DrawControlChar(char shortcut, BPoint where) // TODO: If needed, take another font for the control characters // (or have font overlays in the app_server!) const char* symbol = " "; - if (kUTF8ControlMap[fShortcutChar]) - symbol = kUTF8ControlMap[fShortcutChar]; + if (kUTF8ControlMap[(int)fShortcutChar]) + symbol = kUTF8ControlMap[(int)fShortcutChar]; fSuper->DrawString(symbol, where); } diff --git a/src/kits/interface/Slider.cpp b/src/kits/interface/Slider.cpp index 8b48238334..8ea1d652f9 100644 --- a/src/kits/interface/Slider.cpp +++ b/src/kits/interface/Slider.cpp @@ -874,10 +874,12 @@ BSlider::DrawBar() barColor.red = (fBarColor.red + no_tint.red) / 2; barColor.green = (fBarColor.green + no_tint.green) / 2; barColor.blue = (fBarColor.blue + no_tint.blue) / 2; + barColor.alpha = 255; fillColor.red = (fFillColor.red + no_tint.red) / 2; fillColor.green = (fFillColor.green + no_tint.green) / 2; fillColor.blue = (fFillColor.blue + no_tint.blue) / 2; + fillColor.alpha = 255; } // exclude the block thumb from the bar filling @@ -1172,8 +1174,8 @@ BSlider::UpdateTextChanged() const char* oldUpdateText = fUpdateText; fUpdateText = UpdateText(); - bool updateTextOnOff = fUpdateText == NULL && oldUpdateText != NULL - || fUpdateText != NULL && oldUpdateText == NULL; + bool updateTextOnOff = (fUpdateText == NULL && oldUpdateText != NULL) + || (fUpdateText != NULL && oldUpdateText == NULL); float newWidth = 0.0; if (fUpdateText != NULL) diff --git a/src/kits/interface/SplitLayout.cpp b/src/kits/interface/SplitLayout.cpp index 7f07976dc7..a10b8306e2 100644 --- a/src/kits/interface/SplitLayout.cpp +++ b/src/kits/interface/SplitLayout.cpp @@ -563,8 +563,8 @@ BSplitLayout::StartDraggingSplitter(BPoint point) // Things shouldn't be draggable, if we have a >= max layout. BSize size = _SubtractInsets(View()->Frame().Size()); - if (fOrientation == B_HORIZONTAL && size.width >= fMax.width - || fOrientation == B_VERTICAL && size.height >= fMax.height) { + if ((fOrientation == B_HORIZONTAL && size.width >= fMax.width) + || (fOrientation == B_VERTICAL && size.height >= fMax.height)) { return false; } @@ -1133,8 +1133,8 @@ void BSplitLayout::_InternalGetHeightForWidth(float width, bool realLayout, float* minHeight, float* maxHeight, float* preferredHeight) { - if (realLayout && fHeightForWidthVerticalLayouterWidth != width - || !realLayout && fCachedHeightForWidthWidth != width) { + if ((realLayout && fHeightForWidthVerticalLayouterWidth != width) + || (!realLayout && fCachedHeightForWidthWidth != width)) { // The general strategy is to clone the vertical layouter, which only // knows the general min/max constraints, do a horizontal layout for the // given width, and add the children's height for width constraints to diff --git a/src/kits/interface/Window.cpp b/src/kits/interface/Window.cpp index 5d68783f02..f6c79bc22e 100644 --- a/src/kits/interface/Window.cpp +++ b/src/kits/interface/Window.cpp @@ -1595,7 +1595,7 @@ void BWindow::SetPulseRate(bigtime_t rate) { // TODO: What about locking?!? - if (rate < 0 || (rate == fPulseRate && !(rate == 0 ^ fPulseRunner == NULL))) + if (rate < 0 || (rate == fPulseRate && !((rate == 0) ^ (fPulseRunner == NULL)))) return; fPulseRate = rate; diff --git a/src/kits/interface/textview_support/TextGapBuffer.cpp b/src/kits/interface/textview_support/TextGapBuffer.cpp index 2797a2714f..1310c5c96b 100644 --- a/src/kits/interface/textview_support/TextGapBuffer.cpp +++ b/src/kits/interface/textview_support/TextGapBuffer.cpp @@ -172,7 +172,7 @@ TextGapBuffer::SizeGapTo(long inCount) const char * TextGapBuffer::GetString(int32 fromOffset, int32 *_numBytes) { - char *result = ""; + char *result = (char *)""; if (_numBytes == NULL) return result; diff --git a/src/kits/storage/Entry.cpp b/src/kits/storage/Entry.cpp index fbeb741998..c01420d169 100644 --- a/src/kits/storage/Entry.cpp +++ b/src/kits/storage/Entry.cpp @@ -135,8 +135,8 @@ entry_ref::operator==(const entry_ref &ref) const return (device == ref.device && directory == ref.directory && (name == ref.name - || name != NULL && ref.name != NULL - && strcmp(name, ref.name) == 0)); + || (name != NULL && ref.name != NULL + && strcmp(name, ref.name) == 0))); } /*! \brief Compares the entry_ref with another entry_ref, returning true if they are not equal. @@ -1095,11 +1095,7 @@ operator<(const entry_ref & a, const entry_ref & b) || (a.device == b.device && (a.directory < b.directory || (a.directory == b.directory - && (a.name == NULL && b.name != NULL + && ((a.name == NULL && b.name != NULL) || (a.name != NULL && b.name != NULL && strcmp(a.name, b.name) < 0)))))); } - - - - diff --git a/src/kits/storage/Path.cpp b/src/kits/storage/Path.cpp index f5844229b9..74a207021f 100644 --- a/src/kits/storage/Path.cpp +++ b/src/kits/storage/Path.cpp @@ -390,8 +390,8 @@ BPath::operator==(const BPath &item) const bool BPath::operator==(const char *path) const { - return (InitCheck() != B_OK && path == NULL - || fName && path && strcmp(fName, path) == 0); + return ((InitCheck() != B_OK && path == NULL) + || (fName != NULL && path != NULL && strcmp(fName, path) == 0)); } //! Performs a simple (string-wise) comparison of paths. diff --git a/src/kits/storage/PathMonitor.cpp b/src/kits/storage/PathMonitor.cpp index 7be0f2e575..697fdc576b 100644 --- a/src/kits/storage/PathMonitor.cpp +++ b/src/kits/storage/PathMonitor.cpp @@ -359,8 +359,8 @@ PathHandler::_EntryCreated(BMessage* message) } // a new directory to watch for us - if (!entryContained && !_CloserToPath(entry) - || parentContained && !_WatchRecursively() + if ((!entryContained && !_CloserToPath(entry)) + || (parentContained && !_WatchRecursively()) || _AddDirectory(entry, true) != B_OK || _WatchFilesOnly()) notify = parentContained; @@ -446,7 +446,7 @@ PathHandler::_EntryMoved(BMessage* message) && (entryContained || _CloserToPath(entry))) { // there is a new directory to watch for us if (entryContained - || parentContained && !_WatchRecursively()) { + || (parentContained && !_WatchRecursively())) { _AddDirectory(entry, true); // NOTE: entry is toast now! } else if (_GetClosest(fPath.Path(), false, diff --git a/src/kits/storage/Resources.cpp b/src/kits/storage/Resources.cpp index 70a9ce0b8f..a5cd00c279 100644 --- a/src/kits/storage/Resources.cpp +++ b/src/kits/storage/Resources.cpp @@ -288,10 +288,10 @@ BResources::SetToImage(const void *codeOrDataPointer, bool clobber) int32 cookie = 0; while (get_next_image_info(B_CURRENT_TEAM, &cookie, &info) == B_OK) { - if ((addr_t)info.text <= address - && address - (addr_t)info.text < (addr_t)info.text_size - || (addr_t)info.data <= address - && address - (addr_t)info.data < (addr_t)info.data_size) { + if (((addr_t)info.text <= address + && address - (addr_t)info.text < (addr_t)info.text_size) + || ((addr_t)info.data <= address + && address - (addr_t)info.data < (addr_t)info.data_size)) { return SetTo(info.name, clobber); } } diff --git a/src/kits/storage/ResourcesContainer.cpp b/src/kits/storage/ResourcesContainer.cpp index bf903f2b33..34f836d4e1 100644 --- a/src/kits/storage/ResourcesContainer.cpp +++ b/src/kits/storage/ResourcesContainer.cpp @@ -143,9 +143,9 @@ ResourcesContainer::IndexOf(type_code type, const char *name) const for (int32 i = 0; index == -1 && i < count; i++) { ResourceItem *item = ResourceAt(i); const char *itemName = item->Name(); - if (item->Type() == type && (name == NULL && itemName == NULL - || name != NULL && itemName != NULL - && !strcmp(name, itemName))) { + if (item->Type() == type && ((name == NULL && itemName == NULL) + || (name != NULL && itemName != NULL + && strcmp(name, itemName) == 0))) { index = i; } } diff --git a/src/kits/storage/Volume.cpp b/src/kits/storage/Volume.cpp index 0573556330..2a44c6f846 100644 --- a/src/kits/storage/Volume.cpp +++ b/src/kits/storage/Volume.cpp @@ -493,7 +493,7 @@ BVolume::KnowsQuery(void) const bool BVolume::operator==(const BVolume &volume) const { - return (InitCheck() != B_OK && volume.InitCheck() != B_OK + return ((InitCheck() != B_OK && volume.InitCheck() != B_OK) || fDevice == volume.fDevice); } diff --git a/src/kits/storage/disk_device/Partition.cpp b/src/kits/storage/disk_device/Partition.cpp index 150f36131c..18d4f29092 100644 --- a/src/kits/storage/disk_device/Partition.cpp +++ b/src/kits/storage/disk_device/Partition.cpp @@ -1543,7 +1543,7 @@ BPartition::_SupportsOperation(uint32 flag, uint32 whileMountedFlag, bool BPartition::_SupportsChildOperation(const BPartition* child, uint32 flag) const { - if (!fDelegate || child && !child->fDelegate) + if (!fDelegate || (child && !child->fDelegate)) return false; uint32 supported = fDelegate->SupportedChildOperations( diff --git a/src/kits/storage/sniffer/Parser.cpp b/src/kits/storage/sniffer/Parser.cpp index 5848de4f94..241df7de91 100644 --- a/src/kits/storage/sniffer/Parser.cpp +++ b/src/kits/storage/sniffer/Parser.cpp @@ -260,7 +260,7 @@ TokenStream::SetTo(const std::string &string) { tsssEscapeOneOctal, tsssEscapeTwoOctal, tsssEscapeOneHex, - }; + } TokenStreamScannerState; TokenStreamScannerState state = tsssStart; TokenStreamScannerState escapedState = tsssStart;