Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix return value on platforms where char is unsigned. #311

Merged
merged 1 commit into from
Nov 6, 2013

Conversation

trainman419
Copy link
Contributor

On platforms where char is unsigned (ARM), rosbag loops forever instead of playing normally, because readCharFromStdin() can never return EOF which is defined to be negative. This patch switches the return type from char to int, which is signed on all platforms.

Note that readCharFromStdin() is implemented on linux using getc, which returns int. It makes sense that readCharFromStdin(), which has similar return semantics, should have the same return type.

This patch fixes the following compile warning:

/home/hendrix/hydro/src/ros_comm/tools/rosbag/src/player.cpp: In member function
 ‘void rosbag::Player::doPublish(const rosbag::MessageInstance&)’:
/home/hendrix/hydro/src/ros_comm/tools/rosbag/src/player.cpp:338:18: warning: case label value is less than minimum value for type [enabled by default]
/home/hendrix/hydro/src/ros_comm/tools/rosbag/src/player.cpp: In member function
 ‘void rosbag::Player::doKeepAlive()’:
/home/hendrix/hydro/src/ros_comm/tools/rosbag/src/player.cpp:393:18: warning: case label value is less than minimum value for type [enabled by default]

dirk-thomas added a commit that referenced this pull request Nov 6, 2013
Fix return value on platforms where char is unsigned.
@dirk-thomas dirk-thomas merged commit 47dca4e into ros:hydro-devel Nov 6, 2013
rsinnet pushed a commit to MisoRobotics/ros_comm that referenced this pull request Jun 19, 2017
Fix return value on platforms where char is unsigned.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants