From c6a0891622310907a875b3e637b711958e2ceec9 Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Tue, 24 Sep 2019 17:29:39 -0300 Subject: [PATCH] Row & Col should be unsigned short. --- client/src/core/session.cc | 2 +- client/src/host/pop.cc | 2 +- client/src/host/push.cc | 4 ++-- client/src/host/string.cc | 4 ++-- client/src/include/ipc-client-internals.h | 6 +++--- client/src/include/lib3270/ipc.h | 32 ++++++++++++++------------------ client/src/session/get.cc | 4 ++-- client/src/session/local/private.h | 2 +- client/src/session/local/wait.cc | 2 +- client/src/session/remote/private.h | 2 +- client/src/session/remote/wait.cc | 2 +- client/src/session/set.cc | 2 +- 12 files changed, 30 insertions(+), 34 deletions(-) diff --git a/client/src/core/session.cc b/client/src/core/session.cc index fe5d21e..d07d16e 100644 --- a/client/src/core/session.cc +++ b/client/src/core/session.cc @@ -392,7 +392,7 @@ return toString(baddr,len,'\0').compare(0,len,s); } - int Session::compare(unsigned int row, unsigned int col, const char* s, int len) const { + int Session::compare(unsigned short row, unsigned short col, const char* s, int len) const { if(len < 0) len = strlen(s); diff --git a/client/src/host/pop.cc b/client/src/host/pop.cc index ad37aad..9ccb81f 100644 --- a/client/src/host/pop.cc +++ b/client/src/host/pop.cc @@ -53,7 +53,7 @@ TN3270::Host & TN3270::Host::pop(int baddr, std::string &text) { return *this; } -TN3270::Host & TN3270::Host::pop(int row, int col, std::string &text) { +TN3270::Host & TN3270::Host::pop(unsigned short row, unsigned short col, std::string &text) { this->session->waitForReady(this->timeout); diff --git a/client/src/host/push.cc b/client/src/host/push.cc index 1cf48d6..a8971fd 100644 --- a/client/src/host/push.cc +++ b/client/src/host/push.cc @@ -45,7 +45,7 @@ TN3270::Host & TN3270::Host::push(int baddr, const char *str, int len) { return *this; } -TN3270::Host & TN3270::Host::push(int row, int col, const char *str, int len) { +TN3270::Host & TN3270::Host::push(unsigned short row, unsigned short col, const char *str, int len) { session->push(row,col,str,len); return *this; } @@ -60,7 +60,7 @@ TN3270::Host & TN3270::Host::push(int baddr, const std::string &text) { return *this; } -TN3270::Host & TN3270::Host::push(int row, int col, const std::string &text) { +TN3270::Host & TN3270::Host::push(unsigned short row, unsigned short col, const std::string &text) { session->push(row,col,text); return *this; } diff --git a/client/src/host/string.cc b/client/src/host/string.cc index c2be1b0..a9f747c 100644 --- a/client/src/host/string.cc +++ b/client/src/host/string.cc @@ -53,7 +53,7 @@ std::string TN3270::Host::toString(int baddr, int len, char lf) const { } -std::string TN3270::Host::toString(unsigned int row, unsigned int col, int len, char lf) const { +std::string TN3270::Host::toString(unsigned short row, unsigned short col, int len, char lf) const { this->session->waitForReady(this->timeout); return this->session->toString(row,col,len,lf); @@ -76,7 +76,7 @@ int TN3270::Host::compare(int baddr, const char* s, int len) const { } -int TN3270::Host::compare(unsigned int row, unsigned int col, const char* s, int len) const { +int TN3270::Host::compare(unsigned short row, unsigned short col, const char* s, int len) const { this->session->waitForReady(this->timeout); return this->session->compare(row,col,s,len); diff --git a/client/src/include/ipc-client-internals.h b/client/src/include/ipc-client-internals.h index 182dba4..78331b5 100644 --- a/client/src/include/ipc-client-internals.h +++ b/client/src/include/ipc-client-internals.h @@ -159,14 +159,14 @@ // Contents std::string toString(int baddr, int len, char lf) const override; - std::string toString(unsigned int row, unsigned int col, int len, char lf) const override; + std::string toString(unsigned short row, unsigned short col, int len, char lf) const override; void push(const char *text, size_t length) override; void push(int baddr, const char *text, int length) override; - void push(int row, int col, const char *text, int length) override; + void push(unsigned short row, unsigned short col, const char *text, int length) override; void pop(int baddr, std::string &text) override; - void pop(int row, int col, std::string &text) override; + void pop(unsigned short row, unsigned short col, std::string &text) override; void pop(std::string &text) override; }; diff --git a/client/src/include/lib3270/ipc.h b/client/src/include/lib3270/ipc.h index a800796..99d4bf3 100644 --- a/client/src/include/lib3270/ipc.h +++ b/client/src/include/lib3270/ipc.h @@ -408,12 +408,12 @@ // Contents virtual std::string toString(int baddr = 0, int len = -1, char lf = '\n') const = 0; - virtual std::string toString(unsigned int row, unsigned int col, int len, char lf = '\n') const = 0; + virtual std::string toString(unsigned short row, unsigned short col, int len, char lf = '\n') const = 0; /// @brief Input string. virtual void push(const char *text, size_t length) = 0; virtual void push(int baddr, const char *text, int length) = 0; - virtual void push(int row, int col, const char *text, int length) = 0; + virtual void push(unsigned short row, unsigned short col, const char *text, int length) = 0; inline void push(const std::string &text) { push(-1,text.c_str(),text.size()); @@ -423,7 +423,7 @@ push(baddr,text.c_str(),text.size()); } - inline void push(int row, int col, const std::string &text) { + inline void push(unsigned short row, unsigned short col, const std::string &text) { push(row,col,text.c_str(),text.size()); } @@ -435,7 +435,7 @@ virtual void pop(int baddr, std::string &text) = 0; /// @brief Get contents of field at position. - virtual void pop(int row, int col, std::string &text) = 0; + virtual void pop(unsigned short row, unsigned short col, std::string &text) = 0; /// @brief Get contents of field at cursor position. virtual void pop(std::string &text) = 0; @@ -559,7 +559,7 @@ virtual void wait(const char *text, int seconds = DEFAULT_TIMEOUT) = 0; /// @brief Wait for string. - virtual void wait(unsigned int row, unsigned int col, const char *text, int seconds = DEFAULT_TIMEOUT) = 0; + virtual void wait(unsigned short row, unsigned short col, const char *text, int seconds = DEFAULT_TIMEOUT) = 0; /// @brief Wait for string. virtual void wait(int addr, const char *text, int seconds = DEFAULT_TIMEOUT) = 0; @@ -583,7 +583,7 @@ /// @brief Compare contents. int compare(int baddr, const char* s, int len = -1) const; - int compare(unsigned int row, unsigned int col, const char* s, int len = -1) const; + int compare(unsigned short row, unsigned short col, const char* s, int len = -1) const; }; @@ -632,20 +632,21 @@ LIB3270_KEYBOARD_LOCK_STATE input(const char *text, int length = -1, const char control_char = '@'); Host & push(int baddr, const std::string &text); - Host & push(int row, int col, const std::string &text); + Host & push(unsigned short row, unsigned short col, const std::string &text); Host & push(const std::string &text); + Host & push(const char *text); Host & push(int baddr, const char *str, int len = -1); - Host & push(int row, int col, const char *str, int len = -1); + Host & push(unsigned short row, unsigned short col, const char *str, int len = -1); Host & push(const char *str, int len = -1); Host & pop(int baddr, std::string &text); - Host & pop(int row, int col, std::string &text); + Host & pop(unsigned short row, unsigned short col, std::string &text); Host & pop(std::string &text); std::string toString() const; std::string toString(int baddr, int len = -1, char lf = '\n') const; - std::string toString(unsigned int row, unsigned int col, int len = -1, char lf = '\n') const; + std::string toString(unsigned short row, unsigned short col, int len = -1, char lf = '\n') const; template Host & push(T value) { @@ -822,11 +823,11 @@ } /// @brief Wait for string. - inline void wait(unsigned int row, unsigned int col, const char *text) { + inline void wait(unsigned short row, unsigned short col, const char *text) { return session->wait(row,col,text,this->timeout); } - inline void wait(unsigned int row, unsigned int col, const char *text, time_t timeout) { + inline void wait(unsigned short row, unsigned short col, const char *text, time_t timeout) { return session->wait(row,col,text,timeout); } @@ -844,7 +845,7 @@ /// @brief Compare contents. int compare(int baddr, const char* s, int len = -1) const; - int compare(unsigned int row, unsigned int col, const char* s, int len = -1) const; + int compare(unsigned short row, unsigned short col, const char* s, int len = -1) const; // Set contents. @@ -859,11 +860,6 @@ // Host & input(const char *text, size_t sz); - /// @brief Set field at current position, jumps to next writable field. - inline Host & push(const char *text) { - session->push(text,-1); - return *this; - }; /* // Event listeners diff --git a/client/src/session/get.cc b/client/src/session/get.cc index ead94f6..1fcad63 100644 --- a/client/src/session/get.cc +++ b/client/src/session/get.cc @@ -46,7 +46,7 @@ return convertFromHost(get(baddr,len,lf)); } - std::string Abstract::Session::toString(unsigned int row, unsigned int col, int len, char lf) const { + std::string Abstract::Session::toString(unsigned short row, unsigned short col, int len, char lf) const { return convertFromHost(get(row,col,len,lf)); } @@ -56,7 +56,7 @@ } /// @brief Get contents of field at position. - void Abstract::Session::pop(int row, int col, std::string &text) { + void Abstract::Session::pop(unsigned short row, unsigned short col, std::string &text) { throw std::system_error(ENOTSUP, std::system_category()); } diff --git a/client/src/session/local/private.h b/client/src/session/local/private.h index a6a9983..26c3b3f 100644 --- a/client/src/session/local/private.h +++ b/client/src/session/local/private.h @@ -105,7 +105,7 @@ void wait(const char *text, int seconds) override; void wait(int addr, const char *text, int seconds) override; - void wait(unsigned int row, unsigned int col, const char *text, int seconds) override; + void wait(unsigned short row, unsigned short col, const char *text, int seconds) override; // States ProgramMessage getProgramMessage() const override; diff --git a/client/src/session/local/wait.cc b/client/src/session/local/wait.cc index 4e7980a..684af9f 100644 --- a/client/src/session/local/wait.cc +++ b/client/src/session/local/wait.cc @@ -76,7 +76,7 @@ } - void Local::Session::wait(unsigned int row, unsigned int col, const char *text, int seconds) { + void Local::Session::wait(unsigned short row, unsigned short col, const char *text, int seconds) { std::lock_guard lock(sync); chkResponse(lib3270_wait_for_string_at(hSession,row,col,convertToHost(text,-1).c_str(),seconds)); diff --git a/client/src/session/remote/private.h b/client/src/session/remote/private.h index 734b620..03ddf15 100644 --- a/client/src/session/remote/private.h +++ b/client/src/session/remote/private.h @@ -106,7 +106,7 @@ void wait(const char *text, int seconds) override; void wait(int addr, const char *text, int seconds) override; - void wait(unsigned int row, unsigned int col, const char *text, int seconds) override; + void wait(unsigned short row, unsigned short col, const char *text, int seconds) override; // States ProgramMessage getProgramMessage() const override; diff --git a/client/src/session/remote/wait.cc b/client/src/session/remote/wait.cc index 2d14fa5..f888f07 100644 --- a/client/src/session/remote/wait.cc +++ b/client/src/session/remote/wait.cc @@ -174,7 +174,7 @@ } - void IPC::Session::wait(unsigned int row, unsigned int col, const char *text, int seconds) { + void IPC::Session::wait(unsigned short row, unsigned short col, const char *text, int seconds) { string key = convertToHost(text,-1); diff --git a/client/src/session/set.cc b/client/src/session/set.cc index ebea362..4e77ea8 100644 --- a/client/src/session/set.cc +++ b/client/src/session/set.cc @@ -51,7 +51,7 @@ set(baddr,convertToHost(text,length)); } - void Abstract::Session::push(int row, int col, const char *text, int length) { + void Abstract::Session::push(unsigned short row, unsigned short col, const char *text, int length) { set(row,col,convertToHost(text,length)); } -- libgit2 0.21.2