aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfanlinxX <linxiaox.fan@intel.com>2023-03-07 14:56:58 +0800
committerZong Wei <wei.zong@intel.com>2023-03-07 16:29:13 +0800
commit85cadf1ff14c0cf6bf605b5304c1ae5f4d2eb017 (patch)
tree73dc1e73b5cb6d8b683abbe34c18a62ff0ef1809
parent10c2834e539d66226965fe043ff34e62d8bbdf58 (diff)
downloadlibxcam-85cadf1ff14c0cf6bf605b5304c1ae5f4d2eb017.tar.gz
robust: fixed new defects in outstanding.
Signed-off-by: fanlinxX <linxiaox.fan@intel.com>
-rw-r--r--tests/test-device-manager.cpp8
-rw-r--r--tests/test-pipe-manager.cpp8
-rw-r--r--xcore/fisheye_image_file.cpp12
3 files changed, 15 insertions, 13 deletions
diff --git a/tests/test-device-manager.cpp b/tests/test-device-manager.cpp
index 38cb42c..73a5dcb 100644
--- a/tests/test-device-manager.cpp
+++ b/tests/test-device-manager.cpp
@@ -846,10 +846,10 @@ int main (int argc, char *argv[])
cl_post_processor->set_image_warp (image_warp_type);
if (smart_analyzer.ptr () && (wireframe_type || image_warp_type)) {
cl_post_processor->set_scaler (true);
- if(frame_width >= 0){
- cl_post_processor->set_scaler_factor (640.0 / frame_width);
- }else{
- XCAM_LOG_ERROR ("frame_width can not be zero .");
+ if (frame_width > 0) {
+ cl_post_processor->set_scaler_factor (640.0 / frame_width);
+ } else {
+ XCAM_LOG_ERROR ("frame_width can not be zero .");
}
}
diff --git a/tests/test-pipe-manager.cpp b/tests/test-pipe-manager.cpp
index 034d00a..e89c0b1 100644
--- a/tests/test-pipe-manager.cpp
+++ b/tests/test-pipe-manager.cpp
@@ -408,10 +408,10 @@ int main (int argc, char *argv[])
cl_post_processor->set_image_warp (enable_image_warp);
if (smart_analyzer.ptr () && (enable_wireframe || enable_image_warp)) {
cl_post_processor->set_scaler (true);
- if (image_width >= 0){
- cl_post_processor->set_scaler_factor (640.0 / image_width);
- }else{
- XCAM_LOG_ERROR ("image_width can not be zero .");
+ if (image_width > 0) {
+ cl_post_processor->set_scaler_factor (640.0 / image_width);
+ } else {
+ XCAM_LOG_ERROR ("image_width can not be zero .");
}
}
diff --git a/xcore/fisheye_image_file.cpp b/xcore/fisheye_image_file.cpp
index a2becc1..dfcda08 100644
--- a/xcore/fisheye_image_file.cpp
+++ b/xcore/fisheye_image_file.cpp
@@ -141,8 +141,10 @@ FisheyeImageFile::read_roi (const SmartPtr<VideoBuffer> &buf, uint32_t idx)
x_min = _x_min[idx][h] / x_step;
x_max = (_x_max[idx][h] + x_step - 1) / x_step;
- fseek (_fp, fp_offset + x_min, SEEK_CUR);
- bytes = (x_max - x_min) * planar.pixel_bytes;
+ if (fseek (_fp, fp_offset + x_min, SEEK_CUR) < 0)
+ return XCAM_RETURN_ERROR_MEM;
+
+ bytes = (x_max - x_min) * planar.pixel_bytes;
if (fread (start + x_min, 1, bytes, _fp) != bytes) {
XCamReturn ret = XCAM_RETURN_NO_ERROR;
@@ -162,9 +164,9 @@ FisheyeImageFile::read_roi (const SmartPtr<VideoBuffer> &buf, uint32_t idx)
h += y_step;
}
- int fret = fseek (_fp, fp_offset, SEEK_CUR);
- if (fret != 0)
- return XCAM_RETURN_ERROR_MEM;
+ if (fseek (_fp, fp_offset, SEEK_CUR) < 0)
+ return XCAM_RETURN_ERROR_MEM;
+
}
buf->unmap ();