Fix warnings of class or global variables shadowed by local variables or arguments

This commit is contained in:
Charlie Fenton 2013-07-29 01:31:09 -07:00
parent ae2c9c8863
commit 7d372d2803
12 changed files with 97 additions and 97 deletions

View File

@ -1166,7 +1166,7 @@ union headeru {
//
int ACTIVE_TASK::is_native_i386_app(char* exec_path) {
FILE *f;
int result = 0;
int retval = 0;
headeru myHeader;
fat_arch fatHeader;
@ -1177,7 +1177,7 @@ int ACTIVE_TASK::is_native_i386_app(char* exec_path) {
f = boinc_fopen(exec_path, "rb");
if (!f) {
return result; // Should never happen
return retval; // Should never happen
}
myHeader.fat.magic = 0;
@ -1195,7 +1195,7 @@ int ACTIVE_TASK::is_native_i386_app(char* exec_path) {
theType = OSSwapInt32(theType);
}
if ((theType == CPU_TYPE_I386) || (theType == CPU_TYPE_X86_64)) {
result = 1; // Single-architecture i386or x86_64 file
retval = 1; // Single-architecture i386or x86_64 file
}
break;
case FAT_MAGIC:
@ -1215,7 +1215,7 @@ int ACTIVE_TASK::is_native_i386_app(char* exec_path) {
theType = OSSwapInt32(theType);
}
if ((theType == CPU_TYPE_I386) || (theType == CPU_TYPE_X86_64)) {
result = 1;
retval = 1;
break;
}
}
@ -1225,7 +1225,7 @@ int ACTIVE_TASK::is_native_i386_app(char* exec_path) {
}
fclose (f);
return result;
return retval;
}
#endif

View File

@ -511,9 +511,9 @@ void CAccountInfoPage::OnPageChanged( wxWizardExEvent& event ) {
}
if (pc.min_passwd_length) {
wxString str;
wxString str2;
str.Printf(_("minimum length %d"), pc.min_passwd_length);
m_pAccountPasswordRequirmentsStaticCtrl->SetLabel( str );
m_pAccountPasswordRequirmentsStaticCtrl->SetLabel( str2 );
}

View File

@ -1186,19 +1186,19 @@ void CMainDocument::HandleCompletedRPC() {
}
int CMainDocument::CopyProjectsToStateBuffer(PROJECTS& p, CC_STATE& state) {
int CMainDocument::CopyProjectsToStateBuffer(PROJECTS& p, CC_STATE& ccstate) {
int retval = 0;
unsigned int i;
PROJECT* state_project = NULL;
// flag for delete
for (i=0; i<state.projects.size(); i++) {
state_project = state.projects[i];
for (i=0; i<ccstate.projects.size(); i++) {
state_project = ccstate.projects[i];
state_project->flag_for_delete = true;
}
for (i=0; i<p.projects.size(); i++) {
state_project = state.lookup_project(p.projects[i]->master_url);
state_project = ccstate.lookup_project(p.projects[i]->master_url);
if (state_project && (!strcmp(p.projects[i]->master_url, state_project->master_url))) {
// Because the CC_STATE contains several pointers to each element of the
// CC_STATE::projects vector, we must update these elements in place.
@ -1212,8 +1212,8 @@ int CMainDocument::CopyProjectsToStateBuffer(PROJECTS& p, CC_STATE& state) {
// Anything need to be deleted?
if (!retval) {
for (i=0; i<state.projects.size(); i++) {
state_project = state.projects[i];
for (i=0; i<ccstate.projects.size(); i++) {
state_project = ccstate.projects[i];
if (state_project->flag_for_delete) {
retval = ERR_FILE_MISSING;
}

View File

@ -446,9 +446,9 @@ void CBOINCClientManager::KillClient() {
PROC_MAP::iterator i;
for (i=pm.begin(); i!=pm.end(); i++) {
PROCINFO& pi = i->second;
if (!strcmp(pi.command, "boinc")) {
kill_program(pi.id);
PROCINFO& procinfo = i->second;
if (!strcmp(procinfo.command, "boinc")) {
kill_program(procinfo.id);
break;
}
}

View File

@ -1192,9 +1192,9 @@ int CBOINCGUIApp::IsAnotherInstanceRunning() {
myName[0] = 0;
PROC_MAP::iterator i;
for (i=pm.begin(); i!=pm.end(); i++) {
PROCINFO& pi = i->second;
if (pi.id == myPid) {
strncpy(myName, pi.command, sizeof(myName));
PROCINFO& procinfo = i->second;
if (procinfo.id == myPid) {
strncpy(myName, procinfo.command, sizeof(myName));
break;
}
}
@ -1205,10 +1205,10 @@ int CBOINCGUIApp::IsAnotherInstanceRunning() {
// Search process list for other applications with same name
for (i=pm.begin(); i!=pm.end(); i++) {
PROCINFO& pi = i->second;
if (pi.id == myPid) continue;
if (!strcmp(pi.command, myName)) {
otherInstanceID = pi.id;
PROCINFO& procinfo = i->second;
if (procinfo.id == myPid) continue;
if (!strcmp(procinfo.command, myName)) {
otherInstanceID = procinfo.id;
break;
}
}

View File

@ -1773,11 +1773,11 @@ int CMainDocument::WorkShowGraphics(RESULT* rp) {
}
int CMainDocument::WorkShowVMConsole(RESULT* result) {
int CMainDocument::WorkShowVMConsole(RESULT* res) {
int iRetVal = 0;
if (strlen(result->remote_desktop_addr)) {
wxString strConnection(result->remote_desktop_addr, wxConvUTF8);
if (strlen(res->remote_desktop_addr)) {
wxString strConnection(res->remote_desktop_addr, wxConvUTF8);
wxString strCommand;
#if defined(__WXMSW__)
@ -1788,16 +1788,16 @@ int CMainDocument::WorkShowVMConsole(RESULT* result) {
wxExecute(strCommand);
#elif defined(__WXMAC__)
FSRef theFSRef;
OSStatus status = noErr;
OSStatus err = noErr;
// I have found no reliable way to pass the IP address and port to Microsoft's
// Remote Desktop Connection application for the Mac, so I'm using CoRD.
// Unfortunately, CoRD does not seem as reliable as I would like either.
//
// First try to find the CoRD application by Bundle ID and Creator Code
status = LSFindApplicationForInfo('RDC#', CFSTR("net.sf.cord"),
err = LSFindApplicationForInfo('RDC#', CFSTR("net.sf.cord"),
NULL, &theFSRef, NULL);
if (status != noErr) {
if (err != noErr) {
CBOINCBaseFrame* pFrame = wxGetApp().GetFrame();
if (pFrame) {
pFrame->ShowAlert(

View File

@ -813,12 +813,12 @@ void CPaintStatistics::DrawAxis(wxDC &dc, const double max_val_y, const double m
dc.DestroyClippingRegion();
}
//----Draw graph----
void CPaintStatistics::DrawGraph(wxDC &dc, std::vector<PROJECT*>::const_iterator &i, const wxColour graphColour, const int typePoint, const int m_SelectedStatistic) {
void CPaintStatistics::DrawGraph(wxDC &dc, std::vector<PROJECT*>::const_iterator &i, const wxColour graphColour, const int typePoint, const int selectedStatistic) {
std::vector<DAILY_STATS> stats = (*i)->statistics;
DrawGraph2(dc, stats, graphColour, typePoint, m_SelectedStatistic);
DrawGraph2(dc, stats, graphColour, typePoint, selectedStatistic);
}
void CPaintStatistics::DrawGraph2(wxDC &dc, std::vector<DAILY_STATS> stats, const wxColour graphColour, const int typePoint, const int m_SelectedStatistic) {
void CPaintStatistics::DrawGraph2(wxDC &dc, std::vector<DAILY_STATS> stats, const wxColour graphColour, const int typePoint, const int selectedStatistic) {
wxCoord x0 = wxCoord(m_Graph_X_start);
wxCoord y0 = wxCoord(m_Graph_Y_start);
wxCoord w0 = wxCoord(m_Graph_X_end - m_Graph_X_start);
@ -870,7 +870,7 @@ void CPaintStatistics::DrawGraph2(wxDC &dc, std::vector<DAILY_STATS> stats, cons
b_point2 = false;
d_xpos = (m_Ax_ValToCoord * j->day + m_Bx_ValToCoord);// äîáàâèòü îêðóãëåíèå
switch (m_SelectedStatistic){ // äîáàâèòü îêðóãëåíèå
switch (selectedStatistic){ // äîáàâèòü îêðóãëåíèå
case show_user_total: d_ypos = (m_Ay_ValToCoord * j->user_total_credit + m_By_ValToCoord); break;
case show_user_average: d_ypos = (m_Ay_ValToCoord * j->user_expavg_credit + m_By_ValToCoord); break;
case show_host_total: d_ypos = (m_Ay_ValToCoord * j->host_total_credit + m_By_ValToCoord); break;

View File

@ -443,7 +443,7 @@ int CScreensaver::getSSMessage(char **theMessage, int* coveredFreq) {
int newFrequency = TEXTLOGOFREQUENCY;
*coveredFreq = 0;
pid_t myPid;
CC_STATE state;
CC_STATE ccstate;
OSStatus err;
if (ScreenIsBlanked) {
@ -472,11 +472,11 @@ int CScreensaver::getSSMessage(char **theMessage, int* coveredFreq) {
if (!rpc->init(NULL)) { // Initialize communications with Core Client
m_bConnected = true;
if (IsDualGPUMacbook) {
state.clear();
state.global_prefs.clear_bools();
int result = rpc->get_state(state);
ccstate.clear();
ccstate.global_prefs.clear_bools();
int result = rpc->get_state(ccstate);
if (!result) {
OKToRunOnBatteries = state.global_prefs.run_on_batteries;
OKToRunOnBatteries = ccstate.global_prefs.run_on_batteries;
} else {
OKToRunOnBatteries = false;
}

View File

@ -82,22 +82,22 @@ bool CScreensaver::is_same_task(RESULT* taska, RESULT* taskb) {
return true;
}
int CScreensaver::count_active_graphic_apps(RESULTS& results, RESULT* exclude) {
int CScreensaver::count_active_graphic_apps(RESULTS& res, RESULT* exclude) {
unsigned int i = 0;
unsigned int graphics_app_count = 0;
// Count the number of active graphics-capable apps excluding the specified result.
// If exclude is NULL, don't exclude any results.
//
for (i = 0; i < results.results.size(); i++) {
for (i = 0; i < res.results.size(); i++) {
BOINCTRACE(_T("get_random_graphics_app -- active task detected\n"));
BOINCTRACE(
_T("get_random_graphics_app -- name = '%s', path = '%s'\n"),
results.results[i]->name, results.results[i]->graphics_exec_path
res.results[i]->name, res.results[i]->graphics_exec_path
);
if (!strlen(results.results[i]->graphics_exec_path)) continue;
if (is_same_task(results.results[i], exclude)) continue;
if (!strlen(res.results[i]->graphics_exec_path)) continue;
if (is_same_task(res.results[i], exclude)) continue;
BOINCTRACE(_T("get_random_graphics_app -- active task detected w/graphics\n"));
graphics_app_count++;
@ -111,7 +111,7 @@ int CScreensaver::count_active_graphic_apps(RESULTS& results, RESULT* exclude) {
// If exclude is NULL or an empty string, don't exclude any results.
//
RESULT* CScreensaver::get_random_graphics_app(
RESULTS& results, RESULT* exclude
RESULTS& res, RESULT* exclude
) {
RESULT* rp = NULL;
unsigned int i = 0;
@ -122,13 +122,13 @@ RESULT* CScreensaver::get_random_graphics_app(
BOINCTRACE(_T("get_random_graphics_app -- Function Start\n"));
graphics_app_count = count_active_graphic_apps(results, avoid);
graphics_app_count = count_active_graphic_apps(res, avoid);
BOINCTRACE(_T("get_random_graphics_app -- graphics_app_count = '%d'\n"), graphics_app_count);
// If no graphics app found other than the one excluded, count again without excluding any
if ((0 == graphics_app_count) && (avoid != NULL)) {
avoid = NULL;
graphics_app_count = count_active_graphic_apps(results, avoid);
graphics_app_count = count_active_graphic_apps(res, avoid);
}
// If no graphics app was found, return NULL
@ -143,13 +143,13 @@ RESULT* CScreensaver::get_random_graphics_app(
// find the chosen graphics application.
//
for (i = 0; i < results.results.size(); i++) {
if (!strlen(results.results[i]->graphics_exec_path)) continue;
if (is_same_task(results.results[i], avoid)) continue;
for (i = 0; i < res.results.size(); i++) {
if (!strlen(res.results[i]->graphics_exec_path)) continue;
if (is_same_task(res.results[i], avoid)) continue;
current_counter++;
if (current_counter == random_selection) {
rp = results.results[i];
rp = res.results[i];
break;
}
}

View File

@ -1913,7 +1913,7 @@ int RPC_CLIENT::run_benchmarks() {
return rpc.parse_reply();
}
int RPC_CLIENT::set_proxy_settings(GR_PROXY_INFO& pi) {
int RPC_CLIENT::set_proxy_settings(GR_PROXY_INFO& procinfo) {
int retval;
SET_LOCALE sl;
char buf[1792];
@ -1934,18 +1934,18 @@ int RPC_CLIENT::set_proxy_settings(GR_PROXY_INFO& pi) {
" <no_proxy>%s</no_proxy>\n"
" </proxy_info>\n"
"</set_proxy_settings>\n",
pi.use_http_proxy?" <use_http_proxy/>\n":"",
pi.use_socks_proxy?" <use_socks_proxy/>\n":"",
pi.use_http_authentication?" <use_http_auth/>\n":"",
pi.http_server_name.c_str(),
pi.http_server_port,
pi.http_user_name.c_str(),
pi.http_user_passwd.c_str(),
pi.socks_server_name.c_str(),
pi.socks_server_port,
pi.socks5_user_name.c_str(),
pi.socks5_user_passwd.c_str(),
pi.noproxy_hosts.c_str()
procinfo.use_http_proxy?" <use_http_proxy/>\n":"",
procinfo.use_socks_proxy?" <use_socks_proxy/>\n":"",
procinfo.use_http_authentication?" <use_http_auth/>\n":"",
procinfo.http_server_name.c_str(),
procinfo.http_server_port,
procinfo.http_user_name.c_str(),
procinfo.http_user_passwd.c_str(),
procinfo.socks_server_name.c_str(),
procinfo.socks_server_port,
procinfo.socks5_user_name.c_str(),
procinfo.socks5_user_passwd.c_str(),
procinfo.noproxy_hosts.c_str()
);
buf[sizeof(buf)-1] = 0;
retval = rpc.do_rpc(buf);

View File

@ -39,7 +39,7 @@ using std::vector;
// Scan the process table adding in CPU time and mem usage.
//
void add_child_totals(PROCINFO& pi, PROC_MAP& pm, PROC_MAP::iterator i) {
void add_child_totals(PROCINFO& procinfo, PROC_MAP& pm, PROC_MAP::iterator i) {
PROCINFO parent = i->second;
for (unsigned int j=0; j<parent.children.size(); j++) {
int child_pid = parent.children[j];
@ -49,20 +49,20 @@ void add_child_totals(PROCINFO& pi, PROC_MAP& pm, PROC_MAP::iterator i) {
if (p.scanned) {
return; // cycle in graph - shouldn't happen
}
pi.kernel_time += p.kernel_time;
pi.user_time += p.user_time;
procinfo.kernel_time += p.kernel_time;
procinfo.user_time += p.user_time;
p.scanned = true;
// only count process with most swap and memory
if (p.swap_size > pi.swap_size) {
pi.swap_size = p.swap_size;
if (p.swap_size > procinfo.swap_size) {
procinfo.swap_size = p.swap_size;
}
if (p.working_set_size > pi.working_set_size) {
pi.working_set_size = p.working_set_size;
if (p.working_set_size > procinfo.working_set_size) {
procinfo.working_set_size = p.working_set_size;
}
p.is_boinc_app = true;
add_child_totals(pi, pm, i2); // recursion - woo hoo!
add_child_totals(procinfo, pm, i2); // recursion - woo hoo!
}
}
@ -71,24 +71,24 @@ void add_child_totals(PROCINFO& pi, PROC_MAP& pm, PROC_MAP::iterator i) {
// Set PROCINFO.is_boinc_app for all of them.
//
void procinfo_app(
PROCINFO& pi, vector<int>* other_pids, PROC_MAP& pm, char* graphics_exec_file
PROCINFO& procinfo, vector<int>* other_pids, PROC_MAP& pm, char* graphics_exec_file
) {
PROC_MAP::iterator i;
for (i=pm.begin(); i!=pm.end(); i++) {
PROCINFO& p = i->second;
if (p.id == pi.id
if (p.id == procinfo.id
|| (other_pids && in_vector(p.id, *other_pids))
) {
pi.kernel_time += p.kernel_time;
pi.user_time += p.user_time;
pi.swap_size += p.swap_size;
pi.working_set_size += p.working_set_size;
procinfo.kernel_time += p.kernel_time;
procinfo.user_time += p.user_time;
procinfo.swap_size += p.swap_size;
procinfo.working_set_size += p.working_set_size;
p.is_boinc_app = true;
p.scanned = true;
// look for child processes
//
add_child_totals(pi, pm, i);
add_child_totals(procinfo, pm, i);
}
if (graphics_exec_file && !strcmp(p.command, graphics_exec_file)) {
p.is_boinc_app = true;
@ -108,8 +108,8 @@ void find_children(PROC_MAP& pm) {
// get resource usage of non-BOINC apps
//
void procinfo_non_boinc(PROCINFO& pi, PROC_MAP& pm) {
pi.clear();
void procinfo_non_boinc(PROCINFO& procinfo, PROC_MAP& pm) {
procinfo.clear();
PROC_MAP::iterator i;
for (i=pm.begin(); i!=pm.end(); i++) {
PROCINFO& p = i->second;
@ -131,26 +131,26 @@ void procinfo_non_boinc(PROCINFO& pi, PROC_MAP& pm) {
fprintf(stderr, "non-boinc: %s (%d) %f %f\n", p.command, p.id, p.user_time, p.kernel_time);
}
#endif
pi.kernel_time += p.kernel_time;
pi.user_time += p.user_time;
pi.swap_size += p.swap_size;
pi.working_set_size += p.working_set_size;
procinfo.kernel_time += p.kernel_time;
procinfo.user_time += p.user_time;
procinfo.swap_size += p.swap_size;
procinfo.working_set_size += p.working_set_size;
}
#if 0
fprintf(stderr, "total non-boinc: %f %f\n", pi.user_time, pi.kernel_time);
fprintf(stderr, "total non-boinc: %f %f\n", procinfo.user_time, procinfo.kernel_time);
#endif
}
double process_tree_cpu_time(int pid) {
PROC_MAP pm;
PROCINFO pi;
PROCINFO procinfo;
int retval;
retval = procinfo_setup(pm);
if (retval) return 0;
pi.clear();
pi.id = pid;
procinfo_app(pi, NULL, pm, NULL);
return pi.user_time + pi.kernel_time;
procinfo.clear();
procinfo.id = pid;
procinfo_app(procinfo, NULL, pm, NULL);
return procinfo.user_time + procinfo.kernel_time;
}

View File

@ -99,7 +99,7 @@ Boolean SetLoginItemOSAScript(long brandID, Boolean deleteLogInItem, char *userN
Boolean SetLoginItemAPI(long brandID, Boolean deleteLogInItem);
OSErr GetCurrentScreenSaverSelection(char *moduleName, size_t maxLen);
OSErr SetScreenSaverSelection(char *moduleName, char *modulePath, int type);
void SetSkinInUserPrefs(char *userName, char *skinName);
void SetSkinInUserPrefs(char *userName, char *nameOfSkin);
Boolean CheckDeleteFile(char *name);
void SetEUIDBackToUser (void);
static char * PersistentFGets(char *buf, size_t buflen, FILE *f);
@ -1022,7 +1022,7 @@ Boolean SetLoginItemAPI(long brandID, Boolean deleteLogInItem)
// Sets the skin selection in the specified user's preferences to the specified skin
void SetSkinInUserPrefs(char *userName, char *skinName)
void SetSkinInUserPrefs(char *userName, char *nameOfSkin)
{
passwd *pw;
FILE *oldPrefs, *newPrefs;
@ -1033,7 +1033,7 @@ void SetSkinInUserPrefs(char *userName, char *skinName)
group *grp;
OSStatus statErr;
if (skinName[0]) {
if (nameOfSkin[0]) {
sprintf(oldFileName, "/Users/%s/Library/Preferences/BOINC Manager Preferences", userName);
sprintf(tempFilename, "/Users/%s/Library/Preferences/BOINC Manager NewPrefs", userName);
newPrefs = fopen(tempFilename, "w");
@ -1045,7 +1045,7 @@ void SetSkinInUserPrefs(char *userName, char *skinName)
if (oldPrefs) {
while (fgets(buf, sizeof(buf), oldPrefs)) {
if (strstr(buf, "Skin=")) {
fprintf(newPrefs, "Skin=%s\n", skinName);
fprintf(newPrefs, "Skin=%s\n", nameOfSkin);
wroteSkinName = 1;
} else {
fputs(buf, newPrefs);
@ -1055,7 +1055,7 @@ void SetSkinInUserPrefs(char *userName, char *skinName)
}
if (! wroteSkinName)
fprintf(newPrefs, "Skin=%s\n", skinName);
fprintf(newPrefs, "Skin=%s\n", nameOfSkin);
fclose(newPrefs);
rename(tempFilename, oldFileName); // Deletes old file
@ -1328,8 +1328,8 @@ OSErr UpdateAllVisibleUsers(long brandID)
char *p;
int flag;
// char skinName[256];
// FindSkinName(skinName, sizeof(skinName));
// char nameOfSkin[256];
// FindSkinName(nameOfSkin, sizeof(nameOfSkin));
// Step through all users