From ee5183e32558ecaa91f9eec6515fc8b63c2f8556 Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Thu, 4 Jul 2019 11:04:50 -0300 Subject: [PATCH] Fixing test pattern. Fixing some build warmings. --- rpm/lib3270.spec | 4 ++-- src/include/lib3270.h | 12 ++++++------ src/include/screenc.h | 2 +- src/lib3270/screen.c | 26 +++++++++++++------------- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/rpm/lib3270.spec b/rpm/lib3270.spec index 6f3030e..4bf12cf 100644 --- a/rpm/lib3270.spec +++ b/rpm/lib3270.spec @@ -122,7 +122,8 @@ See more details at https://softwarepublico.gov.br/social/pw3270/ NOCONFIGURE=1 ./autogen.sh %configure \ - --with-sdk-version=%{version} + --with-sdk-version=%{version} \ + --disable-static %build make clean @@ -158,7 +159,6 @@ rm -rf $RPM_BUILD_ROOT %{_libdir}/pkgconfig/*.pc %{_libdir}/*.so -%{_libdir}/*.a %dir %{_datadir}/pw3270/pot %{_datadir}/pw3270/pot/*.pot diff --git a/src/include/lib3270.h b/src/include/lib3270.h index 58d9475..a799e9c 100644 --- a/src/include/lib3270.h +++ b/src/include/lib3270.h @@ -664,7 +664,7 @@ * @return Current address or -1 if invalid (sets errno). * */ - LIB3270_EXPORT int lib3270_translate_to_address(H3270 *hSession, int row, int col); + LIB3270_EXPORT int lib3270_translate_to_address(H3270 *hSession, unsigned int row, unsigned int col); /** * @brief Set string at current cursor position. @@ -719,7 +719,7 @@ * * @return Old cursor address or -1 in case of error (sets errno). */ - LIB3270_EXPORT int lib3270_set_cursor_address(H3270 *hSession, int baddr); + LIB3270_EXPORT int lib3270_set_cursor_address(H3270 *hSession, unsigned int baddr); /** * @brief Set cursor position. @@ -731,7 +731,7 @@ * @return last cursor address or -1 if invalid (sets errno). * */ - LIB3270_EXPORT int lib3270_set_cursor_position(H3270 *h, int row, int col); + LIB3270_EXPORT int lib3270_set_cursor_position(H3270 *h, unsigned int row, unsigned int col); /** * @brief Get cursor address. @@ -1174,7 +1174,7 @@ * @return 0 if ok, -1 if fails (sets errno). * */ - LIB3270_EXPORT int lib3270_get_element(H3270 *h, int baddr, unsigned char *c, unsigned short *attr); + LIB3270_EXPORT int lib3270_get_element(H3270 *h, unsigned int baddr, unsigned char *c, unsigned short *attr); /** * @brief Check if the informed addr is marked as selected. @@ -1185,7 +1185,7 @@ * @return >0 zero if element is selected, 0 if not, -1 if fails (sets errno). * */ - LIB3270_EXPORT int lib3270_is_selected(H3270 *hSession, int baddr); + LIB3270_EXPORT int lib3270_is_selected(H3270 *hSession, unsigned int baddr); /** * @brief Get attribute at the requested ADDR. @@ -1196,7 +1196,7 @@ * @return Attribute of the required address or -1 if failed. * */ - LIB3270_EXPORT LIB3270_ATTR lib3270_get_attribute_at_address(H3270 *hSession, int baddr); + LIB3270_EXPORT LIB3270_ATTR lib3270_get_attribute_at_address(H3270 *hSession, unsigned int baddr); /** * Get field region diff --git a/src/include/screenc.h b/src/include/screenc.h index 953356e..7fc2748 100644 --- a/src/include/screenc.h +++ b/src/include/screenc.h @@ -49,7 +49,7 @@ LIB3270_INTERNAL void mcursor_set(H3270 *session,LIB3270_POINTER m); #define mcursor_waiting(x) mcursor_set(x,LIB3270_POINTER_WAITING) LIB3270_INTERNAL void notify_toggle_changed(H3270 *session, LIB3270_TOGGLE ix, unsigned char value, LIB3270_TOGGLE_TYPE reason); -LIB3270_INTERNAL void set_viewsize(H3270 *session, int rows, int cols); +LIB3270_INTERNAL void set_viewsize(H3270 *session, unsigned int rows, unsigned int cols); // LIB3270_INTERNAL Boolean escaped; diff --git a/src/lib3270/screen.c b/src/lib3270/screen.c index 285fc81..107b08e 100644 --- a/src/lib3270/screen.c +++ b/src/lib3270/screen.c @@ -93,12 +93,12 @@ static void addch(H3270 *session, int baddr, unsigned char c, unsigned short att session->cbk.update(session,baddr,c,attr,baddr == session->cursor_addr); } -LIB3270_EXPORT LIB3270_ATTR lib3270_get_attribute_at_address(H3270 *hSession, int baddr) +LIB3270_EXPORT LIB3270_ATTR lib3270_get_attribute_at_address(H3270 *hSession, unsigned int baddr) { if(check_online_session(hSession)) return (LIB3270_ATTR) -1; - if(!hSession->text || baddr < 0 || baddr > (hSession->rows*hSession->cols)) + if(!hSession->text ||baddr > (hSession->rows*hSession->cols)) { errno = EINVAL; return (LIB3270_ATTR) -1; @@ -107,11 +107,11 @@ LIB3270_EXPORT LIB3270_ATTR lib3270_get_attribute_at_address(H3270 *hSession, in return hSession->text[baddr].attr; } -LIB3270_EXPORT int lib3270_is_selected(H3270 *hSession, int baddr) +LIB3270_EXPORT int lib3270_is_selected(H3270 *hSession, unsigned int baddr) { FAIL_IF_NOT_ONLINE(hSession); - if(!hSession->text || baddr < 0 || baddr > (hSession->rows*hSession->cols)) + if(!hSession->text || baddr > (hSession->rows*hSession->cols)) { errno = EINVAL; return -1; @@ -120,11 +120,11 @@ LIB3270_EXPORT int lib3270_is_selected(H3270 *hSession, int baddr) return (hSession->text[baddr].attr & LIB3270_ATTR_SELECTED) != 0; } -LIB3270_EXPORT int lib3270_get_element(H3270 *hSession, int baddr, unsigned char *c, unsigned short *attr) +LIB3270_EXPORT int lib3270_get_element(H3270 *hSession, unsigned int baddr, unsigned char *c, unsigned short *attr) { FAIL_IF_NOT_ONLINE(hSession); - if(!hSession->text || baddr < 0 || baddr > (hSession->rows*hSession->cols)) + if(!hSession->text || baddr > (hSession->rows*hSession->cols)) { errno = EINVAL; return -1; @@ -420,14 +420,14 @@ LIB3270_EXPORT int lib3270_get_cursor_address(H3270 *h) * @return Current address or -1 if invalid (sets errno). * */ -LIB3270_EXPORT int lib3270_translate_to_address(H3270 *hSession, int row, int col) +LIB3270_EXPORT int lib3270_translate_to_address(H3270 *hSession, unsigned int row, unsigned int col) { FAIL_IF_NOT_ONLINE(hSession); row--; col--; - if(row < 0 || col < 0 || row > hSession->rows || col > hSession->cols) + if(row > hSession->rows || col > hSession->cols) { // Invalid coordinates errno = EINVAL; @@ -449,13 +449,13 @@ LIB3270_EXPORT int lib3270_translate_to_address(H3270 *hSession, int row, int co * @return Old cursor address or -1 in case of error (sets errno). * */ -LIB3270_EXPORT int lib3270_set_cursor_address(H3270 *hSession, int baddr) +LIB3270_EXPORT int lib3270_set_cursor_address(H3270 *hSession, unsigned int baddr) { FAIL_IF_NOT_ONLINE(hSession); trace("%s(%d)",__FUNCTION__,baddr); - if(baddr < 0 || baddr > (hSession->rows * hSession->cols)) + if(baddr > (hSession->rows * hSession->cols)) { errno = EINVAL; return -1; @@ -479,7 +479,7 @@ LIB3270_EXPORT int lib3270_set_cursor_address(H3270 *hSession, int baddr) * @return Old cursor address or -1 in case of error (sets errno). * */ -LIB3270_EXPORT int lib3270_set_cursor_position(H3270 *hSession, int row, int col) +LIB3270_EXPORT int lib3270_set_cursor_position(H3270 *hSession, unsigned int row, unsigned int col) { return lib3270_set_cursor_address(hSession,lib3270_translate_to_address(hSession, row, col)); @@ -701,7 +701,7 @@ void status_twait(H3270 *session) status_changed(session,LIB3270_MESSAGE_TWAIT); } -void set_viewsize(H3270 *session, int rows, int cols) +void set_viewsize(H3270 *session, unsigned int rows, unsigned int cols) { CHECK_SESSION_HANDLE(session); @@ -947,7 +947,7 @@ LIB3270_EXPORT int lib3270_testpattern(H3270 *hSession) int f; int fg = COLOR_BLUE; - FAIL_IF_NOT_ONLINE(hSession); + FAIL_IF_ONLINE(hSession); max = (hSession->maxROWS * hSession->maxCOLS); for(f=0;f