Commit 8885132a33fa264d1a6c940bba4a9a809487603a
1 parent
eba1b48d
Exists in
master
and in
3 other branches
Updating properties, fixing warnings.
Showing
6 changed files
with
51 additions
and
50 deletions
Show diff stats
src/include/lib3270.h
| ... | ... | @@ -738,11 +738,10 @@ |
| 738 | 738 | * |
| 739 | 739 | * @param hSession Session handle. |
| 740 | 740 | * |
| 741 | - * @return Cursor address or -1 if invalid (sets errno). | |
| 741 | + * @return Cursor address or 0 if invalid (sets errno). | |
| 742 | 742 | * |
| 743 | 743 | */ |
| 744 | - LIB3270_EXPORT int lib3270_get_cursor_address(H3270 *hSession); | |
| 745 | - | |
| 744 | + LIB3270_EXPORT unsigned int lib3270_get_cursor_address(H3270 *hSession); | |
| 746 | 745 | |
| 747 | 746 | /** |
| 748 | 747 | * @brief Move cursor |
| ... | ... | @@ -1238,8 +1237,8 @@ |
| 1238 | 1237 | * @param Delay in milliseconds. |
| 1239 | 1238 | * |
| 1240 | 1239 | */ |
| 1241 | - LIB3270_EXPORT int lib3270_set_unlock_delay(H3270 *session, int delay); | |
| 1242 | - LIB3270_EXPORT int lib3270_get_unlock_delay(H3270 *session); | |
| 1240 | + LIB3270_EXPORT int lib3270_set_unlock_delay(H3270 *session, unsigned int delay); | |
| 1241 | + LIB3270_EXPORT unsigned int lib3270_get_unlock_delay(H3270 *session); | |
| 1243 | 1242 | |
| 1244 | 1243 | /** |
| 1245 | 1244 | * @brief Alloc/Realloc memory buffer. | ... | ... |
src/include/lib3270/properties.h
| ... | ... | @@ -56,7 +56,7 @@ |
| 56 | 56 | const char * name; ///< @brief Property name. |
| 57 | 57 | const char * description; ///< @brief Property description. |
| 58 | 58 | unsigned int (*get)(H3270 *hSession); ///< @brief Get value. |
| 59 | - unsigned int (*set)(H3270 *hSession, unsigned int value); ///< @brief Set value. | |
| 59 | + int (*set)(H3270 *hSession, unsigned int value); ///< @brief Set value. | |
| 60 | 60 | |
| 61 | 61 | } LIB3270_UINT_PROPERTY; |
| 62 | 62 | ... | ... |
src/lib3270/kybd.c
| ... | ... | @@ -2759,21 +2759,21 @@ int kybd_prime(H3270 *hSession) |
| 2759 | 2759 | } |
| 2760 | 2760 | #endif /*]*/ |
| 2761 | 2761 | |
| 2762 | -LIB3270_EXPORT int lib3270_set_unlock_delay(H3270 *session, int delay) | |
| 2762 | +LIB3270_EXPORT int lib3270_set_unlock_delay(H3270 *session, unsigned int delay) | |
| 2763 | 2763 | { |
| 2764 | 2764 | CHECK_SESSION_HANDLE(session); |
| 2765 | 2765 | |
| 2766 | - trace("%s(%d)",__FUNCTION__,(int) delay); | |
| 2766 | + trace("%s(%u)",__FUNCTION__,delay); | |
| 2767 | 2767 | |
| 2768 | 2768 | session->unlock_delay_ms = (unsigned short) delay; |
| 2769 | 2769 | |
| 2770 | 2770 | return 0; |
| 2771 | 2771 | } |
| 2772 | 2772 | |
| 2773 | -LIB3270_EXPORT int lib3270_get_unlock_delay(H3270 *session) | |
| 2773 | +LIB3270_EXPORT unsigned int lib3270_get_unlock_delay(H3270 *session) | |
| 2774 | 2774 | { |
| 2775 | 2775 | CHECK_SESSION_HANDLE(session); |
| 2776 | - return (int) session->unlock_delay_ms; | |
| 2776 | + return (unsigned int) session->unlock_delay_ms; | |
| 2777 | 2777 | |
| 2778 | 2778 | } |
| 2779 | 2779 | ... | ... |
src/lib3270/properties.c
| ... | ... | @@ -204,6 +204,41 @@ |
| 204 | 204 | |
| 205 | 205 | static const LIB3270_UINT_PROPERTY properties[] = { |
| 206 | 206 | |
| 207 | + { | |
| 208 | + "cursor_address", // Property name. | |
| 209 | + N_( "Cursor address" ), // Property description. | |
| 210 | + lib3270_get_cursor_address, // Get value. | |
| 211 | + lib3270_set_cursor_address // Set value. | |
| 212 | + }, | |
| 213 | + | |
| 214 | + { | |
| 215 | + "width",// Property name. | |
| 216 | + N_( "Current screen width in columns" ), // Property description. | |
| 217 | + lib3270_get_width, // Get value. | |
| 218 | + NULL // Set value. | |
| 219 | + }, | |
| 220 | + | |
| 221 | + { | |
| 222 | + "height", // Property name. | |
| 223 | + N_( "Current screen height in rows" ), // Property description. | |
| 224 | + lib3270_get_height, // Get value. | |
| 225 | + NULL // Set value. | |
| 226 | + }, | |
| 227 | + | |
| 228 | + { | |
| 229 | + "length", // Property name. | |
| 230 | + N_( "Screen buffer length in bytes" ), // Property description. | |
| 231 | + lib3270_get_length, // Get value. | |
| 232 | + NULL // Set value. | |
| 233 | + }, | |
| 234 | + | |
| 235 | + { | |
| 236 | + "unlock_delay", // Property name. | |
| 237 | + N_( "The delay between the host unlocking the keyboard and the actual unlock" ), // Property description. | |
| 238 | + lib3270_get_unlock_delay, // Get value. | |
| 239 | + lib3270_set_unlock_delay // Set value. | |
| 240 | + }, | |
| 241 | + | |
| 207 | 242 | /* |
| 208 | 243 | { |
| 209 | 244 | "", // Property name. |
| ... | ... | @@ -230,13 +265,6 @@ |
| 230 | 265 | static const LIB3270_INT_PROPERTY properties[] = { |
| 231 | 266 | |
| 232 | 267 | { |
| 233 | - "cursor_address", // Property name. | |
| 234 | - N_( "Cursor address" ), // Property description. | |
| 235 | - lib3270_get_cursor_address, // Get value. | |
| 236 | - lib3270_set_cursor_address // Set value. | |
| 237 | - }, | |
| 238 | - | |
| 239 | - { | |
| 240 | 268 | "model_number", // Property name. |
| 241 | 269 | N_( "The model number" ), // Property description. |
| 242 | 270 | lib3270_get_model_number, // Get value. |
| ... | ... | @@ -251,27 +279,6 @@ |
| 251 | 279 | }, |
| 252 | 280 | |
| 253 | 281 | { |
| 254 | - "width",// Property name. | |
| 255 | - N_( "Current screen width in columns" ), // Property description. | |
| 256 | - lib3270_get_width, // Get value. | |
| 257 | - NULL // Set value. | |
| 258 | - }, | |
| 259 | - | |
| 260 | - { | |
| 261 | - "height", // Property name. | |
| 262 | - N_( "Current screen width in rows" ), // Property description. | |
| 263 | - lib3270_get_height, // Get value. | |
| 264 | - NULL // Set value. | |
| 265 | - }, | |
| 266 | - | |
| 267 | - { | |
| 268 | - "length", // Property name. | |
| 269 | - N_( "Screen buffer length in bytes" ), // Property description. | |
| 270 | - lib3270_get_length, // Get value. | |
| 271 | - NULL // Set value. | |
| 272 | - }, | |
| 273 | - | |
| 274 | - { | |
| 275 | 282 | "cstate", // Property name. |
| 276 | 283 | N_( "Connection state" ), // Property description. |
| 277 | 284 | lib3270_get_connection_state_as_int, // Get value. |
| ... | ... | @@ -285,13 +292,6 @@ |
| 285 | 292 | NULL // Set value. |
| 286 | 293 | }, |
| 287 | 294 | |
| 288 | - { | |
| 289 | - "unlock_delay", // Property name. | |
| 290 | - N_( "The delay between the host unlocking the keyboard and the actual unlock" ), // Property description. | |
| 291 | - lib3270_get_unlock_delay, // Get value. | |
| 292 | - lib3270_set_unlock_delay // Set value. | |
| 293 | - }, | |
| 294 | - | |
| 295 | 295 | /* |
| 296 | 296 | { |
| 297 | 297 | "", // Property name. | ... | ... |
src/lib3270/screen.c
| ... | ... | @@ -404,10 +404,12 @@ void screen_update(H3270 *session, int bstart, int bend) |
| 404 | 404 | |
| 405 | 405 | } |
| 406 | 406 | |
| 407 | -LIB3270_EXPORT int lib3270_get_cursor_address(H3270 *h) | |
| 407 | +LIB3270_EXPORT unsigned int lib3270_get_cursor_address(H3270 *hSession) | |
| 408 | 408 | { |
| 409 | - CHECK_SESSION_HANDLE(h); | |
| 410 | - return h->cursor_addr; | |
| 409 | + if(check_online_session(hSession)) | |
| 410 | + return 0; | |
| 411 | + | |
| 412 | + return hSession->cursor_addr; | |
| 411 | 413 | } |
| 412 | 414 | |
| 413 | 415 | /** | ... | ... |
src/lib3270/selection/actions.c
| ... | ... | @@ -290,14 +290,14 @@ LIB3270_EXPORT int lib3270_move_selection(H3270 *hSession, LIB3270_DIRECTION dir |
| 290 | 290 | switch(dir) |
| 291 | 291 | { |
| 292 | 292 | case LIB3270_DIR_UP: |
| 293 | - if(start <= hSession->cols) | |
| 293 | + if(start <= ((int) hSession->cols)) | |
| 294 | 294 | return EINVAL; |
| 295 | 295 | start -= hSession->cols; |
| 296 | 296 | end -= hSession->cols; |
| 297 | 297 | break; |
| 298 | 298 | |
| 299 | 299 | case LIB3270_DIR_DOWN: |
| 300 | - if(end >= (hSession->cols * (hSession->rows-1))) | |
| 300 | + if(end >= ((int) (hSession->cols * (hSession->rows-1)))) | |
| 301 | 301 | return EINVAL; |
| 302 | 302 | start += hSession->cols; |
| 303 | 303 | end += hSession->cols; | ... | ... |