From 154cc439827fd95ae3757ebe1e032c4bba288cc2 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 8 Oct 2003 18:15:14 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=2423 --- api/boinc_api.C | 4 ++-- api/gutil.C | 11 +++++++---- api/gutil.h | 1 + checkin_notes | 16 ++++++++++++++++ client/win/wingui_mainwindow.cpp | 2 +- client/win/wingui_piectrl.cpp | 2 +- lib/util.C | 4 ++-- lib/util.h | 4 ++-- 8 files changed, 32 insertions(+), 12 deletions(-) diff --git a/api/boinc_api.C b/api/boinc_api.C index 97ed8df1a5..e3925efc2d 100644 --- a/api/boinc_api.C +++ b/api/boinc_api.C @@ -322,8 +322,8 @@ int boinc_child_done(double cpu) { int boinc_cpu_time(double &cpu_t, double &ws_t) { double cpu_secs; - // Start with the CPU time from previous runs, then - // add the CPU time of the current run + // Start with the CPU time from previous runs, + // then add the CPU time of the current run cpu_secs = aid.wu_cpu_time; #ifdef HAVE_SYS_RESOURCE_H diff --git a/api/gutil.C b/api/gutil.C index a0bc7b6467..61e050c962 100755 --- a/api/gutil.C +++ b/api/gutil.C @@ -1059,20 +1059,23 @@ static int getFileType(char* file) { } int create_texture(char* filename, TEXTURE_DESC& td) { + int retval=-1; + switch (getFileType(filename)) { case IMAGE_TYPE_JPG: - return CreateTextureJPG(filename, td); + retval = CreateTextureJPG(filename, td); break; case IMAGE_TYPE_PPM: - return CreateTexturePPM(filename, td); + retval = CreateTexturePPM(filename, td); break; case IMAGE_TYPE_BMP: - return CreateTextureBMP(filename, td); + retval = CreateTextureBMP(filename, td); break; case IMAGE_TYPE_TGA: - return CreateTextureTGA(filename, td); + retval = CreateTextureTGA(filename, td); break; } + if (!retval) td.present = true; return -1; } diff --git a/api/gutil.h b/api/gutil.h index 751ea20111..c338cc4baf 100755 --- a/api/gutil.h +++ b/api/gutil.h @@ -149,6 +149,7 @@ extern void replaceStar(Star* tmpStar); #define IMAGE_TYPE_TGA 3 struct TEXTURE_DESC { + bool present; unsigned int id; double xsize; // size of underlying image double ysize; diff --git a/checkin_notes b/checkin_notes index 0a9c9d68f1..4322475c4e 100755 --- a/checkin_notes +++ b/checkin_notes @@ -6591,3 +6591,19 @@ David Oct 6 2003 sched/ wu_check.C + +David Oct 8 2003 + - added "present" flag to TEXTURE_DESC + - fixed function names: + double_to_ydhms() -> ndays_to_string() + get_byte_string -> nbytes_to_string() + + api/ + boinc_api.C + gutil.C,h + client/ + win/ + wingui_mainwindow.cpp + wingui_piecectrl.cpp + lib/ + util.C,h \ No newline at end of file diff --git a/client/win/wingui_mainwindow.cpp b/client/win/wingui_mainwindow.cpp index ba782366da..9a2ba39df5 100755 --- a/client/win/wingui_mainwindow.cpp +++ b/client/win/wingui_mainwindow.cpp @@ -494,7 +494,7 @@ void CMainWindow::UpdateGUI(CLIENT_STATE* pcs) // size char size_buf[256]; - get_byte_string(xSent, pfx->fip->nbytes, size_buf, 256); + nbytes_to_string(xSent, pfx->fip->nbytes, size_buf, 256); if (strcmp(m_XferListCtrl.GetItemText(i, 3).GetBuffer(0), size_buf)) m_XferListCtrl.SetItemText(i, 3, size_buf); diff --git a/client/win/wingui_piectrl.cpp b/client/win/wingui_piectrl.cpp index a41d3f495c..e49ee7e8c6 100755 --- a/client/win/wingui_piectrl.cpp +++ b/client/win/wingui_piectrl.cpp @@ -336,7 +336,7 @@ void CPieChartCtrl::OnPaint() MemDC.LineTo(textrect.left, textrect.top); textrect.SetRect(PIE_BUFFER + 16, PIE_BUFFER + i * 20, wndrect.Width() - PIE_BUFFER, PIE_BUFFER + 20 + i * 20); char size_buf[256]; - get_byte_string(m_xValues.GetAt(i), 0, size_buf, 256); + nbytes_to_string(m_xValues.GetAt(i), 0, size_buf, 256); CString strBuf; strBuf.Format("%s (%s)", m_strLabels.GetAt(i).GetBuffer(0), size_buf); MemDC.DrawText(strBuf, textrect, DT_SINGLELINE|DT_VCENTER|DT_LEFT|DT_END_ELLIPSIS); diff --git a/lib/util.C b/lib/util.C index fcfd576697..fe86cff2bd 100755 --- a/lib/util.C +++ b/lib/util.C @@ -52,7 +52,7 @@ using std::min; // unit of time division used // smallest_timescale: 0=seconds, 1=minutes, 2=hours, 3=days, 4=years // -int double_to_ydhms (double x, int smallest_timescale, char *buf) { +int ndays_to_string (double x, int smallest_timescale, char *buf) { double years, days, hours, minutes, seconds; char year_buf[64], day_buf[16], hour_buf[16], min_buf[16], sec_buf[16]; @@ -114,7 +114,7 @@ int double_to_ydhms (double x, int smallest_timescale, char *buf) { // Convert nbytes into a string. If total_bytes is non-zero, // convert the two into a fractional display (i.e. 4/16 KB) // -void get_byte_string(double nbytes, double total_bytes, char* str, int len) { +void nbytes_to_string(double nbytes, double total_bytes, char* str, int len) { char buf[256]; double xTera = (1024.0*1024.0*1024.0*1024.0); double xGiga = (1024.0*1024.0*1024.0); diff --git a/lib/util.h b/lib/util.h index 8ee30af63b..dea729dd1c 100755 --- a/lib/util.h +++ b/lib/util.h @@ -32,8 +32,8 @@ using std::string; -extern int double_to_ydhms (double x, int smallest_timescale, char *buf); -extern void get_byte_string(double nbytes, double total_bytes, char* str, int len); +extern int ndays_to_string(double x, int smallest_timescale, char *buf); +extern void nbytes_to_string(double nbytes, double total_bytes, char* str, int len); extern double dtime(); extern void boinc_sleep(double); extern int parse_command_line( char *, char ** );