Skip to content

Commit 0486fa4

Browse files
committed
keycontrol: do not use operator>>(video_desc)
Similarly as in previous codec - parsing to std::string and then printing back is unnecessary. Consider rather removing the operator>>.
1 parent 840ed1f commit 0486fa4

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

src/keyboard_control.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -775,15 +775,12 @@ void keyboard_control::impl::info()
775775
}
776776

777777
{
778-
struct video_desc desc{};
779778
struct msg_universal *m = (struct msg_universal *) new_message(sizeof(struct msg_universal));
780779
strcpy(m->text, "get_format");
781780
struct response *r = send_message_sync(m_root, "receiver.decoder", (struct message *) m, 100, SEND_MESSAGE_FLAG_QUIET | SEND_MESSAGE_FLAG_NO_STORE);
782781
if (response_get_status(r) == RESPONSE_OK) {
783-
const char *text = response_get_text(r);
784-
istringstream iss(text);
785-
iss >> desc;
786-
col() << TBOLD("Received video format: ") << desc << "\n";
782+
col() << TBOLD("Received video format: ")
783+
<< response_get_text(r) << "\n";
787784
}
788785
free_response(r);
789786
}

src/video.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,12 @@ std::ostream& operator<<(std::ostream& os, const codec_t& color_spec)
164164
return os;
165165
}
166166

167+
/**
168+
* currently unused (except of the unit test
169+
* misc_test_video_desc_io_op_symmetry())
170+
*
171+
* the removal can be considered
172+
*/
167173
std::istream& operator>>(std::istream& is, video_desc& desc)
168174
{
169175
video_desc out;

0 commit comments

Comments
 (0)