Commit 4cbfb6771f87725efbe0ae4a1da84b2ccbe5ea9e
1 parent
ea56dee9
Exists in
master
and in
1 other branch
Fixing small hllapi bugs.
Showing
3 changed files
with
19 additions
and
18 deletions
Show diff stats
.gitignore
src/hllapi/calls.cc
| ... | ... | @@ -55,7 +55,11 @@ |
| 55 | 55 | delete hSession; |
| 56 | 56 | hSession = session::create(mode); |
| 57 | 57 | |
| 58 | - session::get_default()->set_display_charset(); | |
| 58 | + if(!hSession) { | |
| 59 | + return HLLAPI_STATUS_UNAVAILABLE; | |
| 60 | + } | |
| 61 | + | |
| 62 | + hSession->set_display_charset(); | |
| 59 | 63 | |
| 60 | 64 | trace("hSession=%p",hSession); |
| 61 | 65 | } |
| ... | ... | @@ -65,7 +69,8 @@ |
| 65 | 69 | return HLLAPI_STATUS_SYSTEM_ERROR; |
| 66 | 70 | } |
| 67 | 71 | |
| 68 | - return hSession ? HLLAPI_STATUS_SUCCESS : HLLAPI_STATUS_UNAVAILABLE; | |
| 72 | + return HLLAPI_STATUS_SUCCESS; | |
| 73 | + | |
| 69 | 74 | } |
| 70 | 75 | |
| 71 | 76 | HLLAPI_API_CALL hllapi_deinit(void) | ... | ... |
src/ipc3270c/windows/main.c
| ... | ... | @@ -185,7 +185,7 @@ |
| 185 | 185 | WriteFile(source->hPipe,&pkt,wrote,&wrote,NULL); |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | - static int do_file_transfer(struct hllapi_packet_file_transfer * source) | |
| 188 | + static int do_file_transfer(struct hllapi_packet_file_transfer G_GNUC_UNUSED(* source)) | |
| 189 | 189 | { |
| 190 | 190 | /* |
| 191 | 191 | const gchar * local = (const char *) source->text; |
| ... | ... | @@ -598,13 +598,13 @@ |
| 598 | 598 | LIB3270_EXPORT int pw3270_plugin_start(GtkWidget *window, GtkWidget *terminal) |
| 599 | 599 | { |
| 600 | 600 | char id; |
| 601 | - const gchar * name = "pw3270"; | |
| 601 | + const gchar * name = gtk_widget_get_name(window); | |
| 602 | 602 | |
| 603 | 603 | for(id='A';id < 'Z';id++) |
| 604 | 604 | { |
| 605 | - gchar * pipename = g_strdup_printf("\\\\.\\pipe\\%s_%c",name,id); | |
| 606 | - gchar * ptr; | |
| 607 | - HANDLE hPipe; | |
| 605 | + g_autofree gchar * pipename = g_strdup_printf("\\\\.\\pipe\\%s_%c",name,id); | |
| 606 | + gchar * ptr; | |
| 607 | + HANDLE hPipe; | |
| 608 | 608 | |
| 609 | 609 | for(ptr=pipename;*ptr;ptr++) |
| 610 | 610 | *ptr = g_ascii_tolower(*ptr); |
| ... | ... | @@ -622,7 +622,6 @@ |
| 622 | 622 | NULL); // default security attributes |
| 623 | 623 | |
| 624 | 624 | trace("%s = %p",pipename,hPipe); |
| 625 | - g_free(pipename); | |
| 626 | 625 | |
| 627 | 626 | if(hPipe != INVALID_HANDLE_VALUE) |
| 628 | 627 | { |
| ... | ... | @@ -635,15 +634,8 @@ |
| 635 | 634 | IO_closure, |
| 636 | 635 | NULL |
| 637 | 636 | }; |
| 638 | - pipe_source * source; | |
| 639 | - gchar * session = g_strdup_printf("%s:%c",name,id); | |
| 640 | - | |
| 641 | - // pw3270_set_session_name(window,session); | |
| 642 | - v3270_set_session_name(terminal,session); | |
| 643 | - | |
| 644 | - g_free(session); | |
| 645 | - | |
| 646 | - source = (pipe_source *) g_source_new(&pipe_source_funcs,sizeof(pipe_source)); | |
| 637 | + g_autofree gchar * session = g_strdup_printf("%s:%c",name,id); | |
| 638 | + pipe_source * source = (pipe_source *) g_source_new(&pipe_source_funcs,sizeof(pipe_source)); | |
| 647 | 639 | |
| 648 | 640 | source->hPipe = hPipe; |
| 649 | 641 | source->state = PIPE_STATE_WAITING; |
| ... | ... | @@ -652,6 +644,9 @@ |
| 652 | 644 | g_source_attach((GSource *) source,NULL); |
| 653 | 645 | IO_accept(source); |
| 654 | 646 | |
| 647 | + v3270_set_session_name(terminal,session); | |
| 648 | + g_message("Session %s attached to %s",session,pipename); | |
| 649 | + | |
| 655 | 650 | return 0; |
| 656 | 651 | } |
| 657 | 652 | |
| ... | ... | @@ -662,7 +657,7 @@ |
| 662 | 657 | return -1; |
| 663 | 658 | } |
| 664 | 659 | |
| 665 | - LIB3270_EXPORT int pw3270_plugin_stop(GtkWidget *window, GtkWidget *terminal) | |
| 660 | + LIB3270_EXPORT int pw3270_plugin_stop(GtkWidget G_GNUC_UNUSED(*window), GtkWidget G_GNUC_UNUSED(*terminal)) | |
| 666 | 661 | { |
| 667 | 662 | |
| 668 | 663 | return 0; | ... | ... |