From 106e20f914cf80b53ff7d52fc97981de4146d7af Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Tue, 17 Sep 2019 16:10:45 -0300 Subject: [PATCH] Fixing boolean properties. --- client/src/session/local/properties.cc | 25 +++++++++++++++++++++++-- client/src/testprogram/testprogram.cc | 4 ++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/client/src/session/local/properties.cc b/client/src/session/local/properties.cc index aa4cdeb..6df5da8 100644 --- a/client/src/session/local/properties.cc +++ b/client/src/session/local/properties.cc @@ -126,6 +126,25 @@ } + const LIB3270_INT_PROPERTY * intprop = lib3270_get_boolean_properties_list(); + for(size_t ix = 0; intprop[ix].name; ix++) { + + if(!strcasecmp(name,intprop[ix].name)) { + + errno = 0; + int value = intprop[ix].get(hSession); + + if(errno != 0) { + throw std::system_error(errno, std::system_category()); + } + + return TN3270::Property::create(value); + + } + + } + + } // Not found! @@ -165,12 +184,14 @@ std::lock_guard lock(const_cast(this)->sync); + errno = 0; value = intprop[ix].get(hSession); - if(value < 0 && errno != 0) { - throw std::system_error(errno, std::system_category()); + if(errno == 0) { + return; } + throw std::system_error(errno, std::system_category()); } diff --git a/client/src/testprogram/testprogram.cc b/client/src/testprogram/testprogram.cc index 977c208..4e9720d 100644 --- a/client/src/testprogram/testprogram.cc +++ b/client/src/testprogram/testprogram.cc @@ -96,6 +96,10 @@ cout << "Property[version]: " << version->toString() << endl; delete version; + auto connected = host["connected"]; + cout << "Property[connected]: " << connected->toString() << endl; + delete connected; + cout << "Version: " << host.getVersion() << "\tRevision: " << host.getRevision() -- libgit2 0.21.2