Commit adbd6ec9ec36d5a4c45ee3d9c8854a7aca07a8a6
1 parent
eb133874
Exists in
master
and in
1 other branch
Setting local charset on the constructor because python is always UTF-8,
even on windows.
Showing
12 changed files
with
24 additions
and
24 deletions
Show diff stats
client/src/core/abstract.cc
... | ... | @@ -98,7 +98,7 @@ |
98 | 98 | if(this->converter.host != (iconv_t) (-1)) |
99 | 99 | iconv_close(converter.host); |
100 | 100 | |
101 | - if(strcmp(local,remote)) { | |
101 | + if(remote && strcmp(local,remote)) { | |
102 | 102 | |
103 | 103 | // Local and remote charsets aren't the same, setup conversion |
104 | 104 | converter.local = iconv_open(local, remote); | ... | ... |
client/src/core/session.cc
... | ... | @@ -44,10 +44,10 @@ |
44 | 44 | |
45 | 45 | namespace TN3270 { |
46 | 46 | |
47 | - Session * Session::getInstance(const char *id) { | |
47 | + Session * Session::getInstance(const char *id, const char *charset) { | |
48 | 48 | |
49 | 49 | if(!(id && *id)) { |
50 | - return Local::getSessionInstance(); | |
50 | + return Local::getSessionInstance(charset); | |
51 | 51 | } |
52 | 52 | |
53 | 53 | if(*id == ':') { |
... | ... | @@ -55,11 +55,11 @@ |
55 | 55 | std::string name{LIB3270_STRINGIZE_VALUE_OF(PRODUCT_NAME)}; |
56 | 56 | name += id; |
57 | 57 | |
58 | - return IPC::getSessionInstance(name.c_str()); | |
58 | + return IPC::getSessionInstance(name.c_str(), charset); | |
59 | 59 | |
60 | 60 | } |
61 | 61 | |
62 | - return IPC::getSessionInstance(id); | |
62 | + return IPC::getSessionInstance(id, charset); | |
63 | 63 | |
64 | 64 | } |
65 | 65 | ... | ... |
client/src/core/windows/attribute.cc
... | ... | @@ -58,7 +58,7 @@ |
58 | 58 | attributes.push_back((const LIB3270_PROPERTY *) prop); |
59 | 59 | } |
60 | 60 | |
61 | - for(auto prop = lib3270_get_toggle_list(); prop->name; prop++) { | |
61 | + for(auto prop = lib3270_get_toggles(); prop->name; prop++) { | |
62 | 62 | attributes.push_back((const LIB3270_PROPERTY *) prop); |
63 | 63 | } |
64 | 64 | ... | ... |
client/src/host/init.cc
... | ... | @@ -40,12 +40,12 @@ |
40 | 40 | |
41 | 41 | /*---[ Implement ]----------------------------------------------------------------------------------*/ |
42 | 42 | |
43 | -TN3270::Host::Host(const char *id, const char *url, time_t timeout) { | |
43 | +TN3270::Host::Host(const char *id, const char *url, time_t timeout, const char *charset) { | |
44 | 44 | |
45 | 45 | debug("Creating host id=\"", id); |
46 | 46 | |
47 | 47 | this->timeout = timeout; |
48 | - this->session = Session::getInstance(id); | |
48 | + this->session = Session::getInstance(id, charset); | |
49 | 49 | if(url) { |
50 | 50 | this->connect(url); |
51 | 51 | } | ... | ... |
client/src/include/ipc-client-internals.h
... | ... | @@ -203,14 +203,14 @@ |
203 | 203 | /// @brief lib3270 direct access objects (no IPC); |
204 | 204 | namespace Local { |
205 | 205 | |
206 | - TN3270_PRIVATE Session * getSessionInstance(); | |
206 | + TN3270_PRIVATE Session * getSessionInstance(const char *charset = nullptr); | |
207 | 207 | |
208 | 208 | } |
209 | 209 | |
210 | 210 | /// @brief IPC Based acess (Access an active instance of pw3270 or pw3270d) |
211 | 211 | namespace IPC { |
212 | 212 | |
213 | - TN3270_PRIVATE TN3270::Session * getSessionInstance(const char *id); | |
213 | + TN3270_PRIVATE TN3270::Session * getSessionInstance(const char *id, const char *charset = nullptr); | |
214 | 214 | class Session; |
215 | 215 | |
216 | 216 | } | ... | ... |
client/src/include/lib3270/ipc.h
... | ... | @@ -451,7 +451,7 @@ |
451 | 451 | public: |
452 | 452 | |
453 | 453 | /// @brief Get an instance of the TN3270 session based on the supplied ID. |
454 | - static Session * getInstance(const char *id = nullptr); | |
454 | + static Session * getInstance(const char *id = nullptr, const char *charset = nullptr); | |
455 | 455 | virtual ~Session(); |
456 | 456 | |
457 | 457 | // States |
... | ... | @@ -675,7 +675,7 @@ |
675 | 675 | */ |
676 | 676 | |
677 | 677 | public: |
678 | - Host(const char *id = nullptr, const char *url = nullptr, time_t timeout = DEFAULT_TIMEOUT); | |
678 | + Host(const char *id = nullptr, const char *url = nullptr, time_t timeout = DEFAULT_TIMEOUT, const char *charset = nullptr); | |
679 | 679 | ~Host(); |
680 | 680 | |
681 | 681 | inline bool operator==(ConnectionState state) const noexcept { | ... | ... |
client/src/session/local/init.cc
... | ... | @@ -55,11 +55,11 @@ |
55 | 55 | |
56 | 56 | namespace TN3270 { |
57 | 57 | |
58 | - Session * Local::getSessionInstance() { | |
59 | - return new Local::Session(); | |
58 | + Session * Local::getSessionInstance(const char *charset) { | |
59 | + return new Local::Session(charset); | |
60 | 60 | } |
61 | 61 | |
62 | - Local::Session::Session() : Abstract::Session() { | |
62 | + Local::Session::Session(const char *charset) : Abstract::Session() { | |
63 | 63 | |
64 | 64 | std::lock_guard<std::mutex> lock(sync); |
65 | 65 | |
... | ... | @@ -67,7 +67,7 @@ |
67 | 67 | |
68 | 68 | lib3270_set_user_data(this->hSession,(void *) this); |
69 | 69 | |
70 | - setCharSet(); | |
70 | + this->setCharSet(charset); | |
71 | 71 | |
72 | 72 | lib3270_set_popup_handler(this->hSession, popupHandler); |
73 | 73 | ... | ... |
client/src/session/local/private.h
client/src/session/remote/linux/session.cc
... | ... | @@ -60,7 +60,7 @@ |
60 | 60 | |
61 | 61 | namespace TN3270 { |
62 | 62 | |
63 | - IPC::Session::Session(const char *id) : Abstract::Session() { | |
63 | + IPC::Session::Session(const char *id, const char *charset) : Abstract::Session() { | |
64 | 64 | |
65 | 65 | // Create D-Bus session. |
66 | 66 | DBusError err; |
... | ... | @@ -92,7 +92,7 @@ |
92 | 92 | |
93 | 93 | debug("D-Bus Object name=\"",this->name,"\" D-Bus Object path=\"",this->path,"\""); |
94 | 94 | |
95 | - setCharSet(); | |
95 | + setCharSet(charset); | |
96 | 96 | |
97 | 97 | } |
98 | 98 | ... | ... |
client/src/session/remote/private.h
client/src/session/remote/tools.cc
... | ... | @@ -42,8 +42,8 @@ |
42 | 42 | |
43 | 43 | namespace TN3270 { |
44 | 44 | |
45 | - Session * IPC::getSessionInstance(const char *id) { | |
46 | - return new IPC::Session(id); | |
45 | + Session * IPC::getSessionInstance(const char *id, const char *charset) { | |
46 | + return new IPC::Session(id,charset); | |
47 | 47 | } |
48 | 48 | |
49 | 49 | ... | ... |
client/src/session/remote/windows/session.cc
... | ... | @@ -48,7 +48,7 @@ |
48 | 48 | |
49 | 49 | namespace TN3270 { |
50 | 50 | |
51 | - IPC::Session::Session(const char *id) : Abstract::Session() { | |
51 | + IPC::Session::Session(const char *id, const char *charset) : Abstract::Session() { | |
52 | 52 | |
53 | 53 | const char *ptr = strchr(id,':'); |
54 | 54 | |
... | ... | @@ -86,7 +86,7 @@ |
86 | 86 | throw std::runtime_error("Can't set IPC Channel mode"); |
87 | 87 | } |
88 | 88 | |
89 | - setCharSet(); | |
89 | + this->setCharSet(charset); | |
90 | 90 | } |
91 | 91 | |
92 | 92 | IPC::Session::~Session() { | ... | ... |