• R/O
  • SSH
  • HTTPS

qrobosdk: コミット


コミットメタ情報

リビジョン1838 (tree)
日時2010-06-01 12:17:17
作者satofumi

ログメッセージ

fixed spell miss

変更サマリ

差分

--- trunk/libs/lua/Makefile (revision 1837)
+++ trunk/libs/lua/Makefile (revision 1838)
@@ -94,8 +94,8 @@
9494 luabindInit.o: luabindInit.h LuaHandler.h ../system/log_printf.h
9595 luabindInput.o: luabindInput.h ../input/convertToRoman.h
9696 luabindInput.o: ../input/convertToJp.h ../input/Utf8.h ../input/utf8_string.h
97-luabindNetwork.o: luabindNetwork.h ../connection/Connection.h
98-luabindNetwork.o: ../connection/TcpipSocket.h
97+luabindNetwork.o: luabindNetwork.h ../connection/TcpipSocket.h
98+luabindNetwork.o: ../connection/Connection.h ../connection/ConnectionUtils.h
9999 luabindRangeFinder.o: luabindRangeFinder.h ../monitoring/mUrgDevice.h
100100 luabindRangeFinder.o: ../range_finder/UrgDevice.h ../coordinate/Coordinate.h
101101 luabindRangeFinder.o: ../geometry/Position.h ../geometry/Angle.h
--- trunk/libs/lua/luabindNetwork.cpp (revision 1837)
+++ trunk/libs/lua/luabindNetwork.cpp (revision 1838)
@@ -8,8 +8,8 @@
88 */
99
1010 #include "luabindNetwork.h"
11-#include "Connection.h"
1211 #include "TcpipSocket.h"
12+#include "ConnectionUtils.h"
1313 #include <luabind/luabind.hpp>
1414 #include <algorithm>
1515 #include <string>
@@ -21,9 +21,13 @@
2121
2222 namespace
2323 {
24+ enum {
25+ BufferSize = 1024,
26+ };
27+
28+
2429 string connection_receive(Connection* connection, size_t size, int timeout)
2530 {
26- enum { BufferSize = 1024 };
2731 char buffer[BufferSize];
2832
2933 size_t actual_size = min(size, static_cast<size_t>(BufferSize - 1));
@@ -36,6 +40,19 @@
3640 buffer[n] = '\0';
3741 return buffer;
3842 }
43+
44+
45+ string connection_readline(Connection* connection, int timeout)
46+ {
47+ char buffer[BufferSize];
48+
49+ int n = readline(connection, buffer, BufferSize - 1, timeout);
50+ if (n <= 0) {
51+ return "";
52+ }
53+
54+ return buffer;
55+ }
3956 }
4057
4158
@@ -59,6 +76,7 @@
5976 .def("clear", &TcpipSocket::clear)
6077 .def("ungetc", &TcpipSocket::ungetc),
6178
62- def("conection_receive", &connection_receive)
79+ def("connection_readline", &connection_readline),
80+ def("connection_receive", &connection_receive)
6381 ];
6482 }
--- trunk/libs/connection/qt/TcpipSocket.cpp (revision 1837)
+++ trunk/libs/connection/qt/TcpipSocket.cpp (revision 1838)
@@ -47,6 +47,7 @@
4747
4848 TcpipSocket::~TcpipSocket(void)
4949 {
50+ disconnect();
5051 }
5152
5253
--- trunk/libs/connection/ConnectionUtils.cpp (revision 1837)
+++ trunk/libs/connection/ConnectionUtils.cpp (revision 1838)
@@ -36,8 +36,7 @@
3636 }
3737
3838
39-int qrk::readline(Connection* con, char* buf, const size_t count,
40- const int timeout)
39+int qrk::readline(Connection* con, char* buf, const size_t count, int timeout)
4140 {
4241 // 1文字ずつ読み出して評価する
4342 bool is_timeout = false;
--- trunk/libs/connection/ConnectionUtils.h (revision 1837)
+++ trunk/libs/connection/ConnectionUtils.h (revision 1838)
@@ -54,7 +54,7 @@
5454 \return 受信文字数 (受信がなくてタイムアウトした場合は -1)
5555 */
5656 extern int readline(Connection* con, char* buf, const size_t count,
57- const int timeout);
57+ int timeout);
5858
5959
6060 /*!
旧リポジトリブラウザで表示