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,7 +55,11 @@ | ||
55 | delete hSession; | 55 | delete hSession; |
56 | hSession = session::create(mode); | 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 | trace("hSession=%p",hSession); | 64 | trace("hSession=%p",hSession); |
61 | } | 65 | } |
@@ -65,7 +69,8 @@ | @@ -65,7 +69,8 @@ | ||
65 | return HLLAPI_STATUS_SYSTEM_ERROR; | 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 | HLLAPI_API_CALL hllapi_deinit(void) | 76 | HLLAPI_API_CALL hllapi_deinit(void) |
src/ipc3270c/windows/main.c
@@ -185,7 +185,7 @@ | @@ -185,7 +185,7 @@ | ||
185 | WriteFile(source->hPipe,&pkt,wrote,&wrote,NULL); | 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 | const gchar * local = (const char *) source->text; | 191 | const gchar * local = (const char *) source->text; |
@@ -598,13 +598,13 @@ | @@ -598,13 +598,13 @@ | ||
598 | LIB3270_EXPORT int pw3270_plugin_start(GtkWidget *window, GtkWidget *terminal) | 598 | LIB3270_EXPORT int pw3270_plugin_start(GtkWidget *window, GtkWidget *terminal) |
599 | { | 599 | { |
600 | char id; | 600 | char id; |
601 | - const gchar * name = "pw3270"; | 601 | + const gchar * name = gtk_widget_get_name(window); |
602 | 602 | ||
603 | for(id='A';id < 'Z';id++) | 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 | for(ptr=pipename;*ptr;ptr++) | 609 | for(ptr=pipename;*ptr;ptr++) |
610 | *ptr = g_ascii_tolower(*ptr); | 610 | *ptr = g_ascii_tolower(*ptr); |
@@ -622,7 +622,6 @@ | @@ -622,7 +622,6 @@ | ||
622 | NULL); // default security attributes | 622 | NULL); // default security attributes |
623 | 623 | ||
624 | trace("%s = %p",pipename,hPipe); | 624 | trace("%s = %p",pipename,hPipe); |
625 | - g_free(pipename); | ||
626 | 625 | ||
627 | if(hPipe != INVALID_HANDLE_VALUE) | 626 | if(hPipe != INVALID_HANDLE_VALUE) |
628 | { | 627 | { |
@@ -635,15 +634,8 @@ | @@ -635,15 +634,8 @@ | ||
635 | IO_closure, | 634 | IO_closure, |
636 | NULL | 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 | source->hPipe = hPipe; | 640 | source->hPipe = hPipe; |
649 | source->state = PIPE_STATE_WAITING; | 641 | source->state = PIPE_STATE_WAITING; |
@@ -652,6 +644,9 @@ | @@ -652,6 +644,9 @@ | ||
652 | g_source_attach((GSource *) source,NULL); | 644 | g_source_attach((GSource *) source,NULL); |
653 | IO_accept(source); | 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 | return 0; | 650 | return 0; |
656 | } | 651 | } |
657 | 652 | ||
@@ -662,7 +657,7 @@ | @@ -662,7 +657,7 @@ | ||
662 | return -1; | 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 | return 0; | 663 | return 0; |