Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/gl/rs-gl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ int rs2_gl_is_frame_extendable_to(const rs2_frame* f, rs2_gl_extension extension
if (!gpu->get_gpu_section().on_gpu()) return false;
return true;
}
default: return 0;
default: return false;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@battlecry231 , this seem little weird as one would except that the compiler complains about the return false in the above case RS2_GL_EXTENSION_VIDEO_FRAME statement.
The default return (int) is actually consistent with the function's signature.
Can you post the Make error you see ?

Copy link
Contributor Author

@ingphos ingphos Jun 26, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is the error when I try to compile with default: return 0;:

[ 54%] Building CXX object src/gl/CMakeFiles/realsense2-gl.dir/rs-gl.cpp.o
/home/***/Downloads/librealsense/src/gl/rs-gl.cpp: In lambda function:
/home/***/Downloads/librealsense/src/gl/rs-gl.cpp:117:21: error: inconsistent types ‘bool’ and ‘int’ deduced for lambda return type
     default: return 0;
                     ^
make[2]: *** [src/gl/CMakeFiles/realsense2-gl.dir/build.make:102: src/gl/CMakeFiles/realsense2-gl.dir/rs-gl.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:407: src/gl/CMakeFiles/realsense2-gl.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

Edit:
But you got a point there with the return type of the function. Though the conversion from bool to int is implicit it may be better to always return a real integer, hence changing every return false; to return 0; and the return true; in line 115 to return 1; in the function rs2_gl_is_frame_extendable_to.

}
}
HANDLE_EXCEPTIONS_AND_RETURN(0, f, extension_type)
Expand Down