From 1adfeadedbf349c0d38db376dbfe29e55717e09c Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Thu, 9 Feb 2017 17:10:58 +0000 Subject: [PATCH] Compiler warning fixes for MVP --- boxx.cc | 2 +- remotemvp.cc | 2 +- remotemvp.h | 2 +- surface.cc | 14 +++++++------- surfacevector.cc | 8 ++++---- vdr.cc | 2 +- vepglistadvanced.cc | 2 +- vepgsummary.cc | 2 +- vrecordinglistadvanced.cc | 2 +- vvideolivetv.cc | 8 ++++---- vvideomedia.cc | 8 ++++---- vvideorec.cc | 10 +++++----- wpictureview.cc | 6 +++--- wselectlist.cc | 10 +++++----- wtabbar.cc | 2 +- 15 files changed, 40 insertions(+), 40 deletions(-) diff --git a/boxx.cc b/boxx.cc index e6d7a61..278747a 100644 --- a/boxx.cc +++ b/boxx.cc @@ -513,7 +513,7 @@ void Boxx::drawTVMedia(TVMediaInfo & tvmedia,float x, float y, float width, flo else if (surface) { SurfaceVector * surfacevector=dynamic_cast(surface); if (surfacevector) surfacevector->drawTVMedia(tvmedia,x, y,width, height, corner); - else surface->fillblt(x, y, width, height, DrawStyle::RED); // Signal that something went wrong + else surface->fillblt((int)x, (int)y, (int)width, (int)height, DrawStyle::RED); // Signal that something went wrong } } diff --git a/remotemvp.cc b/remotemvp.cc index 2b5abdc..63d44e6 100644 --- a/remotemvp.cc +++ b/remotemvp.cc @@ -35,7 +35,7 @@ RemoteMVP::~RemoteMVP() { } -int RemoteMVP::init(char* devName) +int RemoteMVP::init(const char* devName) { if (initted) return 0; initted = 1; diff --git a/remotemvp.h b/remotemvp.h index ac510b6..ee667d0 100644 --- a/remotemvp.h +++ b/remotemvp.h @@ -34,7 +34,7 @@ class RemoteMVP : public Remote RemoteMVP(); ~RemoteMVP(); - int init(char *devName); + int init(const char *devName); int shutdown(); int getDevice(); UCHAR getButtonPress(int how); diff --git a/surface.cc b/surface.cc index bf49f0a..94647de 100644 --- a/surface.cc +++ b/surface.cc @@ -64,10 +64,10 @@ void initpol_tables(){ interpol_upbit[px]= (min((int)ceil(fposx),11)); interpol_lowbit[px]= (max((int)floor(fposx),0)); - interpol_table_fac1[px][py]=xweight*yweight*256.; - interpol_table_fac2[px][py]=xinvweight*yweight*256.; - interpol_table_fac3[px][py]=xweight*yinvweight*256.; - interpol_table_fac4[px][py]=xinvweight*yinvweight*256.; + interpol_table_fac1[px][py]=(unsigned int)(xweight*yweight*256.); + interpol_table_fac2[px][py]=(unsigned int)(xinvweight*yweight*256.); + interpol_table_fac3[px][py]=(unsigned int)(xweight*yinvweight*256.); + interpol_table_fac4[px][py]=(unsigned int)(xinvweight*yinvweight*256.); } } @@ -112,9 +112,9 @@ int Surface::drawText(const char* text, int x, int y, int width, const DrawStyle startFastDraw(); for (i=0; icontent[font->offset[c]]; - int w = font->width[c]; + unsigned char ch = text[i]; + unsigned long *character = &font->content[font->offset[ch]]; + int w = font->width[ch]; int pixels = 0; for (X=0; (XgetFontHeight(); + return (int)osd->getFontHeight(); } float SurfaceVector::getCharWidth(wchar_t c) @@ -151,7 +151,7 @@ int SurfaceVector::drawTextRJ(const char* text, int x, int y, const DrawStyle& c } delete[] temptext; #endif - return drawText(text, x-shift, y, c); + return drawText(text, (int)(x-shift), y, c); } int SurfaceVector::drawTextCentre(const char* text, int x, int y, const DrawStyle& c) @@ -183,7 +183,7 @@ int SurfaceVector::drawTextCentre(const char* text, int x, int y, const DrawStyl delete[] temptext; #endif - return drawText(text, x-shift/2., y, c); + return drawText(text, (int)(x-shift/2.), y, c); } void SurfaceVector::drawJpeg(const char *fileName,int x, int y,int *width, int *height) @@ -192,7 +192,7 @@ void SurfaceVector::drawJpeg(const char *fileName,int x, int y,int *width, int * if (strcmp(fileName,"/vdr.jpg")==0) { index=sa_vdrlogo; *height=100; // this is faked so that the system does use the old coordinate system - *width=ceil(190.f*osd->getPixelAspect()); + *width=(int)ceil(190.f*osd->getPixelAspect()); } else if (strcmp(fileName,"/wallpaperPAL.jpg")==0) { index=sa_wallpaper; *width=720; // this is faked so that the system does use the old coordinate system diff --git a/vdr.cc b/vdr.cc index 46f37b8..f39f29a 100644 --- a/vdr.cc +++ b/vdr.cc @@ -1831,7 +1831,7 @@ SeriesInfo *VDR::getScraperSeriesInfo(int seriesID, int episodeID) ULONG VDR::loadTVMedia(TVMediaInfo& tvmedia) { - +#warning VDR::loadTVMedia returns unsigned long but error return tries to return -1 VDR_RequestPacket vrp; if (!vrp.init(VDR_LOADTVMEDIA, false, 0)) return -1; diff --git a/vepglistadvanced.cc b/vepglistadvanced.cc index e7f3d4e..e65e9ac 100644 --- a/vepglistadvanced.cc +++ b/vepglistadvanced.cc @@ -79,7 +79,7 @@ VEpgListAdvanced::VEpgListAdvanced(VVideoLiveTV *tvideolive, ChannelList* tchanL epg.setBackgroundColour(DrawStyle::VIEWTRANSPARENTBACKGROUND); epgTVmedia.setPosition(epg.getRegionR().w-100-10,10); - epgTVmedia.setSize(100,150/Osd::getInstance()->getPixelAspect()); + epgTVmedia.setSize(100,(UINT)(150/Osd::getInstance()->getPixelAspect())); epg.add(&epgTVmedia); boxRed.setBackgroundColour(DrawStyle::RED); diff --git a/vepgsummary.cc b/vepgsummary.cc index 188dede..ac67c4e 100644 --- a/vepgsummary.cc +++ b/vepgsummary.cc @@ -128,7 +128,7 @@ VEpgSummary::VEpgSummary(Event *tevent, Channel* tchannel) } epgTVmedia.setPosition(summary->getRegionR().w-130-10,0); - epgTVmedia.setSize(130,195/Osd::getInstance()->getPixelAspect()); + epgTVmedia.setSize(130,(UINT)(195/Osd::getInstance()->getPixelAspect())); summary->add(&epgTVmedia); if (movieview) movieview->add(&epgTVmedia); if (seriesview) seriesview->add(&epgTVmedia); diff --git a/vrecordinglistadvanced.cc b/vrecordinglistadvanced.cc index bed9504..bfbf166 100644 --- a/vrecordinglistadvanced.cc +++ b/vrecordinglistadvanced.cc @@ -73,7 +73,7 @@ VRecordingListAdvanced::VRecordingListAdvanced() epg.setBackgroundColour(DrawStyle::VIEWBACKGROUND); epgTVmedia.setPosition(epg.getRegionR().w-100-10,10); - epgTVmedia.setSize(100,150/Osd::getInstance()->getPixelAspect()); + epgTVmedia.setSize(100,(UINT)(150/Osd::getInstance()->getPixelAspect())); epg.add(&epgTVmedia); } diff --git a/vvideolivetv.cc b/vvideolivetv.cc index 0901d0d..32dda9b 100644 --- a/vvideolivetv.cc +++ b/vvideolivetv.cc @@ -1386,10 +1386,10 @@ void VVideoLiveTV::clearOSDArea(UINT posX, UINT posY, UINT width, UINT height, c //now convert to our display float scalex=720.f/((float) (region.framewidth+1)); float scaley=576.f/((float) (region.frameheight+1)); - r.x=floor(scalex*((float)r.x)); - r.y=floor(scaley*((float)r.y)); - r.w=ceil(scalex*((float)r.w))+1.f; - r.h=ceil(scaley*((float)r.h))+1.f; + r.x = (UINT)floor(scalex*((float)r.x)); + r.y = (UINT)floor(scaley*((float)r.y)); + r.w = (UINT)(ceil(scalex*((float)r.w))+1.f); + r.h = (UINT)(ceil(scaley*((float)r.h))+1.f); rectangle(r, DrawStyle(0,0,0,0)); boxstack->update(this, &r); } diff --git a/vvideomedia.cc b/vvideomedia.cc index 5ec7882..2f7a108 100644 --- a/vvideomedia.cc +++ b/vvideomedia.cc @@ -766,15 +766,15 @@ char * VVideoMedia::shortendedText(const char * title, const char * title2,const intext=""; } UINT twidth=0; - for (const char *p=title;*p!=0;p++) twidth+=charWidth(*p); - for (const char *p=title2;*p!=0;p++) twidth+=charWidth(*p); + for (const char *p=title;*p!=0;p++) twidth+=(UINT)charWidth(*p); + for (const char *p=title2;*p!=0;p++) twidth+=(UINT)charWidth(*p); const char *prfx="..."; - UINT prfwidth=3*charWidth('.'); + UINT prfwidth=(UINT)(3*charWidth('.')); const char *istart=intext+strlen(intext); UINT iwidth=0; while (twidth+iwidth+prfwidth < width-2*paraMargin && istart> intext) { istart--; - iwidth+=charWidth(*istart); + iwidth+=(UINT)charWidth(*istart); } if (twidth+iwidth+prfwidth >= width-2*paraMargin && istart < intext+strlen(intext)) istart++; if (istart == intext) prfx=""; diff --git a/vvideorec.cc b/vvideorec.cc index 3b0c879..1a0af09 100644 --- a/vvideorec.cc +++ b/vvideorec.cc @@ -325,7 +325,7 @@ int VVideoRec::handleCommand(int command) // skip to previous mark Log* logger = Log::getInstance(); int currentFrame = (player->getCurrentFrameNum()); // get current Frame - currentFrame -= 5. * myRec->recInfo->fps; // subtrack 5 seconds, else you cannot skip more than once back .. + currentFrame -= (int)(5. * myRec->recInfo->fps); // subtrack 5 seconds, else you cannot skip more than once back .. int prevMark = myRec->getPrevMark(currentFrame); // find previous Frame if (prevMark) @@ -1140,10 +1140,10 @@ void VVideoRec::clearOSDArea(UINT posX, UINT posY, UINT width, UINT height, cons //now convert to our display float scalex=720.f/((float) (region.framewidth+1)); float scaley=576.f/((float) (region.frameheight+1)); - r.x=floor(scalex*((float)r.x)); - r.y=floor(scaley*((float)r.y)); - r.w=ceil(scalex*((float)r.w))+1.f; - r.h=ceil(scaley*((float)r.h))+1.f; + r.x=(UINT)floor(scalex*((float)r.x)); + r.y=(UINT)floor(scaley*((float)r.y)); + r.w=(UINT)(ceil(scalex*((float)r.w))+1.f); + r.h=(UINT)(ceil(scaley*((float)r.h))+1.f); rectangle(r, transparent); boxstack->update(this, &r); diff --git a/wpictureview.cc b/wpictureview.cc index 9922318..fd1a6bf 100644 --- a/wpictureview.cc +++ b/wpictureview.cc @@ -113,12 +113,12 @@ void WPictureView::draw() { if (!(*citty)->caption.empty()) { - drawTextCentre((*citty)->caption.c_str(), xpos + (*citty)->w*0.5f, ypos, foreColour); + drawTextCentre((*citty)->caption.c_str(), (int)(xpos + (*citty)->w*0.5f), (int)ypos, foreColour); caption1 = true; } if (!(*citty)->caption2.empty()) { - drawTextCentre((*citty)->caption2.c_str(), xpos + (*citty)->w*0.5f, ypos + fontHeight*1.f, foreColour); + drawTextCentre((*citty)->caption2.c_str(), (int)(xpos + (*citty)->w*0.5f), (int)(ypos + fontHeight*1.f), foreColour); caption2 = true; } xpos += (*citty)->w + 10.f; @@ -136,7 +136,7 @@ void WPictureView::draw() height += fontHeight*1.f; } - rem_scroll_line = ceil((height - area.h -cur_scroll_line * fontHeight*8.f)/fontHeight/8.f); + rem_scroll_line = (UINT)ceil((height - area.h -cur_scroll_line * fontHeight*8.f)/fontHeight/8.f); // Log::getInstance()->log("WActorGallery", Log::DEBUG, "TVMedia rml %d",rem_scroll_line); drawClippingRectangle(0,0,0,0); diff --git a/wselectlist.cc b/wselectlist.cc index 5d41ea0..d6e50fa 100644 --- a/wselectlist.cc +++ b/wselectlist.cc @@ -100,7 +100,7 @@ int WSelectList::addOption(const char* text, ULONG data, int selected, TVMediaIn void WSelectList::draw() { int fontHeight = getFontHeight(); - int ySeperation = fontHeight * linesPerOption + gap; + int ySeperation = (int) (fontHeight * linesPerOption + gap); numOptionsDisplayable = (area.h - 5) / ySeperation; @@ -126,13 +126,13 @@ void WSelectList::draw() if (i == selectedOption && showseloption) { - rectangle(0, ypos, area.w, fontHeight * linesPerOption-1, darkseloption ? DrawStyle::SELECTDARKHIGHLIGHT: DrawStyle::SELECTHIGHLIGHT); + rectangle(0, ypos, area.w, (UINT)(fontHeight * linesPerOption-1), darkseloption ? DrawStyle::SELECTDARKHIGHLIGHT: DrawStyle::SELECTHIGHLIGHT); drawOptionLine(options[i].text, 5, ypos, area.w - 5, DrawStyle::DARKTEXT, options[i].pict); } else { - rectangle(0, ypos, area.w, fontHeight * linesPerOption-1, DrawStyle::SELECTBACKGROUND); + rectangle(0, ypos, area.w, (UINT)(fontHeight * linesPerOption-1), DrawStyle::SELECTBACKGROUND); drawOptionLine(options[i].text, 5, ypos, area.w - 5, DrawStyle::LIGHTTEXT, options[i].pict); } @@ -186,7 +186,7 @@ void WSelectList::drawOptionLine(char* text, int xpos, int ypos, int width, cons pointer = STRTOKR(buffer, "\t\n", &savepointer); while(pointer) { - drawText(pointer, xposmod + columns[currentColumn], ypos_mod + curline * fontHeight, width - columns[currentColumn], colour); + drawText(pointer, xposmod + columns[currentColumn], (int)(ypos_mod + curline * fontHeight), width - columns[currentColumn], colour); pointer = STRTOKR(NULL, "\t\n", &savepointer); if (pointer) { @@ -320,7 +320,7 @@ bool WSelectList::mouseLBDOWN(int x, int y) int WSelectList::getMouseLine(int x,int y) { int fontHeight = getFontHeight(); - int ySeperation = fontHeight * linesPerOption + gap; + int ySeperation = (int)(fontHeight * linesPerOption + gap); if (y<0) return -1; if (x<0 || x>(int)area.w) return -1; diff --git a/wtabbar.cc b/wtabbar.cc index 7cb7a46..c161ce8 100644 --- a/wtabbar.cc +++ b/wtabbar.cc @@ -58,7 +58,7 @@ void WTabBar::addTab(const char* name, Boxx* boxx) for(UINT i = 0; i < strlen(name); i++) { - td.nameWidth += charWidth(name[i]); + td.nameWidth += (UINT)charWidth(name[i]); } UINT newButtonX = 22; -- 2.39.5