hqd : Use proper type casts

* Remove compilation errors
    * Use proper type casts

Change-Id: I1d44c2a2362a1fdd4d6e412ea816d4078e8355c9
:
This commit is contained in:
Dileep Kumar Reddi 2014-02-25 14:32:51 +05:30 committed by Gerrit - the friendly Code Review server
parent 940a23c492
commit cf40ec929a
9 changed files with 34 additions and 28 deletions

View File

@ -113,7 +113,7 @@ ExternalDisplay::ExternalDisplay(hwc_context_t* ctx):mFd(-1),
* Used to show QCOM 8974 instead of Input 1 for example
*/
void ExternalDisplay::setSPDInfo(const char* node, const char* property) {
int err = -1;
ssize_t err = -1;
char info[PROPERTY_VALUE_MAX];
char sysFsSPDFilePath[MAX_SYSFS_FILE_PATH];
memset(sysFsSPDFilePath, 0, sizeof(sysFsSPDFilePath));
@ -172,7 +172,7 @@ void ExternalDisplay::getEDIDModes(int *out) const {
void ExternalDisplay::readCEUnderscanInfo()
{
int hdmiScanInfoFile = -1;
int len = -1;
ssize_t len = -1;
char scanInfo[17];
char *ce_info_str = NULL;
char *save_ptr;
@ -191,7 +191,7 @@ void ExternalDisplay::readCEUnderscanInfo()
return;
} else {
len = read(hdmiScanInfoFile, scanInfo, sizeof(scanInfo)-1);
ALOGD("%s: Scan Info string: %s length = %d",
ALOGD("%s: Scan Info string: %s length = %zu",
__FUNCTION__, scanInfo, len);
if (len <= 0) {
close(hdmiScanInfoFile);
@ -200,8 +200,8 @@ void ExternalDisplay::readCEUnderscanInfo()
return;
}
scanInfo[len] = '\0'; /* null terminate the string */
close(hdmiScanInfoFile);
}
close(hdmiScanInfoFile);
/*
* The scan_info contains the three fields
@ -304,7 +304,7 @@ bool ExternalDisplay::readResolution()
"/sys/devices/virtual/graphics/fb%d/edid_modes", mFbNum);
int hdmiEDIDFile = open(sysFsEDIDFilePath, O_RDONLY, 0);
int len = -1;
ssize_t len = -1;
char edidStr[128] = {'\0'};
if (hdmiEDIDFile < 0) {
@ -313,7 +313,7 @@ bool ExternalDisplay::readResolution()
return false;
} else {
len = read(hdmiEDIDFile, edidStr, sizeof(edidStr)-1);
ALOGD_IF(DEBUG, "%s: EDID string: %s length = %d",
ALOGD_IF(DEBUG, "%s: EDID string: %s length = %zu",
__FUNCTION__, edidStr, len);
if ( len <= 0) {
ALOGE("%s: edid_modes file empty '%s'",
@ -326,8 +326,8 @@ bool ExternalDisplay::readResolution()
}
edidStr[len] = '\0';
}
close(hdmiEDIDFile);
}
close(hdmiEDIDFile);
if(len > 0) {
// Get EDID modes from the EDID strings
mModeCount = parseResolution(edidStr, mEDIDModes);
@ -558,7 +558,7 @@ bool ExternalDisplay::writeHPDOption(int userOption) const
__FUNCTION__, sysFsHPDFilePath, hdmiHPDFile, strerror(errno));
ret = false;
} else {
int err = -1;
ssize_t err = -1;
ALOGD_IF(DEBUG, "%s: option = %d", __FUNCTION__, userOption);
if(userOption)
err = write(hdmiHPDFile, "1", 2);
@ -607,7 +607,7 @@ void ExternalDisplay::setAttributes() {
}
}
mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].vsync_period =
1000000000l / fps;
(int) 1000000000l / fps;
}
}

View File

@ -84,7 +84,7 @@ write_int(char const* path, int value)
if (fd >= 0) {
char buffer[20];
int bytes = sprintf(buffer, "%d\n", value);
int amt = write(fd, buffer, bytes);
ssize_t amt = write(fd, buffer, (size_t)bytes);
close(fd);
return amt == -1 ? -errno : 0;
} else {

View File

@ -43,14 +43,14 @@ namespace qdutils {
int CBUtils::getuiClearRegion(hwc_display_contents_1_t* list,
hwc_rect_t &clearWormholeRect, LayerProp *layerProp) {
uint32_t last = list->numHwLayers - 1;
size_t last = list->numHwLayers - 1;
hwc_rect_t fbFrame = list->hwLayers[last].displayFrame;
Rect fbFrameRect(fbFrame.left,fbFrame.top,fbFrame.right,fbFrame.bottom);
Region wormholeRegion(fbFrameRect);
if(cb_swap_rect::getInstance().checkSwapRectFeature_on() == true){
wormholeRegion.set(0,0);
for(uint32_t i = 0 ; i < last; i++) {
for(size_t i = 0 ; i < last; i++) {
if((list->hwLayers[i].blending == HWC_BLENDING_NONE) ||
!(layerProp[i].mFlags & HWC_COPYBIT) ||
(list->hwLayers[i].flags & HWC_SKIP_HWC_COMPOSITION))
@ -61,7 +61,7 @@ int CBUtils::getuiClearRegion(hwc_display_contents_1_t* list,
wormholeRegion.set(tmpRect);
}
}else{
for (uint32_t i = 0 ; i < last; i++) {
for (size_t i = 0 ; i < last; i++) {
// need to take care only in per pixel blending.
// Restrict calculation only for copybit layers.
if((list->hwLayers[i].blending != HWC_BLENDING_NONE) ||

View File

@ -184,13 +184,13 @@ bool MDPVersion::updateSysFsInfo() {
mMdpRev = atoi(tokens[1]);
}
else if(!strncmp(tokens[0], "rgb_pipes", strlen("rgb_pipes"))) {
mRGBPipes = atoi(tokens[1]);
mRGBPipes = (uint8_t)atoi(tokens[1]);
}
else if(!strncmp(tokens[0], "vig_pipes", strlen("vig_pipes"))) {
mVGPipes = atoi(tokens[1]);
mVGPipes = (uint8_t)atoi(tokens[1]);
}
else if(!strncmp(tokens[0], "dma_pipes", strlen("dma_pipes"))) {
mDMAPipes = atoi(tokens[1]);
mDMAPipes = (uint8_t)atoi(tokens[1]);
}
else if(!strncmp(tokens[0], "max_downscale_ratio",
strlen("max_downscale_ratio"))) {

View File

@ -100,7 +100,9 @@ public:
int getMDPVersion() {return mMDPVersion;}
char getPanelType() {return mPanelType;}
bool hasOverlay() {return mHasOverlay;}
uint8_t getTotalPipes() { return (mRGBPipes + mVGPipes + mDMAPipes);}
uint8_t getTotalPipes() {
return (uint8_t)(mRGBPipes + mVGPipes + mDMAPipes);
}
uint8_t getRGBPipes() { return mRGBPipes; }
uint8_t getVGPipes() { return mVGPipes; }
uint8_t getDMAPipes() { return mDMAPipes; }

View File

@ -90,7 +90,7 @@ void CalcFps::populate_debug_fps_metadata(void)
debug_fps_metadata.ignorethresh_us = atoi(prop);
debug_fps_metadata.framearrival_steps =
(debug_fps_metadata.ignorethresh_us / 16666);
(unsigned int)(debug_fps_metadata.ignorethresh_us / 16666);
if (debug_fps_metadata.framearrival_steps > MAX_FRAMEARRIVAL_STEPS) {
debug_fps_metadata.framearrival_steps = MAX_FRAMEARRIVAL_STEPS;
@ -106,7 +106,7 @@ void CalcFps::populate_debug_fps_metadata(void)
debug_fps_metadata.curr_frame = 0;
ALOGD("period: %d", debug_fps_metadata.period);
ALOGD("period: %u", debug_fps_metadata.period);
ALOGD("ignorethresh_us: %"PRId64, debug_fps_metadata.ignorethresh_us);
}
@ -165,7 +165,8 @@ void CalcFps::calc_fps(nsecs_t currtime_us)
debug_fps_metadata.curr_frame++;
if (debug_fps_level > 1) {
unsigned int currstep = (diff + debug_fps_metadata.margin_us) / 16666;
unsigned int currstep =
(unsigned int)(diff + debug_fps_metadata.margin_us) / 16666;
if (currstep < debug_fps_metadata.framearrival_steps) {
debug_fps_metadata.accum_framearrivals[currstep-1]++;
@ -178,14 +179,15 @@ void CalcFps::calc_fps(nsecs_t currtime_us)
nsecs_t sum = 0;
for (unsigned int i = 0; i < debug_fps_metadata.period; i++)
sum += debug_fps_metadata.framearrivals[i];
print_fps((debug_fps_metadata.period * float(1000000))/float(sum));
print_fps(float(float(debug_fps_metadata.period * 1000000) /
(float)sum));
}
}
else if (debug_fps_metadata_t::DFM_TIME == debug_fps_metadata.type) {
debug_fps_metadata.time_elapsed += ((float)diff/1000.0);
debug_fps_metadata.time_elapsed += (float)((float)diff/1000.0);
if (debug_fps_metadata.time_elapsed >= debug_fps_metadata.time_period) {
float fps = (1000.0 * debug_fps_metadata.curr_frame)/
(float)debug_fps_metadata.time_elapsed;
float fps = float(1000.0 * debug_fps_metadata.curr_frame/
debug_fps_metadata.time_elapsed);
print_fps(fps);
}
}

View File

@ -111,7 +111,7 @@ int setMetaData(private_handle_t *handle, DispParamType paramType,
break;
}
if(munmap(base, size))
ALOGE("%s: failed to unmap ptr 0x%"PRIdPTR", err %d", __func__, (intptr_t)base,
ALOGE("%s: failed to unmap ptr %p, err %d", __func__, (void*)base,
errno);
return 0;
}

View File

@ -87,7 +87,7 @@ int getEdidRawData(char *buffer)
return 0;
}
size = read(edidFile, (char*)buffer, EDID_RAW_DATA_SIZE);
size = (int)read(edidFile, (char*)buffer, EDID_RAW_DATA_SIZE);
close(edidFile);
return size;
}

View File

@ -125,8 +125,10 @@ static void getProcName(int pid, char *buf, int size) {
if (fd < 0) {
strlcpy(buf, "Unknown", size);
} else {
int len = read(fd, buf, size - 1);
buf[len] = 0;
ssize_t len = read(fd, buf, size - 1);
if (len >= 0)
buf[len] = 0;
close(fd);
}
}