Some fixes for GCC 4.6 warning: variable set but not used

This commit is contained in:
Jerome Duval 2012-02-23 20:26:18 +01:00
parent 4bbb27e3cc
commit 5c6b9eb00d
27 changed files with 44 additions and 83 deletions

View File

@ -1417,7 +1417,6 @@ BComboBox::Draw(BRect /*updateRect*/)
BRect bounds = Bounds();
font_height fInfo;
rgb_color high = HighColor();
rgb_color low = LowColor();
rgb_color base = ViewColor();
bool focused;
bool enabled;
@ -1474,8 +1473,6 @@ BComboBox::Draw(BRect /*updateRect*/)
StrokeRect(fr);
SetHighColor(high);
rgb_color oldCol = HighColor();
bounds.right = bounds.left + fDivider;
if ((Label()) && (fDivider > 0.0)) {
BPoint loc;

View File

@ -1550,9 +1550,8 @@ TTextView::MouseDown(BPoint where)
BMenuItem *menuItem;
BPopUpMenu menu("Words", false, false);
int32 matchCount;
for (int32 i = 0; i < gDictCount; i++)
matchCount = gWords[i]->FindBestMatches(&matches,
gWords[i]->FindBestMatches(&matches,
srcWord.String());
if (matches.CountItems()) {

View File

@ -131,9 +131,10 @@ status_t
KUndoBuffer::AddUndo(const char* text, int32 length, int32 offset,
undo_type history, int32 cursor_pos)
{
if (fNoTouch) return B_OK;
if (fNoTouch)
return B_OK;
status_t status;
status_t status = B_OK;
if (fNewItem || (fIndex < CountItems()) || (CountItems()==0)) {
status = NewUndo(text, length, offset, history, cursor_pos);
@ -167,7 +168,7 @@ KUndoBuffer::AddUndo(const char* text, int32 length, int32 offset,
}
}
return B_OK;
return status;
}

View File

@ -359,8 +359,6 @@ MediaConverterApp::_ConvertFile(BMediaFile* inFile, BMediaFile* outFile,
int32 width = -1;
int32 height = -1;
short audioFrameSize = 1;
uint8* videoBuffer = NULL;
uint8* audioBuffer = NULL;
@ -384,7 +382,7 @@ MediaConverterApp::_ConvertFile(BMediaFile* inFile, BMediaFile* outFile,
audioBuffer = new uint8[raf->buffer_size];
// audioFrameSize = (raf->format & media_raw_audio_format::B_AUDIO_SIZE_MASK)
audioFrameSize = (raf->format & 0xf) * raf->channel_count;
// audioFrameSize = (raf->format & 0xf) * raf->channel_count;
outAudTrack = outFile->CreateTrack(&outAudFormat, audioCodec);
if (outAudTrack != NULL) {

View File

@ -634,7 +634,6 @@ VideoProducer::_FrameGeneratorThread()
bigtime_t waitUntil = 0;
bigtime_t nextWaitUntil = 0;
int32 playingDirection = 0;
int32 playingMode = 0;
int64 playlistFrame = 0;
switch (err) {
case B_OK: {
@ -645,7 +644,6 @@ VideoProducer::_FrameGeneratorThread()
// get the times for the current and the next frame
performanceTime = fManager->TimeForFrame(fFrame);
nextPerformanceTime = fManager->TimeForFrame(fFrame + 1);
playingMode = fManager->PlayModeAtFrame(fFrame);
waitUntil = TimeSource()->RealTimeFor(fPerformanceTimeBase
+ performanceTime, fBufferLatency);
nextWaitUntil = TimeSource()->RealTimeFor(fPerformanceTimeBase

View File

@ -218,17 +218,12 @@ PoorManPreferencesWindow::SelectWebDir(BMessage * message)
const char * name;
BPath path;
BEntry entry;
status_t err = B_OK;
err = message->FindRef("refs", &ref) != B_OK;
//if (err = message->FindRef("directory", &ref) != B_OK)
//return err;
err = message->FindString("name", &name) != B_OK;
//if (err = message->FindString("name", &name) != B_OK)
// ;//return err;
err = entry.SetTo(&ref) != B_OK;
//if (err = entry.SetTo(&ref) != B_OK)
// ;//return err;
if (message->FindRef("refs", &ref) != B_OK
|| message->FindString("name", &name) != B_OK
|| entry.SetTo(&ref) != B_OK) {
return;
}
entry.GetPath(&path);
PRINT(("DIR: %s\n", path.Path()));

View File

@ -350,25 +350,19 @@ cleanup: ;
status_t PoorManServer::_HandleGet(httpd_conn* hc)
{
PRINT(("HandleGet() called\n"));
off_t length;
ssize_t bytesRead;
uint8* buf;
BString log;
BFile file(hc->expnfilename, B_READ_ONLY);
if (file.InitCheck() != B_OK)
return B_ERROR;
buf = new uint8[POOR_MAN_BUF_SIZE];
if (buf == NULL)
return B_ERROR;
if (hc->got_range == 1)
length = hc->last_byte_index + 1 - hc->first_byte_index;
else
length = hc->sb.st_size;
static_cast<PoorManApplication*>(be_app)->GetPoorManWindow()->SetHits(
static_cast<PoorManApplication*>(be_app)->
GetPoorManWindow()->GetHits() + 1);

View File

@ -89,14 +89,13 @@ Preferences::~Preferences()
{
if (fSavePreferences) {
BFile file;
status_t set = B_ERROR;
if (fSettingsFile)
file.SetTo(fSettingsFile, B_READ_WRITE | B_CREATE_FILE | B_ERASE_FILE);
else {
BPath prefpath;
if (find_directory(B_USER_SETTINGS_DIRECTORY, &prefpath, true) == B_OK) {
BDirectory prefdir(prefpath.Path());
set = prefdir.CreateFile(fName, &file, false);
prefdir.CreateFile(fName, &file, false);
}
}

View File

@ -731,7 +731,7 @@ Scaler::Dither(int32 fromRow, int32 toRow)
{
BBitmap* src;
BBitmap* dest;
intType destW, destH;
intType destW;
intType x, y;
uchar* srcBits;
@ -759,7 +759,6 @@ Scaler::Dither(int32 fromRow, int32 toRow)
ASSERT(src->Bounds().IntegerHeight() == dest->Bounds().IntegerHeight());
destW = dest->Bounds().IntegerWidth();
destH = dest->Bounds().IntegerHeight();
srcBits = (uchar*)src->Bits();
srcBPR = src->BytesPerRow();

View File

@ -380,12 +380,10 @@ AppearancePrefView::_SetCurrentColorSchema(BMenuField* field)
schemas++;
}
bool found = false;
for (int32 i = 0; i < fColorSchemaField->Menu()->CountItems(); i++) {
BMenuItem* item = fColorSchemaField->Menu()->ItemAt(i);
if (!strcmp(item->Label(), currentSchemaName)) {
item->SetMarked(true);
found = true;
break;
}
}

View File

@ -361,7 +361,7 @@ TermParse::EscParse()
{
int top;
int bottom;
int cs96 = 0;
// int cs96 = 0;
uchar curess = 0;
char cbuf[4] = { 0 };
@ -586,7 +586,7 @@ TermParse::EscParse()
case CASE_GSETS:
/* ESC $ ? */
parsestate = gCS96GroundTable;
cs96 = 1;
// cs96 = 1;
break;
case CASE_SCS_STATE:

View File

@ -112,11 +112,9 @@ main(int argc, char **argv)
}
strcat(path, "/time_dststatus");
bool newFile = false;
bool dst = false;
int fd = open(path, O_RDWR | O_EXCL | O_CREAT, S_IRUSR | S_IWUSR);
if (fd < 0) {
newFile = false;
fd = open(path, O_RDWR);
if (fd < 0) {
perror("couldn't open dst status settings file");

View File

@ -310,7 +310,6 @@ print_error(char *number)
if (end[0]) {
// not a number, check names
int i;
struct error_pair *p = kErrorNames;
while (p->name && strcmp(p->name, number))
p++;

View File

@ -174,7 +174,7 @@ main(int argc, char **argv)
switch (mode) {
case kList:
if ((id != -1 && id != info.team)
|| pattern != NULL && !strstr(info.args, pattern))
|| (pattern != NULL && !strstr(info.args, pattern)))
continue;
print_fds(info);
break;

View File

@ -121,24 +121,20 @@ BSoundPlayer::~BSoundPlayer()
// nodes that we're using. We *are* supposed to do that even for global
// nodes like the Mixer.
err = roster->Disconnect(fMediaOutput, fMediaInput);
#if DEBUG > 0
if (err != B_OK) {
TRACE("BSoundPlayer::~BSoundPlayer: Error disconnecting nodes: "
"%ld (%s)\n", err, strerror(err));
}
#endif
}
if ((fFlags & F_MUST_RELEASE_MIXER) != 0) {
// Release the mixer as it was acquired
// through BMediaRoster::GetAudioMixer()
err = roster->ReleaseNode(fMediaInput.node);
#if DEBUG > 0
if (err != B_OK) {
TRACE("BSoundPlayer::~BSoundPlayer: Error releasing input node: "
"%ld (%s)\n", err, strerror(err));
}
#endif
}
cleanup:

View File

@ -870,7 +870,6 @@ MoveTask(BObjectList<entry_ref> *srcList, BEntry *destEntry, BList *pointList,
StatStruct deststat;
BVolume volume(srcVolumeDevice);
entry_ref destRef;
const entry_ref *destRefToCheck = NULL;
bool destIsTrash = false;
BDirectory destDir;
@ -885,7 +884,6 @@ MoveTask(BObjectList<entry_ref> *srcList, BEntry *destEntry, BList *pointList,
// if we're not passed a destEntry then we are supposed to move to trash
if (destEntry != NULL) {
destEntry->GetRef(&destRef);
destRefToCheck = &destRef;
destDir.SetTo(destEntry);
destDir.GetStat(&deststat);
@ -913,7 +911,6 @@ MoveTask(BObjectList<entry_ref> *srcList, BEntry *destEntry, BList *pointList,
destDirToCheck = &destDir;
entry.GetRef(&destRef);
destRefToCheck = &destRef;
}
// change the move mode if needed

View File

@ -433,10 +433,12 @@ FindWindow::SaveQueryAsAttributes(BNode *file, BEntry *entry, bool queryTemplate
ssize_t size = message.FlattenedSize();
BString buffer;
status_t result = message.Flatten(buffer.LockBuffer(size), size);
ASSERT(result == B_OK);
result = file->WriteAttr(kAttrQueryVolume, B_MESSAGE_TYPE, 0,
buffer.String(), (size_t)size);
ASSERT(result == size);
if (result == B_OK) {
if (file->WriteAttr(kAttrQueryVolume, B_MESSAGE_TYPE, 0,
buffer.String(), (size_t)size) != size) {
return B_IO_ERROR;
}
}
buffer.UnlockBuffer();
}
// default to query for everything
@ -2068,10 +2070,10 @@ FindPanel::SaveWindowState(BNode *node, bool editTemplate)
ssize_t size = message.FlattenedSize();
char *buffer = new char[size];
status_t result = message.Flatten(buffer, size);
ASSERT(result == B_OK);
result = node->WriteAttr(kAttrQueryInitialAttrs, B_MESSAGE_TYPE, 0,
buffer, (size_t)size);
ASSERT(result == size);
if (result == B_OK) {
node->WriteAttr(kAttrQueryInitialAttrs, B_MESSAGE_TYPE, 0,
buffer, (size_t)size);
}
delete [] buffer;
}
break;

View File

@ -190,10 +190,8 @@ MountMenu::AddDynamicItem(add_state)
// by the autoMounter because they do not show up in the /dev tree
BVolumeRoster volumeRoster;
BVolume volume;
bool needSeparator = false;
while (volumeRoster.GetNextVolume(&volume) == B_OK) {
if (volume.IsShared()) {
needSeparator = true;
BBitmap *icon = new BBitmap(BRect(0, 0, 15, 15), B_CMAP8);
fs_info info;
if (fs_stat_dev(volume.Device(), &info) != B_OK) {

View File

@ -592,7 +592,6 @@ AddOneRefSignatures(const entry_ref *ref, void *castToIterator)
// if model is of unknown type, try mimeseting it first
model.Mimeset(true);
bool preferredAppFromNode = false;
entry_ref preferredRef;
// add preferred app for file, if any
@ -600,7 +599,6 @@ AddOneRefSignatures(const entry_ref *ref, void *castToIterator)
// got one, mark it as preferred for this node
if (be_roster->FindApp(model.PreferredAppSignature(), &preferredRef) == B_OK) {
queryIterator->PushUniqueSignature(model.PreferredAppSignature());
preferredAppFromNode = true;
queryIterator->TrySettingPreferredAppForFile(&preferredRef);
}
}

View File

@ -284,11 +284,11 @@ BRecentItemsList::GetNextMenuItem(const BMessage *fileOpenInvokeMessage,
// open the model, if it ain't open already
PoseInfo poseInfo;
ssize_t size = -1;
if (result->Node())
size = result->Node()->ReadAttr(kAttrPoseInfo, B_RAW_TYPE, 0,
if (result->Node()) {
result->Node()->ReadAttr(kAttrPoseInfo, B_RAW_TYPE, 0,
&poseInfo, sizeof(poseInfo));
}
result->CloseNode();

View File

@ -320,12 +320,12 @@ BSlowContextMenu::AddNextItem()
return true;
}
ssize_t size = -1;
PoseInfo poseInfo;
if (model.Node())
size = model.Node()->ReadAttr(kAttrPoseInfo, B_RAW_TYPE, 0,
if (model.Node()) {
model.Node()->ReadAttr(kAttrPoseInfo, B_RAW_TYPE, 0,
&poseInfo, sizeof(poseInfo));
}
model.CloseNode();
@ -384,11 +384,11 @@ BSlowContextMenu::NewModelItem(Model *model, const BMessage *invokeMessage,
// open the model, if it ain't open already
PoseInfo poseInfo;
ssize_t size = -1;
if (result->Node())
size = result->Node()->ReadAttr(kAttrPoseInfo, B_RAW_TYPE, 0,
if (result->Node()) {
result->Node()->ReadAttr(kAttrPoseInfo, B_RAW_TYPE, 0,
&poseInfo, sizeof(poseInfo));
}
result->CloseNode();

View File

@ -544,8 +544,8 @@ TTracker::InstallIndices()
void
TTracker::InstallIndices(dev_t device)
{
status_t error = fs_create_index(device, kAttrQueryLastChange, B_INT32_TYPE, 0);
error = fs_create_index(device, "_trk/recentQuery", B_INT32_TYPE, 0);
fs_create_index(device, kAttrQueryLastChange, B_INT32_TYPE, 0);
fs_create_index(device, "_trk/recentQuery", B_INT32_TYPE, 0);
}

View File

@ -538,7 +538,6 @@ void CLVColumnLabelView::ShiftDragGroup(int32 NewPos)
int32 NumberOfGroups = fDragGroups.CountItems();
int32 GroupCounter;
CLVDragGroup* ThisGroup;
int32 NumberOfColumnsInGroup;
int32 ColumnCounter;
BList NewDisplayList;
@ -548,8 +547,6 @@ void CLVColumnLabelView::ShiftDragGroup(int32 NewPos)
if(GroupCounter != fDragGroup)
{
ThisGroup = (CLVDragGroup*)fDragGroups.ItemAt(GroupCounter);
NumberOfColumnsInGroup = ThisGroup->GroupStopDispListIndex -
ThisGroup->GroupStartDispListIndex + 1;
for(ColumnCounter = ThisGroup->GroupStartDispListIndex; ColumnCounter <=
ThisGroup->GroupStopDispListIndex; ColumnCounter++)
NewDisplayList.AddItem(fDisplayList->ItemAt(ColumnCounter));
@ -557,7 +554,6 @@ void CLVColumnLabelView::ShiftDragGroup(int32 NewPos)
}
//Copy the group into the new position
ThisGroup = (CLVDragGroup*)fDragGroups.ItemAt(fDragGroup);
NumberOfColumnsInGroup = ThisGroup->GroupStopDispListIndex - ThisGroup->GroupStartDispListIndex + 1;
for(ColumnCounter = ThisGroup->GroupStartDispListIndex; ColumnCounter <=
ThisGroup->GroupStopDispListIndex; ColumnCounter++)
NewDisplayList.AddItem(fDisplayList->ItemAt(ColumnCounter));
@ -567,8 +563,6 @@ void CLVColumnLabelView::ShiftDragGroup(int32 NewPos)
if(GroupCounter != fDragGroup)
{
ThisGroup = (CLVDragGroup*)fDragGroups.ItemAt(GroupCounter);
NumberOfColumnsInGroup = ThisGroup->GroupStopDispListIndex -
ThisGroup->GroupStartDispListIndex + 1;
for(ColumnCounter = ThisGroup->GroupStartDispListIndex; ColumnCounter <=
ThisGroup->GroupStopDispListIndex; ColumnCounter++)
NewDisplayList.AddItem(fDisplayList->ItemAt(ColumnCounter));

View File

@ -17,6 +17,7 @@
pixel32 _p; \
_p.data32 = *(uint32*)d; \
BLEND(d, 255 - _p.data8[2], 255 - _p.data8[1], 255 - _p.data8[0], a); \
(void)_p; \
}
// ASSIGN_INVERT

View File

@ -20,6 +20,7 @@
_p.data32 = *(uint32*)d; \
BLEND_SUBPIX(d, 255 - _p.data8[2], 255 - _p.data8[1], 255 - _p.data8[0], \
a1, a2, a3); \
(void)_p; \
}

View File

@ -211,7 +211,7 @@ GlyphLayoutEngine::LayoutGlyphs(GlyphConsumer& consumer,
double advanceX = 0.0;
double advanceY = 0.0;
uint32 lastCharCode = 0;
// uint32 lastCharCode = 0;
uint32 charCode;
int32 index = 0;
bool writeLocked = false;
@ -268,7 +268,7 @@ GlyphLayoutEngine::LayoutGlyphs(GlyphConsumer& consumer,
advanceY = glyph->advance_y;
}
lastCharCode = charCode;
// lastCharCode = charCode;
if (utf8String - start + 1 > length)
break;
}

View File

@ -45,7 +45,6 @@ AppGroupView::Draw(BRect updateRect)
rgb_color menuColor = ViewColor();
BRect bounds = Bounds();
rgb_color hilite = tint_color(menuColor, B_DARKEN_1_TINT);
rgb_color dark = tint_color(menuColor, B_DARKEN_2_TINT);
rgb_color vlight = tint_color(menuColor, B_LIGHTEN_2_TINT);
bounds.bottom = bounds.top + kHeaderSize;