Fixing random GCC4 warnings. Mostly missing consts, some parentheses, some braces... Should all be harmless and not change anything.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31600 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz 2009-07-16 02:42:03 +00:00
parent b78c74fdc4
commit 63d557f06f
30 changed files with 56 additions and 47 deletions

View File

@ -64,7 +64,7 @@ SYSTEM_BIN = "[" addattr alert arp base64 basename bash bc beep bootman bzip2
zdiff zforce zgrep zip zipcloak <bin>zipgrep zipnote zipsplit zmore znew
;
SYSTEM_APPS = AboutSystem ActivityMonitor CharacterMap CodyCam DeskCalc DiskProbe
SYSTEM_APPS = AboutSystem ActivityMonitor CharacterMap CodyCam Debugger DeskCalc DiskProbe
DiskUsage DriveSetup CDPlayer Expander Icon-O-Matic Installer LaunchBox
Magnify Mail MediaPlayer MidiPlayer NetworkStatus PackageInstaller People
PoorMan PowerStatus ProcessController Screenshot ShowImage SoundRecorder

View File

@ -354,7 +354,7 @@ extern void debugger(const char *message);
to re-enable the default debugger pass a zero.
*/
extern const int disable_debugger(int state);
extern int disable_debugger(int state);
// TODO: Remove. Temporary debug helper.
extern void debug_printf(const char *format, ...)

View File

@ -580,14 +580,14 @@ set_mix(hda_audio_group* audioGroup, multi_mix_value_info * mmvi)
| AMP_SET_LEFT_CHANNEL
| AMP_SET_INPUT_INDEX(control->index)
| control->mute
| resp[0] & AMP_GAIN_MASK);
| (resp[0] & AMP_GAIN_MASK));
TRACE("set_mix: sending verb to %ld: %lx %lx %x %lx\n", control->nid,
control->mute, resp[0] & AMP_GAIN_MASK, control->input,
(control->input ? AMP_SET_INPUT : AMP_SET_OUTPUT)
| AMP_SET_LEFT_CHANNEL
| AMP_SET_INPUT_INDEX(control->index)
| control->mute
| resp[0] & AMP_GAIN_MASK);
| (resp[0] & AMP_GAIN_MASK));
verb[1] = MAKE_VERB(audioGroup->codec->addr,
control->nid,
VID_SET_AMPLIFIER_GAIN_MUTE,
@ -595,7 +595,7 @@ set_mix(hda_audio_group* audioGroup, multi_mix_value_info * mmvi)
| AMP_SET_RIGHT_CHANNEL
| AMP_SET_INPUT_INDEX(control->index)
| control->mute
| resp[1] & AMP_GAIN_MASK);
| (resp[1] & AMP_GAIN_MASK));
TRACE("set_mix: ctrl2 sending verb to %ld: %lx %lx %x\n", control->nid,
control->mute, resp[1] & AMP_GAIN_MASK, control->input);
hda_send_verbs(audioGroup->codec, verb, NULL, 2);

View File

@ -54,7 +54,7 @@ int32 api_version = B_CUR_DRIVER_API_VERSION; // revision of driver API we suppo
struct ChipInfo {
uint16 chipID; // PCI device id of the chip
ChipType chipType; // assigned chip type identifier
char* chipName; // user recognizable name for chip (must be < 32 chars)
const char* chipName; // user recognizable name for chip (must be < 32 chars)
};

View File

@ -39,9 +39,10 @@ int32 api_version = B_CUR_DRIVER_API_VERSION; // revision of driver API we suppo
struct ChipInfo {
uint16 chipID; // PCI device id of the chip
uint16 chipType; // assigned chip type identifier
char* chipName; // user recognizable name for chip (must be < 32 chars)
uint16 chipID; // PCI device id of the chip
uint16 chipType; // assigned chip type identifier
const char* chipName; // user recognizable name for chip (must be < 32
// chars)
};
// This table maps a PCI device ID to a chip type identifier and the chip name.

View File

@ -32,7 +32,7 @@ io_port::Print()
SmallResourceData::SmallResourceData(acpi_device_module_info* acpi,
acpi_device acpiCookie, char* method)
acpi_device acpiCookie, const char* method)
{
acpi_data buffer;
buffer.pointer = NULL;

View File

@ -38,7 +38,7 @@ class SmallResourceData
{
public:
SmallResourceData(acpi_device_module_info* acpi,
acpi_device acpiCookie, char* method);
acpi_device acpiCookie, const char* method);
~SmallResourceData();
status_t InitCheck();

View File

@ -74,7 +74,7 @@ bus_space_write_1(int address, uint8 v)
status_t
acpi_GetInteger(acpi_device_module_info* acpi, acpi_device& acpiCookie,
char* path, int* number)
const char* path, int* number)
{
status_t status;
acpi_data buf;
@ -227,7 +227,7 @@ acpi_get_type(device_node* dev)
static float
embedded_controller_support(device_node *dev)
{
static char *ec_ids[] = { "PNP0C09", NULL };
static const char *ec_ids[] = { "PNP0C09", NULL };
/* Check that this is a device. */
if (acpi_get_type(dev) != ACPI_TYPE_DEVICE)

View File

@ -304,8 +304,8 @@ new_chrand(const unsigned int inittimes)
prandgen->rndptrX = prandgen->ira;
prandgen->rndptrA = prandgen->ira;
prandgen->rndptrB = prandgen->ira;
prandgen->rndLeft.Q[0] = 0x1A4B385C72D69E0FUL;
prandgen->rndRite.Q[0] = 0x9C805FE7361A42DBUL;
prandgen->rndLeft.Q[0] = 0x1A4B385C72D69E0FULL;
prandgen->rndRite.Q[0] = 0x9C805FE7361A42DBULL;
reseed (prandgen, inittimes);
prandgen->seedptr = prandgen->ira + chrand (prandgen) % NK;

View File

@ -114,7 +114,7 @@ find_string(const char *string, const char *find)
static void
cut_string(char *string, char *cut)
cut_string(char *string, const char *cut)
{
if (string == NULL || cut == NULL)
return;

View File

@ -102,7 +102,7 @@ Block::GetData() const
void
Block::SetKind(uint32 kind)
{
fFlags = fFlags & ~(uint32)KIND_MASK | kind & KIND_MASK;
fFlags = (fFlags & ~(uint32)KIND_MASK) | (kind & KIND_MASK);
}
// SetChecked

View File

@ -31,7 +31,7 @@ using std::nothrow;
\brief Manages the ReiserFS settings.
*/
static char *kFSName = "reiserfs";
static const char *kFSName = "reiserfs";
// defaults
static const char *kDefaultDefaultVolumeName = "ReiserFS untitled";

View File

@ -211,7 +211,7 @@ FUNCTION(("dir: (%Ld: %lu, %lu), entry: `%s'\n", dir->GetID(), dir->GetDirID(),
// hide non-file/dir/symlink entries, if the user desires that, and
// those entries explicitly set to hidden
if (error == B_OK
&& (foundNode.IsEsoteric() && volume->GetHideEsoteric()
&& ((foundNode.IsEsoteric() && volume->GetHideEsoteric())
|| volume->IsNegativeEntry(foundNode.GetID()))) {
error = B_ENTRY_NOT_FOUND;
}
@ -602,7 +602,7 @@ FUNCTION(("node: (%Ld: %lu, %lu)\n", node->GetID(), node->GetDirID(),
if (volume->GetTree()->FindStatItem(dirID, objectID, &statItem)
!= B_OK
|| statItem.GetStatData(&statData) != B_OK
|| statData.IsEsoteric() && volume->GetHideEsoteric()) {
|| (statData.IsEsoteric() && volume->GetHideEsoteric())) {
continue;
}
if (error == B_OK) {

View File

@ -219,7 +219,7 @@ get_sibling_partitions_pm(partition_data *partition,
partition_data *nextSibling = NULL;
for (int32 i = 0; i < partition->child_count; i++) {
partition_data *sibling = get_child_partition(partition->id, i);
if (sibling && sibling != child)
if (sibling && sibling != child) {
if (sibling->offset <= childOffset) {
if (!previousSibling || previousSibling->offset < sibling->offset)
previousSibling = sibling;
@ -228,6 +228,7 @@ get_sibling_partitions_pm(partition_data *partition,
if (!nextSibling || nextSibling->offset > sibling->offset)
nextSibling = sibling;
}
}
}
*previous = previousSibling;
*next = nextSibling;
@ -259,7 +260,7 @@ get_sibling_partitions_ep(partition_data *partition,
partition_data *nextSibling = NULL;
for (int32 i = 0; i < partition->child_count; i++) {
partition_data *sibling = get_child_partition(partition->id, i);
if (sibling && sibling != child)
if (sibling && sibling != child) {
if (get_offset_ep(sibling) <= childOffset) {
if (!previousSibling || previousSibling->offset < sibling->offset)
previousSibling = sibling;
@ -268,6 +269,7 @@ get_sibling_partitions_ep(partition_data *partition,
if (!nextSibling || nextSibling->offset > sibling->offset)
nextSibling = sibling;
}
}
}
*previous = previousSibling;
*next = nextSibling;

View File

@ -160,7 +160,7 @@ FilterHTMLTag(int32 &first, char **t, char *end)
return false;
}
const struct { char *name; int32 code; } entities[] = {
const struct { const char *name; int32 code; } entities[] = {
// this list is sorted alphabetically to be binary searchable
// the current implementation doesn't do this, though
@ -400,7 +400,7 @@ CopyQuotes(const char *text, size_t length, char *outText, size_t &outLength)
{
// count qoute level (to be able to wrap quotes correctly)
char *quote = QUOTE;
const char *quote = QUOTE;
int32 level = 0;
for (size_t i = 0; i < length; i++) {
if (text[i] == quote[0])
@ -539,7 +539,7 @@ FillInQuoteTextRuns(BTextView* view, quote_context* context, const char* line,
bool search = true;
for (next = pos + 1; next < length; next++) {
if (search && is_quote_char(line[next])
if ((search && is_quote_char(line[next]))
|| line[next] == '\n')
break;
else if (search && line[next] != ' ' && line[next] != '\t')
@ -2290,7 +2290,7 @@ TTextView::Reader::ParseMail(BMailContainer *container,
enclosure->type = TYPE_ENCLOSURE;
char *name = "\n<Enclosure: could not handle>\n";
const char *name = "\n<Enclosure: could not handle>\n";
fView->GetSelection(&enclosure->text_start, &enclosure->text_end);
enclosure->text_start++;

View File

@ -734,7 +734,7 @@ THeaderView::LoadMessage(BEmailMessage *mail)
// #pragma mark - TTextControl
TTextControl::TTextControl(BRect rect, char *label, BMessage *msg,
TTextControl::TTextControl(BRect rect, const char *label, BMessage *msg,
bool incoming, bool resending, int32 resizingMode)
: BComboBox(rect, "happy", label, msg, resizingMode),
fRefDropMenu(NULL)

View File

@ -123,7 +123,8 @@ class THeaderView : public BBox {
class TTextControl : public BComboBox {
public:
TTextControl(BRect, char*, BMessage*, bool, bool, int32 resizingMode = B_FOLLOW_NONE);
TTextControl(BRect, const char*, BMessage*, bool, bool,
int32 resizingMode = B_FOLLOW_NONE);
virtual void AttachedToWindow();
virtual void MessageReceived(BMessage*);

View File

@ -20,7 +20,7 @@
void
PrintFlag(uint32 deviceFlags, uint32 testFlag, char *yes, char *no)
PrintFlag(uint32 deviceFlags, uint32 testFlag, const char *yes, const char *no)
{
printf(deviceFlags & testFlag ? yes : no);
}
@ -71,7 +71,7 @@ ByteString(int64 numBlocks, int64 blockSize)
if (blocks < 1024)
sprintf(string, "%Ld", numBlocks * blockSize);
else {
char *units[] = {"K", "M", "G", NULL};
const char *units[] = {"K", "M", "G", NULL};
int32 i = -1;
do {

View File

@ -315,9 +315,9 @@ HeyInterpreterThreadHook(void* arg)
return 1;
BMessage environment(*(BMessage*) arg);
char* prompt = "Hey";
const char* prompt = "Hey";
if (environment.HasString("prompt"))
environment.FindString("prompt", (const char **)&prompt);
environment.FindString("prompt", &prompt);
printf("%s> ", prompt);
BMessenger target;

View File

@ -46,7 +46,7 @@ print_index_type(const index_info &info, bool mkindexOutput)
return mkindexOutput ? "double" : "Double";
default:
sprintf(buffer, mkindexOutput ? "0x%08lx" : "Unknown type (0x%x)", info.type);
sprintf(buffer, mkindexOutput ? "0x%08lx" : "Unknown type (0x%lx)", info.type);
return buffer;
}
}

View File

@ -96,7 +96,7 @@ usage(int status)
int
main(int argc, char **argv)
{
char *indexTypeName = "string";
const char *indexTypeName = "string";
int indexType = B_STRING_TYPE;
char *indexName = NULL;
bool verbose = false;

View File

@ -99,7 +99,7 @@ size_string(int64 size)
if (size < 1024)
sprintf(string, "%Ld", size);
else {
char* units[] = {"K", "M", "G", NULL};
const char* units[] = {"K", "M", "G", NULL};
int32 i = -1;
do {

View File

@ -38,7 +38,7 @@ set_tty_echo(bool enabled)
return errno;
// do we have to change the current setting at all?
if (enabled == (termios.c_lflag & ECHO) != 0)
if (enabled == ((termios.c_lflag & ECHO) != 0))
return B_OK;
if (enabled)

View File

@ -740,6 +740,7 @@ struct RGB24Reader : public BaseReader<_PixelType> {
color.red = pixel.red;
color.green = pixel.green;
color.blue = pixel.blue;
color.alpha = 255;
BaseReader<_PixelType>::pixels++;
}
@ -770,6 +771,7 @@ struct RGB16Reader : public BaseReader<_PixelType> {
color.red |= color.red >> 5;
color.green |= color.green >> 6;
color.blue |= color.blue >> 5;
color.alpha = 255;
BaseReader<_PixelType>::pixels++;
}
@ -800,6 +802,7 @@ struct RGB15Reader : public BaseReader<_PixelType> {
color.red |= color.red >> 5;
color.green |= color.green >> 5;
color.blue |= color.blue >> 5;
color.alpha = 255;
BaseReader<_PixelType>::pixels++;
}
@ -843,6 +846,7 @@ struct Gray8Reader : public BaseReader<uint8> {
inline void Read(rgb_color_value &color)
{
color.red = color.green = color.blue = *BaseReader<uint8>::pixels;
color.alpha = 255;
BaseReader<uint8>::pixels++;
}
@ -881,6 +885,7 @@ struct Gray1Reader : public BaseReader<uint8> {
color.red = color.green = color.blue = 255;
else
color.red = color.green = color.blue = 0;
color.alpha = 255;
bit--;
if (bit == -1) {
pixels++;
@ -935,8 +940,7 @@ struct RGB32Writer : public BaseWriter<_PixelType> {
pixel.red = color.red;
pixel.green = color.green;
pixel.blue = color.blue;
// pixel.alpha = 255;
pixel.alpha = color.alpha;
pixel.alpha = color.alpha;
BaseWriter<_PixelType>::pixels++;
}

View File

@ -1740,7 +1740,7 @@ GenericAttributeText::CommitEditedTextFlavor(BTextView *textView)
BAlert *alert = new BAlert("",
"There was an error writing the attribute.",
"Cancel", 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
alert->SetShortcut(0, B_CANCEL);
alert->SetShortcut(0, B_ESCAPE);
alert->Go();
fValueIsDefined = false;

View File

@ -1578,8 +1578,8 @@ Window::HasInSubset(const Window* window) const
return false;
}
if (fFeel == B_FLOATING_APP_WINDOW_FEEL
&& window->Feel() != B_MODAL_APP_WINDOW_FEEL
if ((fFeel == B_FLOATING_APP_WINDOW_FEEL
&& window->Feel() != B_MODAL_APP_WINDOW_FEEL)
|| fFeel == B_MODAL_APP_WINDOW_FEEL)
return window->ServerWindow()->App() == ServerWindow()->App();

View File

@ -461,7 +461,8 @@ WorkspacesView::MouseDown(BMessage* message, BPoint where)
// If this window is movable, we keep it selected
// (we prevent our own window from being moved, too)
if (fSelectedWindow != NULL && (fSelectedWindow->Flags() & B_NOT_MOVABLE) != 0
if ((fSelectedWindow != NULL
&& (fSelectedWindow->Flags() & B_NOT_MOVABLE) != 0)
|| fSelectedWindow == Window()) {
fSelectedWindow = NULL;
}
@ -528,8 +529,8 @@ WorkspacesView::MouseMoved(BMessage* message, BPoint where)
if (index != fSelectedWorkspace) {
if (fSelectedWindow->IsNormal() && !fSelectedWindow->InWorkspace(index)) {
// move window to this new workspace
uint32 newWorkspaces = fSelectedWindow->Workspaces()
& ~(1UL << fSelectedWorkspace) | (1UL << index);
uint32 newWorkspaces = (fSelectedWindow->Workspaces()
& ~(1UL << fSelectedWorkspace)) | (1UL << index);
Window()->Desktop()->SetWindowWorkspaces(fSelectedWindow,
newWorkspaces);

View File

@ -84,7 +84,7 @@ CDDBDaemon::_Lookup(const dev_t device)
uint32 cddbId;
if (!_CanLookup(device, &cddbId, toc)) {
free(toc);
printf("Skipping device with id %d.\n", device);
printf("Skipping device with id %ld.\n", device);
return B_BAD_TYPE;
}

View File

@ -626,7 +626,7 @@ makeIndices()
void
addAttribute(BMessage &msg,char *name,char *publicName,int32 type = B_STRING_TYPE,bool viewable = true,bool editable = false,int32 width = 200)
addAttribute(BMessage &msg,const char *name,const char *publicName,int32 type = B_STRING_TYPE,bool viewable = true,bool editable = false,int32 width = 200)
{
msg.AddString("attr:name",name);
msg.AddString("attr:public_name",publicName);

View File

@ -77,7 +77,7 @@ RosterSettingsCharStream::GetString(char *result)
if (error)
return error;
typedef enum RosterSettingsScannerState {
enum RosterSettingsScannerState {
rsssStart,
rsssUnquoted,
rsssQuoted,