diff options
| author | Tim Hentenaar <tim@hentenaar.com> | 2025-07-11 10:02:03 -0400 |
|---|---|---|
| committer | Tim Hentenaar <tim@hentenaar.com> | 2025-07-11 10:17:31 -0400 |
| commit | 18cd58b7fe3b3de39ba4e65fe37796f53684f586 (patch) | |
| tree | 5ccc106622899aa935b7c5a204f8fae02b1c6eee | |
| parent | 7dcd7b6325464459a859c67f1eb269dcdafa1192 (diff) | |
utils: Format the protocol verison number proper to avoid confusion
Part-of: <https://gitlab.freedesktop.org/xorg/app/editres/-/merge_requests/7>
| -rw-r--r-- | app-defaults/Editres | 2 | ||||
| -rw-r--r-- | editresP.h | 12 | ||||
| -rw-r--r-- | handler.c | 3 | ||||
| -rw-r--r-- | utils.c | 10 |
4 files changed, 9 insertions, 18 deletions
diff --git a/app-defaults/Editres b/app-defaults/Editres index e9ddd90..14eecae 100644 --- a/app-defaults/Editres +++ b/app-defaults/Editres @@ -89,7 +89,7 @@ Editres.Geometry: 500x568 *label33: Internal Error: Unknown activate type. *label34: Only one Resource Box can be active at a time. *label35: Unable to unpack protocol request. -*label36: This version of editres uses protocol version %s,\nbut the client speaks version %s. +*label36: This version of editres uses protocol version %d,\nbut the client speaks version %d. ! Xt Messages @@ -38,13 +38,11 @@ in this Software without prior written authorization from The Open Group. # define CLIENT_TIME_OUT 5000 /* wait five seconds for the client. */ #endif /* DEBUG */ -#define PROTOCOL_VERSION_ONE_POINT_ONE 5 /* version 1.1 */ -#define ONE_POINT_ONE_STRING "1.1" -#define PROTOCOL_VERSION_ONE_POINT_ZERO 4 /* version 1.0 */ -#define ONE_POINT_ZERO_STRING "1.0" ONE_POINT_ONE_STRING - -#define CURRENT_PROTOCOL_VERSION PROTOCOL_VERSION_ONE_POINT_ONE -#define CURRENT_PROTOCOL_VERSION_STRING ONE_POINT_ONE_STRING +/** + * Current version of the editres protocol. Must be kept in sync with + * libXmu. + */ +#define CURRENT_PROTOCOL_VERSION 5 #define FLASH_TIME 1000 /* Default flash time in microseconds */ #define NUM_FLASHES 3 /* Default number of flashes. */ @@ -521,8 +521,7 @@ ResourceListCallback(Widget list, XtPointer node_ptr, XtPointer junk) SetResourceString(list, node_ptr, junk); /* get the resource value from the application */ - if (global_effective_protocol_version >= - PROTOCOL_VERSION_ONE_POINT_ONE && do_get_values) { + if (global_effective_protocol_version >= 5 && do_get_values) { ObtainResource(node_ptr); do_get_values = False; } @@ -855,20 +855,14 @@ GetFailureMessage(ProtocolStream *stream) char * ProtocolFailure(ProtocolStream *stream) { - char buf[BUFSIZ]; + char buf[128]; unsigned char version; - const char* old_version_string; if (!_XEditResGet8(stream, &version)) return(XtNewString(res_labels[35])); - switch ((int)version) { - case PROTOCOL_VERSION_ONE_POINT_ZERO: old_version_string = "1.0"; break; - default: old_version_string = "1.0"; - } - snprintf(buf, sizeof(buf), res_labels[36], - CURRENT_PROTOCOL_VERSION_STRING, old_version_string); + CURRENT_PROTOCOL_VERSION, version); return(XtNewString(buf)); } |
