Commit 8a40574bc8550debac45dec54dfe067fbf7c3098
1 parent
4d1647fa
Exists in
master
and in
5 other branches
Debuggando gerenciamento de memória a procura de segfaults aleatórios
Showing
54 changed files
with
645 additions
and
635 deletions
Show diff stats
@@ -0,0 +1,8 @@ | @@ -0,0 +1,8 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<classpath> | ||
3 | + <classpathentry kind="src" path="src"/> | ||
4 | + <classpathentry kind="src" path="gen"/> | ||
5 | + <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/> | ||
6 | + <classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/> | ||
7 | + <classpathentry kind="output" path="bin/classes"/> | ||
8 | +</classpath> |
@@ -0,0 +1,23 @@ | @@ -0,0 +1,23 @@ | ||
1 | +<?xml version="1.0" encoding="utf-8"?> | ||
2 | +<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
3 | + package="br.com.bb.pw3270" | ||
4 | + android:versionCode="1" | ||
5 | + android:versionName="1.0" > | ||
6 | + | ||
7 | + <uses-sdk android:minSdkVersion="15" /> | ||
8 | + | ||
9 | + <application | ||
10 | + android:icon="@drawable/ic_launcher" | ||
11 | + android:label="@string/app_name" > | ||
12 | + <activity | ||
13 | + android:name=".PW3270Activity" | ||
14 | + android:label="@string/app_name" > | ||
15 | + <intent-filter> | ||
16 | + <action android:name="android.intent.action.MAIN" /> | ||
17 | + | ||
18 | + <category android:name="android.intent.category.LAUNCHER" /> | ||
19 | + </intent-filter> | ||
20 | + </activity> | ||
21 | + </application> | ||
22 | + | ||
23 | +</manifest> | ||
0 | \ No newline at end of file | 24 | \ No newline at end of file |
@@ -0,0 +1,40 @@ | @@ -0,0 +1,40 @@ | ||
1 | +# | ||
2 | +# "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | ||
3 | +# (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | ||
4 | +# aplicativos mainframe. Registro no INPI sob o nome G3270. | ||
5 | +# | ||
6 | +# Copyright (C) <2008> <Banco do Brasil S.A.> | ||
7 | +# | ||
8 | +# Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | ||
9 | +# os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | ||
10 | +# Free Software Foundation. | ||
11 | +# | ||
12 | +# Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | ||
13 | +# GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | ||
14 | +# A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | ||
15 | +# obter mais detalhes. | ||
16 | +# | ||
17 | +# Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | ||
18 | +# programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple | ||
19 | +# Place, Suite 330, Boston, MA, 02111-1307, USA | ||
20 | +# | ||
21 | +# Contatos: | ||
22 | +# | ||
23 | +# perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | ||
24 | +# | ||
25 | + | ||
26 | +JAVAH=javah | ||
27 | +NDKBUILD=/opt/android-ndk-r8/ndk-build | ||
28 | +CLASSPATH=br/com/bb/pw3270 | ||
29 | + | ||
30 | +Debug: jni/lib3270jni.h | ||
31 | + @$(NDKBUILD) | ||
32 | + | ||
33 | +clean: | ||
34 | + @rm -fr obj | ||
35 | + @rm -f jni/lib3270jni.h | ||
36 | + | ||
37 | +jni/lib3270jni.h: bin/classes/$(CLASSPATH)/lib3270.class | ||
38 | + @echo $@ ... | ||
39 | + @$(JAVAH) -o $@ -classpath bin/classes $(subst /,.,$(CLASSPATH)).lib3270 | ||
40 | + |
@@ -0,0 +1,39 @@ | @@ -0,0 +1,39 @@ | ||
1 | +# | ||
2 | +# "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | ||
3 | +# (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | ||
4 | +# aplicativos mainframe. Registro no INPI sob o nome G3270. | ||
5 | +# | ||
6 | +# Copyright (C) <2008> <Banco do Brasil S.A.> | ||
7 | +# | ||
8 | +# Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | ||
9 | +# os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | ||
10 | +# Free Software Foundation. | ||
11 | +# | ||
12 | +# Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | ||
13 | +# GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | ||
14 | +# A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | ||
15 | +# obter mais detalhes. | ||
16 | +# | ||
17 | +# Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | ||
18 | +# programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple | ||
19 | +# Place, Suite 330, Boston, MA, 02111-1307, USA | ||
20 | +# | ||
21 | +# Contatos: | ||
22 | +# | ||
23 | +# perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | ||
24 | +# | ||
25 | + | ||
26 | +LOCAL_PATH := $(call my-dir) | ||
27 | + | ||
28 | +include $(CLEAR_VARS) | ||
29 | + | ||
30 | +include ../src/lib3270/sources.mak | ||
31 | + | ||
32 | +LOCAL_CFLAGS=-I../src/include | ||
33 | +LOCAL_DEFAULT_CPP_EXTENSION := cpp | ||
34 | +LOCAL_MODULE := lib3270 | ||
35 | +LOCAL_SRC_FILES := $(foreach SRC, $(TERMINAL_SOURCES), ../../src/lib3270/$(SRC)) \ | ||
36 | + main.cpp misc.cpp | ||
37 | + | ||
38 | +include $(BUILD_SHARED_LIBRARY) | ||
39 | + |
@@ -0,0 +1,30 @@ | @@ -0,0 +1,30 @@ | ||
1 | +/* | ||
2 | + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | ||
3 | + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | ||
4 | + * aplicativos mainframe. Registro no INPI sob o nome G3270. Registro no INPI sob o nome G3270. | ||
5 | + * | ||
6 | + * Copyright (C) <2008> <Banco do Brasil S.A.> | ||
7 | + * | ||
8 | + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | ||
9 | + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | ||
10 | + * Free Software Foundation. | ||
11 | + * | ||
12 | + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | ||
13 | + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | ||
14 | + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | ||
15 | + * obter mais detalhes. | ||
16 | + * | ||
17 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | ||
18 | + * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple | ||
19 | + * Place, Suite 330, Boston, MA, 02111-1307, USA | ||
20 | + * | ||
21 | + * Este programa está nomeado como globals.h e possui - linhas de código. | ||
22 | + * | ||
23 | + * Contatos: | ||
24 | + * | ||
25 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | ||
26 | + * | ||
27 | + */ | ||
28 | + | ||
29 | + #include "lib3270jni.h" | ||
30 | + #include <lib3270.h> |
@@ -0,0 +1,80 @@ | @@ -0,0 +1,80 @@ | ||
1 | +/* | ||
2 | + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | ||
3 | + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | ||
4 | + * aplicativos mainframe. Registro no INPI sob o nome G3270. Registro no INPI sob o nome G3270. | ||
5 | + * | ||
6 | + * Copyright (C) <2008> <Banco do Brasil S.A.> | ||
7 | + * | ||
8 | + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | ||
9 | + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | ||
10 | + * Free Software Foundation. | ||
11 | + * | ||
12 | + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | ||
13 | + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | ||
14 | + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | ||
15 | + * obter mais detalhes. | ||
16 | + * | ||
17 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | ||
18 | + * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple | ||
19 | + * Place, Suite 330, Boston, MA, 02111-1307, USA | ||
20 | + * | ||
21 | + * Este programa está nomeado como main.cpp e possui - linhas de código. | ||
22 | + * | ||
23 | + * Contatos: | ||
24 | + * | ||
25 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | ||
26 | + * | ||
27 | + */ | ||
28 | + | ||
29 | + #include "globals.h" | ||
30 | + #include <lib3270/session.h> | ||
31 | + | ||
32 | +/*--[ Defines ]--------------------------------------------------------------------------------------*/ | ||
33 | + | ||
34 | + typedef struct _info | ||
35 | + { | ||
36 | + JNIEnv * env; | ||
37 | + jobject obj; | ||
38 | + | ||
39 | + } INFO; | ||
40 | + | ||
41 | +/*--[ Implement ]------------------------------------------------------------------------------------*/ | ||
42 | + | ||
43 | +JNIEXPORT jint JNICALL Java_br_com_bb_pw3270_lib3270_init(JNIEnv *env, jclass obj) | ||
44 | +{ | ||
45 | + H3270 * session = lib3270_session_new(""); | ||
46 | + | ||
47 | + return 0; | ||
48 | +} | ||
49 | + | ||
50 | +JNIEXPORT jint JNICALL Java_br_com_bb_pw3270_lib3270_processEvents(JNIEnv *env, jobject obj) | ||
51 | +{ | ||
52 | + INFO data = { env, obj }; | ||
53 | + H3270 * session = lib3270_get_default_session_handle(); | ||
54 | + | ||
55 | + session->widget = &data; | ||
56 | + lib3270_main_iterate(session,1); | ||
57 | + session->widget = 0; | ||
58 | + return 0; | ||
59 | +} | ||
60 | + | ||
61 | +JNIEXPORT jboolean JNICALL Java_br_com_bb_pw3270_lib3270_isConnected(JNIEnv *env, jobject obj) | ||
62 | +{ | ||
63 | + return (lib3270_connected(lib3270_get_default_session_handle())) ? JNI_TRUE : JNI_FALSE;; | ||
64 | +} | ||
65 | + | ||
66 | +JNIEXPORT jboolean JNICALL Java_br_com_bb_pw3270_lib3270_isTerminalReady(JNIEnv *env, jobject obj) | ||
67 | +{ | ||
68 | + return JNI_FALSE; | ||
69 | +} | ||
70 | + | ||
71 | +JNIEXPORT void JNICALL Java_br_com_bb_pw3270_lib3270_setHost(JNIEnv *env, jobject obj, jstring hostname) | ||
72 | +{ | ||
73 | + lib3270_set_host(lib3270_get_default_session_handle(),env->GetStringUTFChars(hostname, 0)); | ||
74 | +} | ||
75 | + | ||
76 | +JNIEXPORT jstring JNICALL Java_br_com_bb_pw3270_lib3270_getHost(JNIEnv *env, jobject obj) | ||
77 | +{ | ||
78 | + return env->NewStringUTF(lib3270_get_host(lib3270_get_default_session_handle())); | ||
79 | +} | ||
80 | + |
@@ -0,0 +1,46 @@ | @@ -0,0 +1,46 @@ | ||
1 | +/* | ||
2 | + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | ||
3 | + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | ||
4 | + * aplicativos mainframe. Registro no INPI sob o nome G3270. Registro no INPI sob o nome G3270. | ||
5 | + * | ||
6 | + * Copyright (C) <2008> <Banco do Brasil S.A.> | ||
7 | + * | ||
8 | + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | ||
9 | + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | ||
10 | + * Free Software Foundation. | ||
11 | + * | ||
12 | + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | ||
13 | + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | ||
14 | + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | ||
15 | + * obter mais detalhes. | ||
16 | + * | ||
17 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | ||
18 | + * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple | ||
19 | + * Place, Suite 330, Boston, MA, 02111-1307, USA | ||
20 | + * | ||
21 | + * Este programa está nomeado como misc.cpp e possui - linhas de código. | ||
22 | + * | ||
23 | + * Contatos: | ||
24 | + * | ||
25 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | ||
26 | + * | ||
27 | + */ | ||
28 | + | ||
29 | + #include "globals.h" | ||
30 | + | ||
31 | +/*--[ Implement ]------------------------------------------------------------------------------------*/ | ||
32 | + | ||
33 | +JNIEXPORT jstring JNICALL Java_br_com_bb_pw3270_lib3270_getVersion(JNIEnv *env, jobject obj) | ||
34 | +{ | ||
35 | + return env->NewStringUTF(lib3270_get_version()); | ||
36 | +} | ||
37 | + | ||
38 | +JNIEXPORT jstring JNICALL Java_br_com_bb_pw3270_lib3270_getRevision(JNIEnv *env, jobject obj) | ||
39 | +{ | ||
40 | + return env->NewStringUTF(lib3270_get_revision()); | ||
41 | +} | ||
42 | + | ||
43 | +JNIEXPORT jstring JNICALL Java_br_com_bb_pw3270_lib3270_getEncoding(JNIEnv *env, jobject obj) | ||
44 | +{ | ||
45 | + return env->NewStringUTF(lib3270_get_charset(lib3270_get_default_session_handle())); | ||
46 | +} |
@@ -0,0 +1,46 @@ | @@ -0,0 +1,46 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> | ||
2 | +<CodeBlocks_project_file> | ||
3 | + <FileVersion major="1" minor="6" /> | ||
4 | + <Project> | ||
5 | + <Option title="lib3270 android NDK" /> | ||
6 | + <Option makefile_is_custom="1" /> | ||
7 | + <Option pch_mode="2" /> | ||
8 | + <Option compiler="gcc" /> | ||
9 | + <Build> | ||
10 | + <Target title="Debug"> | ||
11 | + <Option output=".bin/Debug/lib3270 android NDK" prefix_auto="1" extension_auto="1" /> | ||
12 | + <Option object_output=".obj/Debug/" /> | ||
13 | + <Option type="1" /> | ||
14 | + <Option compiler="gcc" /> | ||
15 | + <Compiler> | ||
16 | + <Add option="-g" /> | ||
17 | + </Compiler> | ||
18 | + </Target> | ||
19 | + <Target title="Release"> | ||
20 | + <Option output=".bin/Release/lib3270 android NDK" prefix_auto="1" extension_auto="1" /> | ||
21 | + <Option object_output=".obj/Release/" /> | ||
22 | + <Option type="1" /> | ||
23 | + <Option compiler="gcc" /> | ||
24 | + <Compiler> | ||
25 | + <Add option="-O2" /> | ||
26 | + </Compiler> | ||
27 | + <Linker> | ||
28 | + <Add option="-s" /> | ||
29 | + </Linker> | ||
30 | + </Target> | ||
31 | + </Build> | ||
32 | + <Compiler> | ||
33 | + <Add option="-Wall" /> | ||
34 | + </Compiler> | ||
35 | + <Unit filename="Makefile" /> | ||
36 | + <Unit filename="jni/Android.mk" /> | ||
37 | + <Unit filename="jni/globals.h" /> | ||
38 | + <Unit filename="jni/main.cpp" /> | ||
39 | + <Unit filename="jni/misc.cpp" /> | ||
40 | + <Unit filename="src/br/com/bb/pw3270/lib3270.java" /> | ||
41 | + <Extensions> | ||
42 | + <code_completion /> | ||
43 | + <debugger /> | ||
44 | + </Extensions> | ||
45 | + </Project> | ||
46 | +</CodeBlocks_project_file> |
@@ -0,0 +1,20 @@ | @@ -0,0 +1,20 @@ | ||
1 | +# To enable ProGuard in your project, edit project.properties | ||
2 | +# to define the proguard.config property as described in that file. | ||
3 | +# | ||
4 | +# Add project specific ProGuard rules here. | ||
5 | +# By default, the flags in this file are appended to flags specified | ||
6 | +# in ${sdk.dir}/tools/proguard/proguard-android.txt | ||
7 | +# You can edit the include path and order by changing the ProGuard | ||
8 | +# include property in project.properties. | ||
9 | +# | ||
10 | +# For more details, see | ||
11 | +# http://developer.android.com/guide/developing/tools/proguard.html | ||
12 | + | ||
13 | +# Add any project specific keep options here: | ||
14 | + | ||
15 | +# If your project uses WebView with JS, uncomment the following | ||
16 | +# and specify the fully qualified class name to the JavaScript interface | ||
17 | +# class: | ||
18 | +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
19 | +# public *; | ||
20 | +#} |
@@ -0,0 +1,14 @@ | @@ -0,0 +1,14 @@ | ||
1 | +# This file is automatically generated by Android Tools. | ||
2 | +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! | ||
3 | +# | ||
4 | +# This file must be checked in Version Control Systems. | ||
5 | +# | ||
6 | +# To customize properties used by the Ant build system edit | ||
7 | +# "ant.properties", and override values to adapt the script to your | ||
8 | +# project structure. | ||
9 | +# | ||
10 | +# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): | ||
11 | +#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt | ||
12 | + | ||
13 | +# Project target. | ||
14 | +target=android-15 |
@@ -0,0 +1,33 @@ | @@ -0,0 +1,33 @@ | ||
1 | +<?xml version="1.0" encoding="utf-8"?> | ||
2 | +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
3 | + android:layout_width="fill_parent" | ||
4 | + android:layout_height="fill_parent" | ||
5 | + android:orientation="vertical" > | ||
6 | + | ||
7 | + <LinearLayout | ||
8 | + android:layout_width="match_parent" | ||
9 | + android:layout_height="wrap_content" > | ||
10 | + | ||
11 | + <EditText | ||
12 | + android:id="@+id/editText1" | ||
13 | + android:layout_width="match_parent" | ||
14 | + android:layout_height="match_parent" | ||
15 | + android:layout_weight="1" | ||
16 | + android:ems="10" /> | ||
17 | + | ||
18 | + <Button | ||
19 | + android:id="@+id/connect" | ||
20 | + style="?android:attr/buttonStyleSmall" | ||
21 | + android:layout_width="80dp" | ||
22 | + android:layout_height="match_parent" | ||
23 | + android:text="Connect" /> | ||
24 | + | ||
25 | + </LinearLayout> | ||
26 | + | ||
27 | + <TextView | ||
28 | + android:id="@+id/text" | ||
29 | + android:layout_width="fill_parent" | ||
30 | + android:layout_height="match_parent" | ||
31 | + android:text="@string/hello" /> | ||
32 | + | ||
33 | +</LinearLayout> | ||
0 | \ No newline at end of file | 34 | \ No newline at end of file |
@@ -0,0 +1,27 @@ | @@ -0,0 +1,27 @@ | ||
1 | +package br.com.bb.pw3270; | ||
2 | + | ||
3 | +import android.app.Activity; | ||
4 | +import android.os.Bundle; | ||
5 | +import android.widget.TextView; | ||
6 | +import android.widget.Button; | ||
7 | + | ||
8 | +public class PW3270Activity extends Activity { | ||
9 | + | ||
10 | + lib3270 host; | ||
11 | + | ||
12 | + /** Called when the activity is first created. */ | ||
13 | + @Override | ||
14 | + public void onCreate(Bundle savedInstanceState) { | ||
15 | + super.onCreate(savedInstanceState); | ||
16 | + setContentView(R.layout.main); | ||
17 | + | ||
18 | + TextView text = (TextView) findViewById(R.id.text); | ||
19 | + Button btn = (Button) findViewById(R.id.connect); | ||
20 | + | ||
21 | + | ||
22 | + | ||
23 | + host = new lib3270(); | ||
24 | + | ||
25 | + text.setText(host.getVersion()); | ||
26 | + } | ||
27 | +} | ||
0 | \ No newline at end of file | 28 | \ No newline at end of file |
@@ -0,0 +1,60 @@ | @@ -0,0 +1,60 @@ | ||
1 | +package br.com.bb.pw3270; | ||
2 | + | ||
3 | +import java.lang.Thread; | ||
4 | + | ||
5 | +public class lib3270 extends Thread | ||
6 | +{ | ||
7 | + | ||
8 | + static | ||
9 | + { | ||
10 | + System.loadLibrary("3270"); | ||
11 | + init(); | ||
12 | + } | ||
13 | + | ||
14 | + /** | ||
15 | + * @param args | ||
16 | + */ | ||
17 | + public static void main(String[] args) | ||
18 | + { | ||
19 | + // TODO Auto-generated method stub | ||
20 | + | ||
21 | + } | ||
22 | + | ||
23 | + /** | ||
24 | + * Connect to host, keep event loop running until disconnected. | ||
25 | + */ | ||
26 | + public void run() | ||
27 | + { | ||
28 | + do_connect(); | ||
29 | + while(isConnected()) | ||
30 | + processEvents(); | ||
31 | + } | ||
32 | + | ||
33 | + static private native int init(); | ||
34 | + | ||
35 | + private native int processEvents(); | ||
36 | + private native int do_connect(); | ||
37 | + | ||
38 | + // Misc calls | ||
39 | + public native String getEncoding(); | ||
40 | + | ||
41 | + public native String getVersion(); | ||
42 | + public native String getRevision(); | ||
43 | + | ||
44 | + // Connect/Disconnect status | ||
45 | + public native void setHost(String host); | ||
46 | + public native String getHost(); | ||
47 | + public native boolean isConnected(); | ||
48 | + public native boolean isTerminalReady(); | ||
49 | + | ||
50 | + public void connect(String hostname) | ||
51 | + { | ||
52 | + setHost(hostname); | ||
53 | + start(); | ||
54 | + } | ||
55 | + | ||
56 | + | ||
57 | + | ||
58 | + | ||
59 | + | ||
60 | +} |
pw3270.cbp
@@ -47,6 +47,7 @@ | @@ -47,6 +47,7 @@ | ||
47 | <Unit filename="pw3270.spec.in" /> | 47 | <Unit filename="pw3270.spec.in" /> |
48 | <Unit filename="src/android/jni/main.cpp" /> | 48 | <Unit filename="src/android/jni/main.cpp" /> |
49 | <Unit filename="src/android/jni/misc.cpp" /> | 49 | <Unit filename="src/android/jni/misc.cpp" /> |
50 | + <Unit filename="src/android/src/br/com/bb/pw3270/lib3270.java" /> | ||
50 | <Unit filename="src/include/lib3270.h" /> | 51 | <Unit filename="src/include/lib3270.h" /> |
51 | <Unit filename="src/include/lib3270/action_table.h" /> | 52 | <Unit filename="src/include/lib3270/action_table.h" /> |
52 | <Unit filename="src/include/lib3270/actions.h" /> | 53 | <Unit filename="src/include/lib3270/actions.h" /> |
src/android/.classpath
@@ -1,8 +0,0 @@ | @@ -1,8 +0,0 @@ | ||
1 | -<?xml version="1.0" encoding="UTF-8"?> | ||
2 | -<classpath> | ||
3 | - <classpathentry kind="src" path="src"/> | ||
4 | - <classpathentry kind="src" path="gen"/> | ||
5 | - <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/> | ||
6 | - <classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/> | ||
7 | - <classpathentry kind="output" path="bin/classes"/> | ||
8 | -</classpath> |
src/android/AndroidManifest.xml
@@ -1,23 +0,0 @@ | @@ -1,23 +0,0 @@ | ||
1 | -<?xml version="1.0" encoding="utf-8"?> | ||
2 | -<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
3 | - package="br.com.bb.pw3270" | ||
4 | - android:versionCode="1" | ||
5 | - android:versionName="1.0" > | ||
6 | - | ||
7 | - <uses-sdk android:minSdkVersion="15" /> | ||
8 | - | ||
9 | - <application | ||
10 | - android:icon="@drawable/ic_launcher" | ||
11 | - android:label="@string/app_name" > | ||
12 | - <activity | ||
13 | - android:name=".PW3270Activity" | ||
14 | - android:label="@string/app_name" > | ||
15 | - <intent-filter> | ||
16 | - <action android:name="android.intent.action.MAIN" /> | ||
17 | - | ||
18 | - <category android:name="android.intent.category.LAUNCHER" /> | ||
19 | - </intent-filter> | ||
20 | - </activity> | ||
21 | - </application> | ||
22 | - | ||
23 | -</manifest> | ||
24 | \ No newline at end of file | 0 | \ No newline at end of file |
src/android/Makefile
@@ -1,40 +0,0 @@ | @@ -1,40 +0,0 @@ | ||
1 | -# | ||
2 | -# "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | ||
3 | -# (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | ||
4 | -# aplicativos mainframe. Registro no INPI sob o nome G3270. | ||
5 | -# | ||
6 | -# Copyright (C) <2008> <Banco do Brasil S.A.> | ||
7 | -# | ||
8 | -# Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | ||
9 | -# os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | ||
10 | -# Free Software Foundation. | ||
11 | -# | ||
12 | -# Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | ||
13 | -# GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | ||
14 | -# A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | ||
15 | -# obter mais detalhes. | ||
16 | -# | ||
17 | -# Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | ||
18 | -# programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple | ||
19 | -# Place, Suite 330, Boston, MA, 02111-1307, USA | ||
20 | -# | ||
21 | -# Contatos: | ||
22 | -# | ||
23 | -# perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | ||
24 | -# | ||
25 | - | ||
26 | -JAVAH=javah | ||
27 | -NDKBUILD=/opt/android-ndk-r8/ndk-build | ||
28 | -CLASSPATH=br/com/bb/pw3270 | ||
29 | - | ||
30 | -Debug: jni/lib3270jni.h | ||
31 | - @$(NDKBUILD) | ||
32 | - | ||
33 | -clean: | ||
34 | - @rm -fr obj | ||
35 | - @rm -f jni/lib3270jni.h | ||
36 | - | ||
37 | -jni/lib3270jni.h: bin/classes/$(CLASSPATH)/lib3270.class | ||
38 | - @echo $@ ... | ||
39 | - @$(JAVAH) -o $@ -classpath bin/classes $(subst /,.,$(CLASSPATH)).lib3270 | ||
40 | - |
src/android/jni/Android.mk
@@ -1,39 +0,0 @@ | @@ -1,39 +0,0 @@ | ||
1 | -# | ||
2 | -# "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | ||
3 | -# (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | ||
4 | -# aplicativos mainframe. Registro no INPI sob o nome G3270. | ||
5 | -# | ||
6 | -# Copyright (C) <2008> <Banco do Brasil S.A.> | ||
7 | -# | ||
8 | -# Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | ||
9 | -# os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | ||
10 | -# Free Software Foundation. | ||
11 | -# | ||
12 | -# Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | ||
13 | -# GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | ||
14 | -# A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | ||
15 | -# obter mais detalhes. | ||
16 | -# | ||
17 | -# Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | ||
18 | -# programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple | ||
19 | -# Place, Suite 330, Boston, MA, 02111-1307, USA | ||
20 | -# | ||
21 | -# Contatos: | ||
22 | -# | ||
23 | -# perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | ||
24 | -# | ||
25 | - | ||
26 | -LOCAL_PATH := $(call my-dir) | ||
27 | - | ||
28 | -include $(CLEAR_VARS) | ||
29 | - | ||
30 | -include ../lib3270/sources.mak | ||
31 | - | ||
32 | -LOCAL_CFLAGS=-I../include | ||
33 | -LOCAL_DEFAULT_CPP_EXTENSION := cpp | ||
34 | -LOCAL_MODULE := lib3270 | ||
35 | -LOCAL_SRC_FILES := $(foreach SRC, $(TERMINAL_SOURCES), ../../lib3270/$(SRC)) \ | ||
36 | - main.cpp misc.cpp | ||
37 | - | ||
38 | -include $(BUILD_SHARED_LIBRARY) | ||
39 | - |
src/android/jni/globals.h
@@ -1,30 +0,0 @@ | @@ -1,30 +0,0 @@ | ||
1 | -/* | ||
2 | - * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | ||
3 | - * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | ||
4 | - * aplicativos mainframe. Registro no INPI sob o nome G3270. Registro no INPI sob o nome G3270. | ||
5 | - * | ||
6 | - * Copyright (C) <2008> <Banco do Brasil S.A.> | ||
7 | - * | ||
8 | - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | ||
9 | - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | ||
10 | - * Free Software Foundation. | ||
11 | - * | ||
12 | - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | ||
13 | - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | ||
14 | - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | ||
15 | - * obter mais detalhes. | ||
16 | - * | ||
17 | - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | ||
18 | - * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple | ||
19 | - * Place, Suite 330, Boston, MA, 02111-1307, USA | ||
20 | - * | ||
21 | - * Este programa está nomeado como globals.h e possui - linhas de código. | ||
22 | - * | ||
23 | - * Contatos: | ||
24 | - * | ||
25 | - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | ||
26 | - * | ||
27 | - */ | ||
28 | - | ||
29 | - #include "lib3270jni.h" | ||
30 | - #include <lib3270.h> |
src/android/jni/main.cpp
@@ -1,83 +0,0 @@ | @@ -1,83 +0,0 @@ | ||
1 | -/* | ||
2 | - * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | ||
3 | - * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | ||
4 | - * aplicativos mainframe. Registro no INPI sob o nome G3270. Registro no INPI sob o nome G3270. | ||
5 | - * | ||
6 | - * Copyright (C) <2008> <Banco do Brasil S.A.> | ||
7 | - * | ||
8 | - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | ||
9 | - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | ||
10 | - * Free Software Foundation. | ||
11 | - * | ||
12 | - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | ||
13 | - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | ||
14 | - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | ||
15 | - * obter mais detalhes. | ||
16 | - * | ||
17 | - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | ||
18 | - * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple | ||
19 | - * Place, Suite 330, Boston, MA, 02111-1307, USA | ||
20 | - * | ||
21 | - * Este programa está nomeado como main.cpp e possui - linhas de código. | ||
22 | - * | ||
23 | - * Contatos: | ||
24 | - * | ||
25 | - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | ||
26 | - * | ||
27 | - */ | ||
28 | - | ||
29 | - #include "globals.h" | ||
30 | - #include <lib3270/session.h> | ||
31 | - | ||
32 | -/*--[ Defines ]--------------------------------------------------------------------------------------*/ | ||
33 | - | ||
34 | - typedef struct _info | ||
35 | - { | ||
36 | - JNIEnv * env; | ||
37 | - jobject obj; | ||
38 | - | ||
39 | - } INFO; | ||
40 | - | ||
41 | -/*--[ Implement ]------------------------------------------------------------------------------------*/ | ||
42 | - | ||
43 | -JNIEXPORT jint JNICALL Java_br_com_bb_pw3270_lib3270_init(JNIEnv *env, jclass obj) | ||
44 | -{ | ||
45 | - H3270 * session = lib3270_session_new(""); | ||
46 | - | ||
47 | - return 0; | ||
48 | -} | ||
49 | - | ||
50 | -JNIEXPORT jint JNICALL Java_br_com_bb_pw3270_lib3270_processEvents(JNIEnv *env, jobject obj) | ||
51 | -{ | ||
52 | - /* | ||
53 | - INFO data = { env, obj }; | ||
54 | - H3270 * session = lib3270_get_default_session_handle(); | ||
55 | - | ||
56 | - session->widget = &data; | ||
57 | - lib3270_main_iterate(session,1); | ||
58 | - session->widget = 0; | ||
59 | - */ | ||
60 | - return 0; | ||
61 | -} | ||
62 | - | ||
63 | -JNIEXPORT jboolean JNICALL Java_br_com_bb_pw3270_lib3270_isConnected(JNIEnv *env, jobject obj) | ||
64 | -{ | ||
65 | -// return (lib3270_connected(lib3270_get_default_session_handle())) ? JNI_TRUE : JNI_FALSE;; | ||
66 | - return JNI_FALSE; | ||
67 | -} | ||
68 | - | ||
69 | -JNIEXPORT jboolean JNICALL Java_br_com_bb_pw3270_lib3270_isTerminalReady(JNIEnv *env, jobject obj) | ||
70 | -{ | ||
71 | - return JNI_FALSE; | ||
72 | -} | ||
73 | - | ||
74 | -JNIEXPORT void JNICALL Java_br_com_bb_pw3270_lib3270_setHost(JNIEnv *env, jobject obj, jstring hostname) | ||
75 | -{ | ||
76 | - | ||
77 | -} | ||
78 | - | ||
79 | -JNIEXPORT jstring JNICALL Java_br_com_bb_pw3270_lib3270_getHost(JNIEnv *env, jobject obj) | ||
80 | -{ | ||
81 | - return env->NewStringUTF(""); | ||
82 | -} | ||
83 | - |
src/android/jni/misc.cpp
@@ -1,46 +0,0 @@ | @@ -1,46 +0,0 @@ | ||
1 | -/* | ||
2 | - * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | ||
3 | - * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | ||
4 | - * aplicativos mainframe. Registro no INPI sob o nome G3270. Registro no INPI sob o nome G3270. | ||
5 | - * | ||
6 | - * Copyright (C) <2008> <Banco do Brasil S.A.> | ||
7 | - * | ||
8 | - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | ||
9 | - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | ||
10 | - * Free Software Foundation. | ||
11 | - * | ||
12 | - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | ||
13 | - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | ||
14 | - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | ||
15 | - * obter mais detalhes. | ||
16 | - * | ||
17 | - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | ||
18 | - * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple | ||
19 | - * Place, Suite 330, Boston, MA, 02111-1307, USA | ||
20 | - * | ||
21 | - * Este programa está nomeado como misc.cpp e possui - linhas de código. | ||
22 | - * | ||
23 | - * Contatos: | ||
24 | - * | ||
25 | - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | ||
26 | - * | ||
27 | - */ | ||
28 | - | ||
29 | - #include "globals.h" | ||
30 | - | ||
31 | -/*--[ Implement ]------------------------------------------------------------------------------------*/ | ||
32 | - | ||
33 | -JNIEXPORT jstring JNICALL Java_br_com_bb_pw3270_lib3270_getVersion(JNIEnv *env, jobject obj) | ||
34 | -{ | ||
35 | - return env->NewStringUTF(lib3270_get_version()); | ||
36 | -} | ||
37 | - | ||
38 | -JNIEXPORT jstring JNICALL Java_br_com_bb_pw3270_lib3270_getRevision(JNIEnv *env, jobject obj) | ||
39 | -{ | ||
40 | - return env->NewStringUTF(lib3270_get_revision()); | ||
41 | -} | ||
42 | - | ||
43 | -JNIEXPORT jstring JNICALL Java_br_com_bb_pw3270_lib3270_getEncoding(JNIEnv *env, jobject obj) | ||
44 | -{ | ||
45 | - return env->NewStringUTF(lib3270_get_charset(lib3270_get_default_session_handle())); | ||
46 | -} |
src/android/lib3270NDK.cbp
@@ -1,46 +0,0 @@ | @@ -1,46 +0,0 @@ | ||
1 | -<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> | ||
2 | -<CodeBlocks_project_file> | ||
3 | - <FileVersion major="1" minor="6" /> | ||
4 | - <Project> | ||
5 | - <Option title="lib3270 android NDK" /> | ||
6 | - <Option makefile_is_custom="1" /> | ||
7 | - <Option pch_mode="2" /> | ||
8 | - <Option compiler="gcc" /> | ||
9 | - <Build> | ||
10 | - <Target title="Debug"> | ||
11 | - <Option output=".bin/Debug/lib3270 android NDK" prefix_auto="1" extension_auto="1" /> | ||
12 | - <Option object_output=".obj/Debug/" /> | ||
13 | - <Option type="1" /> | ||
14 | - <Option compiler="gcc" /> | ||
15 | - <Compiler> | ||
16 | - <Add option="-g" /> | ||
17 | - </Compiler> | ||
18 | - </Target> | ||
19 | - <Target title="Release"> | ||
20 | - <Option output=".bin/Release/lib3270 android NDK" prefix_auto="1" extension_auto="1" /> | ||
21 | - <Option object_output=".obj/Release/" /> | ||
22 | - <Option type="1" /> | ||
23 | - <Option compiler="gcc" /> | ||
24 | - <Compiler> | ||
25 | - <Add option="-O2" /> | ||
26 | - </Compiler> | ||
27 | - <Linker> | ||
28 | - <Add option="-s" /> | ||
29 | - </Linker> | ||
30 | - </Target> | ||
31 | - </Build> | ||
32 | - <Compiler> | ||
33 | - <Add option="-Wall" /> | ||
34 | - </Compiler> | ||
35 | - <Unit filename="Makefile" /> | ||
36 | - <Unit filename="jni/Android.mk" /> | ||
37 | - <Unit filename="jni/globals.h" /> | ||
38 | - <Unit filename="jni/main.cpp" /> | ||
39 | - <Unit filename="jni/misc.cpp" /> | ||
40 | - <Unit filename="src/br/com/bb/pw3270/lib3270.java" /> | ||
41 | - <Extensions> | ||
42 | - <code_completion /> | ||
43 | - <debugger /> | ||
44 | - </Extensions> | ||
45 | - </Project> | ||
46 | -</CodeBlocks_project_file> |
src/android/proguard-project.txt
@@ -1,20 +0,0 @@ | @@ -1,20 +0,0 @@ | ||
1 | -# To enable ProGuard in your project, edit project.properties | ||
2 | -# to define the proguard.config property as described in that file. | ||
3 | -# | ||
4 | -# Add project specific ProGuard rules here. | ||
5 | -# By default, the flags in this file are appended to flags specified | ||
6 | -# in ${sdk.dir}/tools/proguard/proguard-android.txt | ||
7 | -# You can edit the include path and order by changing the ProGuard | ||
8 | -# include property in project.properties. | ||
9 | -# | ||
10 | -# For more details, see | ||
11 | -# http://developer.android.com/guide/developing/tools/proguard.html | ||
12 | - | ||
13 | -# Add any project specific keep options here: | ||
14 | - | ||
15 | -# If your project uses WebView with JS, uncomment the following | ||
16 | -# and specify the fully qualified class name to the JavaScript interface | ||
17 | -# class: | ||
18 | -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
19 | -# public *; | ||
20 | -#} |
src/android/project.properties
@@ -1,14 +0,0 @@ | @@ -1,14 +0,0 @@ | ||
1 | -# This file is automatically generated by Android Tools. | ||
2 | -# Do not modify this file -- YOUR CHANGES WILL BE ERASED! | ||
3 | -# | ||
4 | -# This file must be checked in Version Control Systems. | ||
5 | -# | ||
6 | -# To customize properties used by the Ant build system edit | ||
7 | -# "ant.properties", and override values to adapt the script to your | ||
8 | -# project structure. | ||
9 | -# | ||
10 | -# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): | ||
11 | -#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt | ||
12 | - | ||
13 | -# Project target. | ||
14 | -target=android-15 |
src/android/res/layout/main.xml
@@ -1,33 +0,0 @@ | @@ -1,33 +0,0 @@ | ||
1 | -<?xml version="1.0" encoding="utf-8"?> | ||
2 | -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
3 | - android:layout_width="fill_parent" | ||
4 | - android:layout_height="fill_parent" | ||
5 | - android:orientation="vertical" > | ||
6 | - | ||
7 | - <LinearLayout | ||
8 | - android:layout_width="match_parent" | ||
9 | - android:layout_height="wrap_content" > | ||
10 | - | ||
11 | - <EditText | ||
12 | - android:id="@+id/editText1" | ||
13 | - android:layout_width="match_parent" | ||
14 | - android:layout_height="match_parent" | ||
15 | - android:layout_weight="1" | ||
16 | - android:ems="10" /> | ||
17 | - | ||
18 | - <Button | ||
19 | - android:id="@+id/connect" | ||
20 | - style="?android:attr/buttonStyleSmall" | ||
21 | - android:layout_width="80dp" | ||
22 | - android:layout_height="match_parent" | ||
23 | - android:text="Connect" /> | ||
24 | - | ||
25 | - </LinearLayout> | ||
26 | - | ||
27 | - <TextView | ||
28 | - android:id="@+id/text" | ||
29 | - android:layout_width="fill_parent" | ||
30 | - android:layout_height="match_parent" | ||
31 | - android:text="@string/hello" /> | ||
32 | - | ||
33 | -</LinearLayout> | ||
34 | \ No newline at end of file | 0 | \ No newline at end of file |
src/android/src/br/com/bb/pw3270/PW3270Activity.java
@@ -1,27 +0,0 @@ | @@ -1,27 +0,0 @@ | ||
1 | -package br.com.bb.pw3270; | ||
2 | - | ||
3 | -import android.app.Activity; | ||
4 | -import android.os.Bundle; | ||
5 | -import android.widget.TextView; | ||
6 | -import android.widget.Button; | ||
7 | - | ||
8 | -public class PW3270Activity extends Activity { | ||
9 | - | ||
10 | - lib3270 host; | ||
11 | - | ||
12 | - /** Called when the activity is first created. */ | ||
13 | - @Override | ||
14 | - public void onCreate(Bundle savedInstanceState) { | ||
15 | - super.onCreate(savedInstanceState); | ||
16 | - setContentView(R.layout.main); | ||
17 | - | ||
18 | - TextView text = (TextView) findViewById(R.id.text); | ||
19 | - Button btn = (Button) findViewById(R.id.connect); | ||
20 | - | ||
21 | - | ||
22 | - | ||
23 | - host = new lib3270(); | ||
24 | - | ||
25 | - text.setText(host.getVersion()); | ||
26 | - } | ||
27 | -} | ||
28 | \ No newline at end of file | 0 | \ No newline at end of file |
src/android/src/br/com/bb/pw3270/lib3270.java
@@ -1,50 +0,0 @@ | @@ -1,50 +0,0 @@ | ||
1 | -package br.com.bb.pw3270; | ||
2 | - | ||
3 | -import java.lang.Thread; | ||
4 | - | ||
5 | -public class lib3270 extends Thread | ||
6 | -{ | ||
7 | - | ||
8 | - static | ||
9 | - { | ||
10 | - System.loadLibrary("3270"); | ||
11 | - init(); | ||
12 | - } | ||
13 | - | ||
14 | - /** | ||
15 | - * @param args | ||
16 | - */ | ||
17 | - public static void main(String[] args) | ||
18 | - { | ||
19 | - // TODO Auto-generated method stub | ||
20 | - | ||
21 | - } | ||
22 | - | ||
23 | - /** | ||
24 | - * Connect to host, keep event loop running until disconnected. | ||
25 | - */ | ||
26 | - public void run() | ||
27 | - { | ||
28 | - while(isConnected()) | ||
29 | - processEvents(); | ||
30 | - } | ||
31 | - | ||
32 | - static private native int init(); | ||
33 | - private native int processEvents(); | ||
34 | - | ||
35 | - // Misc calls | ||
36 | - public native String getEncoding(); | ||
37 | - | ||
38 | - public native String getVersion(); | ||
39 | - public native String getRevision(); | ||
40 | - | ||
41 | - // Connect/Disconnect status | ||
42 | - public native void setHost(String host); | ||
43 | - public native String getHost(); | ||
44 | - public native boolean isConnected(); | ||
45 | - public native boolean isTerminalReady(); | ||
46 | - | ||
47 | - | ||
48 | - | ||
49 | - | ||
50 | -} |
src/include/lib3270/session.h
@@ -96,6 +96,7 @@ | @@ -96,6 +96,7 @@ | ||
96 | int inlcr : 1; | 96 | int inlcr : 1; |
97 | int onlcr : 1; | 97 | int onlcr : 1; |
98 | int bsd_tm : 1; | 98 | int bsd_tm : 1; |
99 | + int syncing : 1; | ||
99 | 100 | ||
100 | char * oversize; | 101 | char * oversize; |
101 | 102 | ||
@@ -174,6 +175,7 @@ | @@ -174,6 +175,7 @@ | ||
174 | // xio | 175 | // xio |
175 | void * ns_read_id; | 176 | void * ns_read_id; |
176 | void * ns_exception_id; | 177 | void * ns_exception_id; |
178 | + | ||
177 | char reading; | 179 | char reading; |
178 | char excepting; | 180 | char excepting; |
179 | 181 |
src/lib3270/XtGlue.c
@@ -38,7 +38,7 @@ | @@ -38,7 +38,7 @@ | ||
38 | 38 | ||
39 | #include "globals.h" | 39 | #include "globals.h" |
40 | #include "api.h" | 40 | #include "api.h" |
41 | -#include <malloc.h> | 41 | +// #include <malloc.h> |
42 | 42 | ||
43 | #if defined(_WIN32) | 43 | #if defined(_WIN32) |
44 | #include "appres.h" | 44 | #include "appres.h" |
@@ -179,8 +179,7 @@ static void * DefaultAddTimeOut(unsigned long interval_ms, H3270 *session, void | @@ -179,8 +179,7 @@ static void * DefaultAddTimeOut(unsigned long interval_ms, H3270 *session, void | ||
179 | 179 | ||
180 | Trace("%s session=%p proc=%p",__FUNCTION__,session,proc); | 180 | Trace("%s session=%p proc=%p",__FUNCTION__,session,proc); |
181 | 181 | ||
182 | - t_new = (timeout_t *)Malloc(sizeof(timeout_t)); | ||
183 | - memset(t_new,0,sizeof(timeout_t)); | 182 | + t_new = (timeout_t *) lib3270_malloc(sizeof(timeout_t)); |
184 | 183 | ||
185 | t_new->proc = proc; | 184 | t_new->proc = proc; |
186 | t_new->session = session; | 185 | t_new->session = session; |
@@ -244,7 +243,7 @@ static void DefaultRemoveTimeOut(void * timer) | @@ -244,7 +243,7 @@ static void DefaultRemoveTimeOut(void * timer) | ||
244 | prev->next = t->next; | 243 | prev->next = t->next; |
245 | else | 244 | else |
246 | timeouts = t->next; | 245 | timeouts = t->next; |
247 | - Free(t); | 246 | + lib3270_free(t); |
248 | return; | 247 | return; |
249 | } | 248 | } |
250 | prev = t; | 249 | prev = t; |
@@ -268,8 +267,7 @@ static void * DefaultAddInput(int source, H3270 *session, void (*fn)(H3270 *sess | @@ -268,8 +267,7 @@ static void * DefaultAddInput(int source, H3270 *session, void (*fn)(H3270 *sess | ||
268 | 267 | ||
269 | Trace("%s session=%p proc=%p",__FUNCTION__,session,fn); | 268 | Trace("%s session=%p proc=%p",__FUNCTION__,session,fn); |
270 | 269 | ||
271 | - ip = (input_t *) Malloc(sizeof(input_t)); | ||
272 | - memset(ip,0,sizeof(input_t)); | 270 | + ip = (input_t *) lib3270_malloc(sizeof(input_t)); |
273 | 271 | ||
274 | ip->source = source; | 272 | ip->source = source; |
275 | ip->condition = InputReadMask; | 273 | ip->condition = InputReadMask; |
@@ -293,8 +291,7 @@ static void * DefaultAddExcept(int source, H3270 *session, void (*fn)(H3270 *ses | @@ -293,8 +291,7 @@ static void * DefaultAddExcept(int source, H3270 *session, void (*fn)(H3270 *ses | ||
293 | 291 | ||
294 | Trace("%s session=%p proc=%p",__FUNCTION__,session,fn); | 292 | Trace("%s session=%p proc=%p",__FUNCTION__,session,fn); |
295 | 293 | ||
296 | - ip = (input_t *)Malloc(sizeof(input_t)); | ||
297 | - memset(ip,0,sizeof(input_t)); | 294 | + ip = (input_t *) lib3270_malloc(sizeof(input_t)); |
298 | 295 | ||
299 | ip->source = source; | 296 | ip->source = source; |
300 | ip->condition = InputExceptMask; | 297 | ip->condition = InputExceptMask; |
@@ -317,7 +314,7 @@ static void * DefaultAddOutput(int source, H3270 *session, void (*fn)(H3270 *ses | @@ -317,7 +314,7 @@ static void * DefaultAddOutput(int source, H3270 *session, void (*fn)(H3270 *ses | ||
317 | 314 | ||
318 | Trace("%s session=%p proc=%p",__FUNCTION__,session,fn); | 315 | Trace("%s session=%p proc=%p",__FUNCTION__,session,fn); |
319 | 316 | ||
320 | - ip = (input_t *)Malloc(sizeof(input_t)); | 317 | + ip = (input_t *)lib3270_malloc(sizeof(input_t)); |
321 | memset(ip,0,sizeof(input_t)); | 318 | memset(ip,0,sizeof(input_t)); |
322 | 319 | ||
323 | ip->source = source; | 320 | ip->source = source; |
@@ -356,7 +353,7 @@ static void DefaultRemoveInput(void *id) | @@ -356,7 +353,7 @@ static void DefaultRemoveInput(void *id) | ||
356 | else | 353 | else |
357 | inputs = ip->next; | 354 | inputs = ip->next; |
358 | 355 | ||
359 | - Free(ip); | 356 | + lib3270_free(ip); |
360 | inputs_changed = True; | 357 | inputs_changed = True; |
361 | } | 358 | } |
362 | 359 | ||
@@ -545,7 +542,7 @@ static int DefaultProcessEvents(int block) | @@ -545,7 +542,7 @@ static int DefaultProcessEvents(int block) | ||
545 | t->in_play = True; | 542 | t->in_play = True; |
546 | (*t->proc)(t->session); | 543 | (*t->proc)(t->session); |
547 | processed_any = True; | 544 | processed_any = True; |
548 | - Free(t); | 545 | + lib3270_free(t); |
549 | } else | 546 | } else |
550 | break; | 547 | break; |
551 | } | 548 | } |
src/lib3270/actions.c
@@ -163,10 +163,10 @@ action_internal(XtActionProc action, enum iaction cause, const char *parm1, | @@ -163,10 +163,10 @@ action_internal(XtActionProc action, enum iaction cause, const char *parm1, | ||
163 | // Free the parm copies. | 163 | // Free the parm copies. |
164 | switch (count) { | 164 | switch (count) { |
165 | case 2: | 165 | case 2: |
166 | - Free(parms[1]); | 166 | + lib3270_free(parms[1]); |
167 | // fall through... | 167 | // fall through... |
168 | case 1: | 168 | case 1: |
169 | - Free(parms[0]); | 169 | + lib3270_free(parms[0]); |
170 | break; | 170 | break; |
171 | default: | 171 | default: |
172 | break; | 172 | break; |
src/lib3270/ansi.c
@@ -600,7 +600,7 @@ ansi_reset(int ig1 unused, int ig2 unused) | @@ -600,7 +600,7 @@ ansi_reset(int ig1 unused, int ig2 unused) | ||
600 | saved_altbuffer = False; | 600 | saved_altbuffer = False; |
601 | scroll_top = 1; | 601 | scroll_top = 1; |
602 | scroll_bottom = h3270.rows; | 602 | scroll_bottom = h3270.rows; |
603 | - Replace(tabs, (unsigned char *)Malloc((h3270.cols+7)/8)); | 603 | + Replace(tabs, (unsigned char *)lib3270_malloc((h3270.cols+7)/8)); |
604 | for (i = 0; i < (h3270.cols+7)/8; i++) | 604 | for (i = 0; i < (h3270.cols+7)/8; i++) |
605 | tabs[i] = 0x01; | 605 | tabs[i] = 0x01; |
606 | held_wrap = False; | 606 | held_wrap = False; |
src/lib3270/charset.c
@@ -227,7 +227,7 @@ enum cs_result charset_init(H3270 *session, const char *csname) | @@ -227,7 +227,7 @@ enum cs_result charset_init(H3270 *session, const char *csname) | ||
227 | // Grab the non-Euro definition. | 227 | // Grab the non-Euro definition. |
228 | basename = xs_buffer("%.*s", (int) (strlen(csname) - ES_SIZE), csname); | 228 | basename = xs_buffer("%.*s", (int) (strlen(csname) - ES_SIZE), csname); |
229 | cs = get_charset_def(basename); | 229 | cs = get_charset_def(basename); |
230 | - Free(basename); | 230 | + lib3270_free(basename); |
231 | } | 231 | } |
232 | */ | 232 | */ |
233 | if (!ccs) | 233 | if (!ccs) |
@@ -251,8 +251,8 @@ enum cs_result charset_init(H3270 *session, const char *csname) | @@ -251,8 +251,8 @@ enum cs_result charset_init(H3270 *session, const char *csname) | ||
251 | rc = resource_charset(csname, ccs, cftcs); | 251 | rc = resource_charset(csname, ccs, cftcs); |
252 | 252 | ||
253 | /* Free them. */ | 253 | /* Free them. */ |
254 | - Free(ccs); | ||
255 | - Free(cftcs); | 254 | + lib3270_free(ccs); |
255 | + lib3270_free(cftcs); | ||
256 | 256 | ||
257 | #if defined(DEBUG_CHARSET) /*[*/ | 257 | #if defined(DEBUG_CHARSET) /*[*/ |
258 | if (rc == CS_OKAY) | 258 | if (rc == CS_OKAY) |
@@ -340,7 +340,7 @@ static void set_cgcsgids(const char *spec) | @@ -340,7 +340,7 @@ static void set_cgcsgids(const char *spec) | ||
340 | } | 340 | } |
341 | n_ids++; | 341 | n_ids++; |
342 | } | 342 | } |
343 | - Free(spec_copy); | 343 | + lib3270_free(spec_copy); |
344 | if (n_ids > 0) | 344 | if (n_ids > 0) |
345 | return; | 345 | return; |
346 | } | 346 | } |
@@ -681,7 +681,7 @@ static enum cs_result remap_chars(const char *csname, char *spec, remap_scope sc | @@ -681,7 +681,7 @@ static enum cs_result remap_chars(const char *csname, char *spec, remap_scope sc | ||
681 | remap_one(ebc, iso, scope, one_way); | 681 | remap_one(ebc, iso, scope, one_way); |
682 | } | 682 | } |
683 | } | 683 | } |
684 | - Free(spec); | 684 | + lib3270_free(spec); |
685 | return rc; | 685 | return rc; |
686 | } | 686 | } |
687 | 687 |
src/lib3270/ft.c
@@ -340,8 +340,7 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state); | @@ -340,8 +340,7 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state); | ||
340 | ft_last_cr = False; | 340 | ft_last_cr = False; |
341 | ft_is_cut = False; | 341 | ft_is_cut = False; |
342 | 342 | ||
343 | - ftHandle = malloc(sizeof(H3270FT)); | ||
344 | - memset(ftHandle,0,sizeof(H3270FT)); | 343 | + ftHandle = lib3270_malloc(sizeof(H3270FT)); |
345 | 344 | ||
346 | ftHandle->sz = sizeof(H3270FT); | 345 | ftHandle->sz = sizeof(H3270FT); |
347 | ftHandle->host = session; | 346 | ftHandle->host = session; |
src/lib3270/ft_cut.c
@@ -36,7 +36,7 @@ | @@ -36,7 +36,7 @@ | ||
36 | */ | 36 | */ |
37 | 37 | ||
38 | #include <errno.h> | 38 | #include <errno.h> |
39 | -#include <malloc.h> | 39 | +// #include <malloc.h> |
40 | 40 | ||
41 | #include "globals.h" | 41 | #include "globals.h" |
42 | 42 | ||
@@ -340,7 +340,7 @@ cut_control_code(void) | @@ -340,7 +340,7 @@ cut_control_code(void) | ||
340 | } | 340 | } |
341 | else | 341 | else |
342 | { | 342 | { |
343 | - bp = buf = Malloc(81); | 343 | + bp = buf = lib3270_malloc(81); |
344 | 344 | ||
345 | for (i = 0; i < 80; i++) | 345 | for (i = 0; i < 80; i++) |
346 | *bp++ = ebc2asc[h3270.ea_buf[O_CC_MESSAGE + i].cc]; | 346 | *bp++ = ebc2asc[h3270.ea_buf[O_CC_MESSAGE + i].cc]; |
@@ -360,7 +360,7 @@ cut_control_code(void) | @@ -360,7 +360,7 @@ cut_control_code(void) | ||
360 | strcpy(buf, N_( "Transfer cancelled by host" ) ); | 360 | strcpy(buf, N_( "Transfer cancelled by host" ) ); |
361 | } | 361 | } |
362 | ft_complete(NULL,buf); | 362 | ft_complete(NULL,buf); |
363 | - Free(buf); | 363 | + lib3270_free(buf); |
364 | break; | 364 | break; |
365 | 365 | ||
366 | default: | 366 | default: |
@@ -528,7 +528,7 @@ static void cut_abort(unsigned short reason, const char *fmt, ...) | @@ -528,7 +528,7 @@ static void cut_abort(unsigned short reason, const char *fmt, ...) | ||
528 | va_list args; | 528 | va_list args; |
529 | 529 | ||
530 | if(saved_errmsg) | 530 | if(saved_errmsg) |
531 | - free(saved_errmsg); | 531 | + lib3270_free(saved_errmsg); |
532 | 532 | ||
533 | /* Save the error message. */ | 533 | /* Save the error message. */ |
534 | va_start(args, fmt); | 534 | va_start(args, fmt); |
src/lib3270/ft_dft.c
@@ -55,7 +55,7 @@ | @@ -55,7 +55,7 @@ | ||
55 | #include "utilc.h" | 55 | #include "utilc.h" |
56 | 56 | ||
57 | #include <errno.h> | 57 | #include <errno.h> |
58 | -#include <malloc.h> | 58 | +// #include <malloc.h> |
59 | 59 | ||
60 | extern unsigned char aid; | 60 | extern unsigned char aid; |
61 | 61 | ||
@@ -243,7 +243,7 @@ dft_data_insert(struct data_buffer *data_bufr) | @@ -243,7 +243,7 @@ dft_data_insert(struct data_buffer *data_bufr) | ||
243 | unsigned char *dollarp; | 243 | unsigned char *dollarp; |
244 | 244 | ||
245 | /* Get storage to copy the message. */ | 245 | /* Get storage to copy the message. */ |
246 | - msgp = (unsigned char *)Malloc(my_length + 1); | 246 | + msgp = (unsigned char *)lib3270_malloc(my_length + 1); |
247 | 247 | ||
248 | /* Copy the message. */ | 248 | /* Copy the message. */ |
249 | memcpy(msgp, data_bufr->data, my_length); | 249 | memcpy(msgp, data_bufr->data, my_length); |
@@ -257,15 +257,15 @@ dft_data_insert(struct data_buffer *data_bufr) | @@ -257,15 +257,15 @@ dft_data_insert(struct data_buffer *data_bufr) | ||
257 | 257 | ||
258 | /* If transfer completed ok, use our msg. */ | 258 | /* If transfer completed ok, use our msg. */ |
259 | if (memcmp(msgp, END_TRANSFER, strlen(END_TRANSFER)) == 0) { | 259 | if (memcmp(msgp, END_TRANSFER, strlen(END_TRANSFER)) == 0) { |
260 | - Free(msgp); | 260 | + lib3270_free(msgp); |
261 | ft_complete(NULL,NULL); | 261 | ft_complete(NULL,NULL); |
262 | } else if (lib3270_get_ft_state(&h3270) == FT_ABORT_SENT && abort_string != CN) { | 262 | } else if (lib3270_get_ft_state(&h3270) == FT_ABORT_SENT && abort_string != CN) { |
263 | - Free(msgp); | 263 | + lib3270_free(msgp); |
264 | ft_complete(NULL,abort_string); | 264 | ft_complete(NULL,abort_string); |
265 | Replace(abort_string, CN); | 265 | Replace(abort_string, CN); |
266 | } else { | 266 | } else { |
267 | ft_complete(NULL,(char *)msgp); | 267 | ft_complete(NULL,(char *)msgp); |
268 | - Free(msgp); | 268 | + lib3270_free(msgp); |
269 | } | 269 | } |
270 | } else if (my_length > 0) { | 270 | } else if (my_length > 0) { |
271 | /* Write the data out to the file. */ | 271 | /* Write the data out to the file. */ |
@@ -459,7 +459,7 @@ dft_get_request(void) | @@ -459,7 +459,7 @@ dft_get_request(void) | ||
459 | dft_savebuf_len = obptr - obuf; | 459 | dft_savebuf_len = obptr - obuf; |
460 | if (dft_savebuf_len > dft_savebuf_max) { | 460 | if (dft_savebuf_len > dft_savebuf_max) { |
461 | dft_savebuf_max = dft_savebuf_len; | 461 | dft_savebuf_max = dft_savebuf_len; |
462 | - Replace(dft_savebuf, (unsigned char *)Malloc(dft_savebuf_max)); | 462 | + Replace(dft_savebuf, (unsigned char *)lib3270_malloc(dft_savebuf_max)); |
463 | } | 463 | } |
464 | (void) memcpy(dft_savebuf, obuf, dft_savebuf_len); | 464 | (void) memcpy(dft_savebuf, obuf, dft_savebuf_len); |
465 | aid = AID_SF; | 465 | aid = AID_SF; |
@@ -494,7 +494,7 @@ static void dft_abort(unsigned short code, const char *fmt, ...) | @@ -494,7 +494,7 @@ static void dft_abort(unsigned short code, const char *fmt, ...) | ||
494 | va_list args; | 494 | va_list args; |
495 | 495 | ||
496 | if(abort_string) | 496 | if(abort_string) |
497 | - free(abort_string); | 497 | + lib3270_free(abort_string); |
498 | 498 | ||
499 | va_start(args, fmt); | 499 | va_start(args, fmt); |
500 | abort_string = xs_vsprintf(fmt, args); | 500 | abort_string = xs_vsprintf(fmt, args); |
src/lib3270/globals.h
@@ -318,7 +318,7 @@ LIB3270_INTERNAL struct trans_list *trans_list; | @@ -318,7 +318,7 @@ LIB3270_INTERNAL struct trans_list *trans_list; | ||
318 | 318 | ||
319 | #define CN ((char *) NULL) | 319 | #define CN ((char *) NULL) |
320 | #define PN ((XtPointer) NULL) | 320 | #define PN ((XtPointer) NULL) |
321 | -#define Replace(var, value) { Free(var); var = (value); } | 321 | +#define Replace(var, value) { lib3270_free(var); var = (value); } |
322 | 322 | ||
323 | /* Configuration change masks. */ | 323 | /* Configuration change masks. */ |
324 | #define NO_CHANGE 0x0000 /* no change */ | 324 | #define NO_CHANGE 0x0000 /* no change */ |
src/lib3270/glue.c
@@ -563,7 +563,7 @@ parse_xrm(const char *arg, const char *where) | @@ -563,7 +563,7 @@ parse_xrm(const char *arg, const char *where) | ||
563 | type = resources[i].type; | 563 | type = resources[i].type; |
564 | #if defined(C3270) /*[*/ | 564 | #if defined(C3270) /*[*/ |
565 | if (address == NULL) { | 565 | if (address == NULL) { |
566 | - add_buf = Malloc(strlen(s) + 1); | 566 | + add_buf = lib3270_malloc(strlen(s) + 1); |
567 | address = add_buf; | 567 | address = add_buf; |
568 | } | 568 | } |
569 | #endif /*]*/ | 569 | #endif /*]*/ |
@@ -619,7 +619,7 @@ parse_xrm(const char *arg, const char *where) | @@ -619,7 +619,7 @@ parse_xrm(const char *arg, const char *where) | ||
619 | } | 619 | } |
620 | break; | 620 | break; |
621 | case XRM_STRING: | 621 | case XRM_STRING: |
622 | - t = Malloc(strlen(s) + 1); | 622 | + t = lib3270_malloc(strlen(s) + 1); |
623 | *(char **)address = t; | 623 | *(char **)address = t; |
624 | if (*s == '"') { | 624 | if (*s == '"') { |
625 | Boolean quoted = False; | 625 | Boolean quoted = False; |
@@ -675,7 +675,7 @@ parse_xrm(const char *arg, const char *where) | @@ -675,7 +675,7 @@ parse_xrm(const char *arg, const char *where) | ||
675 | if (arbitrary) { | 675 | if (arbitrary) { |
676 | char *rsname; | 676 | char *rsname; |
677 | 677 | ||
678 | - rsname = Malloc(rnlen + 1); | 678 | + rsname = lib3270_malloc(rnlen + 1); |
679 | (void) strncpy(rsname, arg + match_len, rnlen); | 679 | (void) strncpy(rsname, arg + match_len, rnlen); |
680 | rsname[rnlen] = '\0'; | 680 | rsname[rnlen] = '\0'; |
681 | add_resource(rsname, hide); | 681 | add_resource(rsname, hide); |
@@ -702,7 +702,7 @@ read_resource_file(const char *filename, Boolean fatal) | @@ -702,7 +702,7 @@ read_resource_file(const char *filename, Boolean fatal) | ||
702 | } | 702 | } |
703 | 703 | ||
704 | /* Merge in what's in the file into the resource database. */ | 704 | /* Merge in what's in the file into the resource database. */ |
705 | - where = Malloc(strlen(filename) + 64); | 705 | + where = lib3270_malloc(strlen(filename) + 64); |
706 | 706 | ||
707 | ilen = 0; | 707 | ilen = 0; |
708 | while (fgets(buf + ilen, sizeof(buf) - ilen, f) != CN || ilen) { | 708 | while (fgets(buf + ilen, sizeof(buf) - ilen, f) != CN || ilen) { |
@@ -783,7 +783,7 @@ read_resource_file(const char *filename, Boolean fatal) | @@ -783,7 +783,7 @@ read_resource_file(const char *filename, Boolean fatal) | ||
783 | /* Get ready for the next iteration. */ | 783 | /* Get ready for the next iteration. */ |
784 | ilen = 0; | 784 | ilen = 0; |
785 | } | 785 | } |
786 | - Free(where); | 786 | + lib3270_free(where); |
787 | return 0; | 787 | return 0; |
788 | } | 788 | } |
789 | 789 |
src/lib3270/host.c
@@ -52,7 +52,7 @@ | @@ -52,7 +52,7 @@ | ||
52 | #include "xioc.h" | 52 | #include "xioc.h" |
53 | 53 | ||
54 | #include <errno.h> | 54 | #include <errno.h> |
55 | -#include <malloc.h> | 55 | +// #include <malloc.h> |
56 | 56 | ||
57 | #define RECONNECT_MS 2000 /* 2 sec before reconnecting to host */ | 57 | #define RECONNECT_MS 2000 /* 2 sec before reconnecting to host */ |
58 | #define RECONNECT_ERR_MS 5000 /* 5 sec before reconnecting to host */ | 58 | #define RECONNECT_ERR_MS 5000 /* 5 sec before reconnecting to host */ |
@@ -124,10 +124,10 @@ hostfile_init(void) | @@ -124,10 +124,10 @@ hostfile_init(void) | ||
124 | ResHostsFile); | 124 | ResHostsFile); |
125 | continue; | 125 | continue; |
126 | } | 126 | } |
127 | - h = (struct host *)Malloc(sizeof(*h)); | 127 | + h = (struct host *)lib3270_malloc(sizeof(*h)); |
128 | if (!split_hier(NewString(name), &h->name, | 128 | if (!split_hier(NewString(name), &h->name, |
129 | &h->parents)) { | 129 | &h->parents)) { |
130 | - Free(h); | 130 | + lib3270_free(h); |
131 | continue; | 131 | continue; |
132 | } | 132 | } |
133 | h->hostname = NewString(hostname); | 133 | h->hostname = NewString(hostname); |
@@ -160,7 +160,7 @@ hostfile_init(void) | @@ -160,7 +160,7 @@ hostfile_init(void) | ||
160 | popup_an_errno(errno, "Cannot open " ResHostsFile " '%s'", | 160 | popup_an_errno(errno, "Cannot open " ResHostsFile " '%s'", |
161 | appres.hostsfile); | 161 | appres.hostsfile); |
162 | } | 162 | } |
163 | - Free(hostfile_name); | 163 | + lib3270_free(hostfile_name); |
164 | 164 | ||
165 | // #if defined(X3270_DISPLAY) | 165 | // #if defined(X3270_DISPLAY) |
166 | // save_recent(CN); | 166 | // save_recent(CN); |
@@ -465,7 +465,7 @@ split_host(H3270 *hSession, char *s, char *ansi, char *std_ds, char *passthru, | @@ -465,7 +465,7 @@ split_host(H3270 *hSession, char *s, char *ansi, char *std_ds, char *passthru, | ||
465 | goto split_success; | 465 | goto split_success; |
466 | 466 | ||
467 | split_fail: | 467 | split_fail: |
468 | - Free(r); | 468 | + lib3270_free(r); |
469 | r = CN; | 469 | r = CN; |
470 | 470 | ||
471 | split_success: | 471 | split_success: |
@@ -803,7 +803,7 @@ LIB3270_EXPORT const char * lib3270_set_host(H3270 *h, const char *n) | @@ -803,7 +803,7 @@ LIB3270_EXPORT const char * lib3270_set_host(H3270 *h, const char *n) | ||
803 | trace("new hostname is \"%s\"",new_hostname); | 803 | trace("new hostname is \"%s\"",new_hostname); |
804 | 804 | ||
805 | if(h->full_current_host) | 805 | if(h->full_current_host) |
806 | - free(h->full_current_host); | 806 | + lib3270_free(h->full_current_host); |
807 | 807 | ||
808 | h->full_current_host = new_hostname; | 808 | h->full_current_host = new_hostname; |
809 | 809 |
src/lib3270/init.c
@@ -61,7 +61,7 @@ void lib3270_session_free(H3270 *h) | @@ -61,7 +61,7 @@ void lib3270_session_free(H3270 *h) | ||
61 | while(h->st_callbacks[f]) | 61 | while(h->st_callbacks[f]) |
62 | { | 62 | { |
63 | struct lib3270_state_callback *next = h->st_callbacks[f]->next; | 63 | struct lib3270_state_callback *next = h->st_callbacks[f]->next; |
64 | - Free(h->st_callbacks[f]); | 64 | + lib3270_free(h->st_callbacks[f]); |
65 | h->st_callbacks[f] = next; | 65 | h->st_callbacks[f] = next; |
66 | } | 66 | } |
67 | } | 67 | } |
src/lib3270/kybd.c
@@ -222,9 +222,7 @@ static int enq_chk(void) | @@ -222,9 +222,7 @@ static int enq_chk(void) | ||
222 | if(enq_chk()) | 222 | if(enq_chk()) |
223 | return; | 223 | return; |
224 | 224 | ||
225 | - ta = (struct ta *) Malloc(sizeof(*ta)); | ||
226 | - memset(ta,0,sizeof(struct ta)); | ||
227 | - | 225 | + ta = (struct ta *) lib3270_malloc(sizeof(*ta)); |
228 | ta->next = (struct ta *) NULL; | 226 | ta->next = (struct ta *) NULL; |
229 | ta->type = TA_TYPE_KEY_AID; | 227 | ta->type = TA_TYPE_KEY_AID; |
230 | ta->aid_code = aid_code; | 228 | ta->aid_code = aid_code; |
@@ -257,8 +255,7 @@ static void enq_ta(H3270 *hSession, void (*fn)(H3270 *, const char *, const char | @@ -257,8 +255,7 @@ static void enq_ta(H3270 *hSession, void (*fn)(H3270 *, const char *, const char | ||
257 | 255 | ||
258 | CHECK_SESSION_HANDLE(hSession); | 256 | CHECK_SESSION_HANDLE(hSession); |
259 | 257 | ||
260 | - ta = (struct ta *) Malloc(sizeof(*ta)); | ||
261 | - memset(ta,0,sizeof(struct ta)); | 258 | + ta = (struct ta *) lib3270_malloc(sizeof(*ta)); |
262 | ta->session = hSession; | 259 | ta->session = hSession; |
263 | ta->next = (struct ta *) NULL; | 260 | ta->next = (struct ta *) NULL; |
264 | ta->type = TA_TYPE_DEFAULT; | 261 | ta->type = TA_TYPE_DEFAULT; |
@@ -277,7 +274,7 @@ static void enq_ta(H3270 *hSession, void (*fn)(H3270 *, const char *, const char | @@ -277,7 +274,7 @@ static void enq_ta(H3270 *hSession, void (*fn)(H3270 *, const char *, const char | ||
277 | else | 274 | else |
278 | { | 275 | { |
279 | ta_head = ta; | 276 | ta_head = ta; |
280 | - status_typeahead(&h3270,True); | 277 | + status_typeahead(hSession,True); |
281 | } | 278 | } |
282 | ta_tail = ta; | 279 | ta_tail = ta; |
283 | 280 | ||
@@ -304,9 +301,8 @@ Boolean run_ta(void) | @@ -304,9 +301,8 @@ Boolean run_ta(void) | ||
304 | { | 301 | { |
305 | case TA_TYPE_DEFAULT: | 302 | case TA_TYPE_DEFAULT: |
306 | ta->fn(ta->session,ta->parm[0],ta->parm[1]); | 303 | ta->fn(ta->session,ta->parm[0],ta->parm[1]); |
307 | - Free(ta->parm[0]); | ||
308 | - Free(ta->parm[1]); | ||
309 | - Free(ta); | 304 | + lib3270_free(ta->parm[0]); |
305 | + lib3270_free(ta->parm[1]); | ||
310 | break; | 306 | break; |
311 | 307 | ||
312 | case TA_TYPE_KEY_AID: | 308 | case TA_TYPE_KEY_AID: |
@@ -319,6 +315,8 @@ Boolean run_ta(void) | @@ -319,6 +315,8 @@ Boolean run_ta(void) | ||
319 | 315 | ||
320 | } | 316 | } |
321 | 317 | ||
318 | + lib3270_free(ta); | ||
319 | + | ||
322 | return True; | 320 | return True; |
323 | } | 321 | } |
324 | 322 | ||
@@ -334,10 +332,10 @@ flush_ta(void) | @@ -334,10 +332,10 @@ flush_ta(void) | ||
334 | 332 | ||
335 | for (ta = ta_head; ta != (struct ta *) NULL; ta = next) | 333 | for (ta = ta_head; ta != (struct ta *) NULL; ta = next) |
336 | { | 334 | { |
337 | - Free(ta->parm[0]); | ||
338 | - Free(ta->parm[1]); | 335 | + lib3270_free(ta->parm[0]); |
336 | + lib3270_free(ta->parm[1]); | ||
339 | next = ta->next; | 337 | next = ta->next; |
340 | - Free(ta); | 338 | + lib3270_free(ta); |
341 | any = True; | 339 | any = True; |
342 | } | 340 | } |
343 | ta_head = ta_tail = (struct ta *) NULL; | 341 | ta_head = ta_tail = (struct ta *) NULL; |
@@ -3466,7 +3464,7 @@ void | @@ -3466,7 +3464,7 @@ void | ||
3466 | clear_xks(void) | 3464 | clear_xks(void) |
3467 | { | 3465 | { |
3468 | if (nxk) { | 3466 | if (nxk) { |
3469 | - Free(xk); | 3467 | + lib3270_free(xk); |
3470 | xk = (struct xks *)NULL; | 3468 | xk = (struct xks *)NULL; |
3471 | nxk = 0; | 3469 | nxk = 0; |
3472 | } | 3470 | } |
src/lib3270/localdefs.h
@@ -68,8 +68,8 @@ typedef struct _XtActionsRec{ | @@ -68,8 +68,8 @@ typedef struct _XtActionsRec{ | ||
68 | // void * Calloc(size_t, size_t); | 68 | // void * Calloc(size_t, size_t); |
69 | // void * Realloc(void *, size_t); | 69 | // void * Realloc(void *, size_t); |
70 | 70 | ||
71 | -#define Malloc(x) lib3270_malloc(x) | ||
72 | -#define Free(x) lib3270_free(x) | 71 | +// #define Malloc(x) lib3270_malloc(x) |
72 | +// #define Free(x) lib3270_free(x) | ||
73 | #define Calloc(e,n) lib3270_calloc(e,n,NULL) | 73 | #define Calloc(e,n) lib3270_calloc(e,n,NULL) |
74 | #define Realloc(x,n) lib3270_realloc(x,n) | 74 | #define Realloc(x,n) lib3270_realloc(x,n) |
75 | 75 |
src/lib3270/macros.c
@@ -33,7 +33,7 @@ | @@ -33,7 +33,7 @@ | ||
33 | #include <errno.h> | 33 | #include <errno.h> |
34 | #include <string.h> | 34 | #include <string.h> |
35 | #include <stdio.h> | 35 | #include <stdio.h> |
36 | - #include <malloc.h> | 36 | +// #include <malloc.h> |
37 | #include <lib3270.h> | 37 | #include <lib3270.h> |
38 | #include <lib3270/macros.h> | 38 | #include <lib3270/macros.h> |
39 | #include <stdlib.h> | 39 | #include <stdlib.h> |
@@ -113,7 +113,7 @@ | @@ -113,7 +113,7 @@ | ||
113 | case 1: // Get entire screen | 113 | case 1: // Get entire screen |
114 | lib3270_get_screen_size(hSession,&rows,&cols); | 114 | lib3270_get_screen_size(hSession,&rows,&cols); |
115 | qtd = (rows*(cols+1)+1); | 115 | qtd = (rows*(cols+1)+1); |
116 | - buffer = malloc(qtd+2); | 116 | + buffer = lib3270_malloc(qtd+2); |
117 | 117 | ||
118 | memset(buffer,0,qtd+1); | 118 | memset(buffer,0,qtd+1); |
119 | start = qtd = 0; | 119 | start = qtd = 0; |
@@ -165,7 +165,7 @@ | @@ -165,7 +165,7 @@ | ||
165 | return NULL; | 165 | return NULL; |
166 | } | 166 | } |
167 | 167 | ||
168 | - buffer = malloc(qtd+1); | 168 | + buffer = lib3270_malloc(qtd+1); |
169 | screen_read(buffer, start, qtd); | 169 | screen_read(buffer, start, qtd); |
170 | 170 | ||
171 | */ | 171 | */ |
@@ -231,7 +231,7 @@ | @@ -231,7 +231,7 @@ | ||
231 | host = "-"; | 231 | host = "-"; |
232 | 232 | ||
233 | sz = strlen(luname)+strlen(state)+strlen(host)+4; | 233 | sz = strlen(luname)+strlen(state)+strlen(host)+4; |
234 | - rsp = malloc(sz+1); | 234 | + rsp = lib3270_malloc(sz+1); |
235 | snprintf(rsp,sz,"%s %s %s",state,luname,host); | 235 | snprintf(rsp,sz,"%s %s %s",state,luname,host); |
236 | return rsp; | 236 | return rsp; |
237 | } | 237 | } |
src/lib3270/paste.c
@@ -45,7 +45,7 @@ | @@ -45,7 +45,7 @@ | ||
45 | #endif | 45 | #endif |
46 | 46 | ||
47 | #include <fcntl.h> | 47 | #include <fcntl.h> |
48 | -#include <malloc.h> | 48 | +// #include <malloc.h> |
49 | 49 | ||
50 | #include "3270ds.h" | 50 | #include "3270ds.h" |
51 | #include "appres.h" | 51 | #include "appres.h" |
@@ -254,7 +254,7 @@ LIB3270_EXPORT int lib3270_paste(H3270 *h, const unsigned char *str) | @@ -254,7 +254,7 @@ LIB3270_EXPORT int lib3270_paste(H3270 *h, const unsigned char *str) | ||
254 | 254 | ||
255 | if(h->paste_buffer) | 255 | if(h->paste_buffer) |
256 | { | 256 | { |
257 | - free(h->paste_buffer); | 257 | + lib3270_free(h->paste_buffer); |
258 | h->paste_buffer = NULL; | 258 | h->paste_buffer = NULL; |
259 | } | 259 | } |
260 | 260 | ||
@@ -296,6 +296,6 @@ LIB3270_ACTION(pastenext) | @@ -296,6 +296,6 @@ LIB3270_ACTION(pastenext) | ||
296 | 296 | ||
297 | rc = lib3270_paste(hSession,(unsigned char *) ptr); | 297 | rc = lib3270_paste(hSession,(unsigned char *) ptr); |
298 | 298 | ||
299 | - free(ptr); | 299 | + lib3270_free(ptr); |
300 | return rc; | 300 | return rc; |
301 | } | 301 | } |
src/lib3270/proxy.c
@@ -56,7 +56,7 @@ | @@ -56,7 +56,7 @@ | ||
56 | 56 | ||
57 | #else | 57 | #else |
58 | 58 | ||
59 | - #include <malloc.h> | 59 | +// #include <malloc.h> |
60 | #include <sys/socket.h> | 60 | #include <sys/socket.h> |
61 | #include <sys/ioctl.h> | 61 | #include <sys/ioctl.h> |
62 | #include <netinet/in.h> | 62 | #include <netinet/in.h> |
@@ -306,7 +306,7 @@ parse_host_port(char *s, char **phost, char **pport) | @@ -306,7 +306,7 @@ parse_host_port(char *s, char **phost, char **pport) | ||
306 | *pport = NewString(colon + 1); | 306 | *pport = NewString(colon + 1); |
307 | 307 | ||
308 | /* Copy out the hostname. */ | 308 | /* Copy out the hostname. */ |
309 | - *phost = Malloc(hlen + 1); | 309 | + *phost = lib3270_malloc(hlen + 1); |
310 | strncpy(*phost, hstart, hlen); | 310 | strncpy(*phost, hstart, hlen); |
311 | (*phost)[hlen] = '\0'; | 311 | (*phost)[hlen] = '\0'; |
312 | return 0; | 312 | return 0; |
@@ -347,7 +347,7 @@ proxy_passthru(int fd, char *host, unsigned short port) | @@ -347,7 +347,7 @@ proxy_passthru(int fd, char *host, unsigned short port) | ||
347 | { | 347 | { |
348 | char *buf; | 348 | char *buf; |
349 | 349 | ||
350 | - buf = Malloc(strlen(host) + 32); | 350 | + buf = lib3270_malloc(strlen(host) + 32); |
351 | (void) sprintf(buf, "%s %u\r\n", host, port); | 351 | (void) sprintf(buf, "%s %u\r\n", host, port); |
352 | 352 | ||
353 | #if defined(X3270_TRACE) /*[*/ | 353 | #if defined(X3270_TRACE) /*[*/ |
@@ -357,10 +357,10 @@ proxy_passthru(int fd, char *host, unsigned short port) | @@ -357,10 +357,10 @@ proxy_passthru(int fd, char *host, unsigned short port) | ||
357 | 357 | ||
358 | if (send(fd, buf, strlen(buf), 0) < 0) { | 358 | if (send(fd, buf, strlen(buf), 0) < 0) { |
359 | popup_a_sockerr(NULL,"Passthru Proxy: send error"); | 359 | popup_a_sockerr(NULL,"Passthru Proxy: send error"); |
360 | - Free(buf); | 360 | + lib3270_free(buf); |
361 | return -1; | 361 | return -1; |
362 | } | 362 | } |
363 | - Free(buf); | 363 | + lib3270_free(buf); |
364 | 364 | ||
365 | return 0; | 365 | return 0; |
366 | } | 366 | } |
@@ -377,7 +377,7 @@ proxy_http(int fd, char *host, unsigned short port) | @@ -377,7 +377,7 @@ proxy_http(int fd, char *host, unsigned short port) | ||
377 | char *space; | 377 | char *space; |
378 | 378 | ||
379 | /* Send the CONNECT request. */ | 379 | /* Send the CONNECT request. */ |
380 | - buf = Malloc(64 + strlen(host)); | 380 | + buf = lib3270_malloc(64 + strlen(host)); |
381 | colon = strchr(host, ':'); | 381 | colon = strchr(host, ':'); |
382 | sprintf(buf, "CONNECT %s%s%s:%u HTTP/1.1\r\n", | 382 | sprintf(buf, "CONNECT %s%s%s:%u HTTP/1.1\r\n", |
383 | (colon? "[": ""), | 383 | (colon? "[": ""), |
@@ -392,7 +392,7 @@ proxy_http(int fd, char *host, unsigned short port) | @@ -392,7 +392,7 @@ proxy_http(int fd, char *host, unsigned short port) | ||
392 | 392 | ||
393 | if (send(fd, buf, strlen(buf), 0) < 0) { | 393 | if (send(fd, buf, strlen(buf), 0) < 0) { |
394 | popup_a_sockerr(NULL,"HTTP Proxy: send error"); | 394 | popup_a_sockerr(NULL,"HTTP Proxy: send error"); |
395 | - Free(buf); | 395 | + lib3270_free(buf); |
396 | return -1; | 396 | return -1; |
397 | } | 397 | } |
398 | 398 | ||
@@ -409,7 +409,7 @@ proxy_http(int fd, char *host, unsigned short port) | @@ -409,7 +409,7 @@ proxy_http(int fd, char *host, unsigned short port) | ||
409 | 409 | ||
410 | if (send(fd, buf, strlen(buf), 0) < 0) { | 410 | if (send(fd, buf, strlen(buf), 0) < 0) { |
411 | popup_a_sockerr(NULL,"HTTP Proxy: send error"); | 411 | popup_a_sockerr(NULL,"HTTP Proxy: send error"); |
412 | - Free(buf); | 412 | + lib3270_free(buf); |
413 | return -1; | 413 | return -1; |
414 | } | 414 | } |
415 | 415 | ||
@@ -421,10 +421,10 @@ proxy_http(int fd, char *host, unsigned short port) | @@ -421,10 +421,10 @@ proxy_http(int fd, char *host, unsigned short port) | ||
421 | 421 | ||
422 | if (send(fd, buf, strlen(buf), 0) < 0) { | 422 | if (send(fd, buf, strlen(buf), 0) < 0) { |
423 | popup_a_sockerr(NULL,"HTTP Proxy: send error"); | 423 | popup_a_sockerr(NULL,"HTTP Proxy: send error"); |
424 | - Free(buf); | 424 | + lib3270_free(buf); |
425 | return -1; | 425 | return -1; |
426 | } | 426 | } |
427 | - Free(buf); | 427 | + lib3270_free(buf); |
428 | 428 | ||
429 | /* | 429 | /* |
430 | * Process the reply. | 430 | * Process the reply. |
@@ -498,7 +498,7 @@ proxy_telnet(int fd, char *host, unsigned short port) | @@ -498,7 +498,7 @@ proxy_telnet(int fd, char *host, unsigned short port) | ||
498 | { | 498 | { |
499 | char *buf; | 499 | char *buf; |
500 | 500 | ||
501 | - buf = Malloc(strlen(host) + 32); | 501 | + buf = lib3270_malloc(strlen(host) + 32); |
502 | (void) sprintf(buf, "connect %s %u\r\n", host, port); | 502 | (void) sprintf(buf, "connect %s %u\r\n", host, port); |
503 | 503 | ||
504 | #if defined(X3270_TRACE) /*[*/ | 504 | #if defined(X3270_TRACE) /*[*/ |
@@ -508,10 +508,10 @@ proxy_telnet(int fd, char *host, unsigned short port) | @@ -508,10 +508,10 @@ proxy_telnet(int fd, char *host, unsigned short port) | ||
508 | 508 | ||
509 | if (send(fd, buf, strlen(buf), 0) < 0) { | 509 | if (send(fd, buf, strlen(buf), 0) < 0) { |
510 | popup_a_sockerr(NULL,"TELNET Proxy: send error"); | 510 | popup_a_sockerr(NULL,"TELNET Proxy: send error"); |
511 | - Free(buf); | 511 | + lib3270_free(buf); |
512 | return -1; | 512 | return -1; |
513 | } | 513 | } |
514 | - Free(buf); | 514 | + lib3270_free(buf); |
515 | 515 | ||
516 | return 0; | 516 | return 0; |
517 | } | 517 | } |
@@ -558,7 +558,7 @@ proxy_socks4(int fd, char *host, unsigned short port, int force_a) | @@ -558,7 +558,7 @@ proxy_socks4(int fd, char *host, unsigned short port, int force_a) | ||
558 | 558 | ||
559 | /* Send the request to the server. */ | 559 | /* Send the request to the server. */ |
560 | if (use_4a) { | 560 | if (use_4a) { |
561 | - buf = Malloc(32 + strlen(user) + strlen(host)); | 561 | + buf = lib3270_malloc(32 + strlen(user) + strlen(host)); |
562 | s = buf; | 562 | s = buf; |
563 | *s++ = 0x04; | 563 | *s++ = 0x04; |
564 | *s++ = 0x01; | 564 | *s++ = 0x01; |
@@ -578,14 +578,14 @@ proxy_socks4(int fd, char *host, unsigned short port, int force_a) | @@ -578,14 +578,14 @@ proxy_socks4(int fd, char *host, unsigned short port, int force_a) | ||
578 | 578 | ||
579 | if (send(fd, buf, s - buf, 0) < 0) { | 579 | if (send(fd, buf, s - buf, 0) < 0) { |
580 | popup_a_sockerr(NULL,"SOCKS4 Proxy: send error"); | 580 | popup_a_sockerr(NULL,"SOCKS4 Proxy: send error"); |
581 | - Free(buf); | 581 | + lib3270_free(buf); |
582 | return -1; | 582 | return -1; |
583 | } | 583 | } |
584 | - Free(buf); | 584 | + lib3270_free(buf); |
585 | } else { | 585 | } else { |
586 | unsigned long u; | 586 | unsigned long u; |
587 | 587 | ||
588 | - buf = Malloc(32 + strlen(user)); | 588 | + buf = lib3270_malloc(32 + strlen(user)); |
589 | s = buf; | 589 | s = buf; |
590 | *s++ = 0x04; | 590 | *s++ = 0x04; |
591 | *s++ = 0x01; | 591 | *s++ = 0x01; |
@@ -603,11 +603,11 @@ proxy_socks4(int fd, char *host, unsigned short port, int force_a) | @@ -603,11 +603,11 @@ proxy_socks4(int fd, char *host, unsigned short port, int force_a) | ||
603 | #endif /*]*/ | 603 | #endif /*]*/ |
604 | 604 | ||
605 | if (send(fd, buf, s - buf, 0) < 0) { | 605 | if (send(fd, buf, s - buf, 0) < 0) { |
606 | - Free(buf); | 606 | + lib3270_free(buf); |
607 | popup_a_sockerr(NULL,"SOCKS4 Proxy: send error"); | 607 | popup_a_sockerr(NULL,"SOCKS4 Proxy: send error"); |
608 | return -1; | 608 | return -1; |
609 | } | 609 | } |
610 | - Free(buf); | 610 | + lib3270_free(buf); |
611 | } | 611 | } |
612 | 612 | ||
613 | /* | 613 | /* |
@@ -799,7 +799,7 @@ proxy_socks5(int fd, char *host, unsigned short port, int force_d) | @@ -799,7 +799,7 @@ proxy_socks5(int fd, char *host, unsigned short port, int force_d) | ||
799 | } | 799 | } |
800 | 800 | ||
801 | /* Send the request to the server. */ | 801 | /* Send the request to the server. */ |
802 | - buf = Malloc(32 + strlen(host)); | 802 | + buf = lib3270_malloc(32 + strlen(host)); |
803 | s = buf; | 803 | s = buf; |
804 | *s++ = 0x05; /* protocol version 5 */ | 804 | *s++ = 0x05; /* protocol version 5 */ |
805 | *s++ = 0x01; /* CONNECT */ | 805 | *s++ = 0x01; /* CONNECT */ |
@@ -836,10 +836,10 @@ proxy_socks5(int fd, char *host, unsigned short port, int force_d) | @@ -836,10 +836,10 @@ proxy_socks5(int fd, char *host, unsigned short port, int force_d) | ||
836 | 836 | ||
837 | if (send(fd, buf, s - buf, 0) < 0) { | 837 | if (send(fd, buf, s - buf, 0) < 0) { |
838 | popup_a_sockerr(NULL,"SOCKS5 Proxy: send error"); | 838 | popup_a_sockerr(NULL,"SOCKS5 Proxy: send error"); |
839 | - Free(buf); | 839 | + lib3270_free(buf); |
840 | return -1; | 840 | return -1; |
841 | } | 841 | } |
842 | - Free(buf); | 842 | + lib3270_free(buf); |
843 | 843 | ||
844 | /* | 844 | /* |
845 | * Process the reply. | 845 | * Process the reply. |
@@ -1009,7 +1009,7 @@ proxy_socks5(int fd, char *host, unsigned short port, int force_d) | @@ -1009,7 +1009,7 @@ proxy_socks5(int fd, char *host, unsigned short port, int force_d) | ||
1009 | nbuf, | 1009 | nbuf, |
1010 | rport); | 1010 | rport); |
1011 | #endif /*]*/ | 1011 | #endif /*]*/ |
1012 | - Free(buf); | 1012 | + lib3270_free(buf); |
1013 | 1013 | ||
1014 | return 0; | 1014 | return 0; |
1015 | } | 1015 | } |
src/lib3270/resources.c
@@ -118,7 +118,7 @@ void add_resource(const char *name, const char *value) | @@ -118,7 +118,7 @@ void add_resource(const char *name, const char *value) | ||
118 | return; | 118 | return; |
119 | } | 119 | } |
120 | } | 120 | } |
121 | - d = Malloc(sizeof(struct dresource)); | 121 | + d = lib3270_malloc(sizeof(struct dresource)); |
122 | d->next = NULL; | 122 | d->next = NULL; |
123 | d->name = name; | 123 | d->name = name; |
124 | d->value = value; | 124 | d->value = value; |
@@ -175,7 +175,7 @@ const char * get_fresource(const char *fmt, ...) | @@ -175,7 +175,7 @@ const char * get_fresource(const char *fmt, ...) | ||
175 | name = xs_vsprintf(fmt, args); | 175 | name = xs_vsprintf(fmt, args); |
176 | va_end(args); | 176 | va_end(args); |
177 | r = get_resource(name); | 177 | r = get_resource(name); |
178 | - Free(name); | 178 | + lib3270_free(name); |
179 | return r; | 179 | return r; |
180 | } | 180 | } |
181 | 181 |
src/lib3270/rpq.c
@@ -282,7 +282,7 @@ select_rpq_terms(void) | @@ -282,7 +282,7 @@ select_rpq_terms(void) | ||
282 | * If there are override values, I'll get those from the ORIGINAL | 282 | * If there are override values, I'll get those from the ORIGINAL |
283 | * string so upper/lower case is preserved as necessary. | 283 | * string so upper/lower case is preserved as necessary. |
284 | */ | 284 | */ |
285 | - uplist = (char *) malloc(strlen(x3270rpq)+1); | 285 | + uplist = (char *) lib3270_malloc(strlen(x3270rpq)+1); |
286 | assert(uplist != NULL); | 286 | assert(uplist != NULL); |
287 | p1 = uplist; | 287 | p1 = uplist; |
288 | p2 = x3270rpq; | 288 | p2 = x3270rpq; |
@@ -594,7 +594,7 @@ get_rpq_address(unsigned char *buf, const int maxlen) | @@ -594,7 +594,7 @@ get_rpq_address(unsigned char *buf, const int maxlen) | ||
594 | #endif /*]*/ | 594 | #endif /*]*/ |
595 | 595 | ||
596 | p1 = x3270rpq + kw->oride; | 596 | p1 = x3270rpq + kw->oride; |
597 | - rpqtext = (char *) malloc(strlen(p1) + 1); | 597 | + rpqtext = (char *) lib3270_malloc(strlen(p1) + 1); |
598 | for (p2=rpqtext;*p1; p2++) { | 598 | for (p2=rpqtext;*p1; p2++) { |
599 | if (*p1 == ':') | 599 | if (*p1 == ':') |
600 | break; | 600 | break; |
@@ -729,7 +729,7 @@ static void rpq_warning(const char *fmt, ...) | @@ -729,7 +729,7 @@ static void rpq_warning(const char *fmt, ...) | ||
729 | { | 729 | { |
730 | va_start(a, fmt); | 730 | va_start(a, fmt); |
731 | if (rpq_warnbuf == CN) | 731 | if (rpq_warnbuf == CN) |
732 | - rpq_warnbuf = Malloc(RPQ_WARNBUF_SIZE); | 732 | + rpq_warnbuf = lib3270_malloc(RPQ_WARNBUF_SIZE); |
733 | 733 | ||
734 | if (rpq_wbcnt < RPQ_WARNBUF_SIZE) | 734 | if (rpq_wbcnt < RPQ_WARNBUF_SIZE) |
735 | { | 735 | { |
src/lib3270/selection.c
@@ -29,7 +29,7 @@ | @@ -29,7 +29,7 @@ | ||
29 | 29 | ||
30 | #include "globals.h" | 30 | #include "globals.h" |
31 | #include "appres.h" | 31 | #include "appres.h" |
32 | - #include <malloc.h> | 32 | +// #include <malloc.h> |
33 | #include <lib3270.h> | 33 | #include <lib3270.h> |
34 | #include <lib3270/session.h> | 34 | #include <lib3270/session.h> |
35 | #include <lib3270/selection.h> | 35 | #include <lib3270/selection.h> |
@@ -382,7 +382,7 @@ static char * get_text(H3270 *hSession,unsigned char all) | @@ -382,7 +382,7 @@ static char * get_text(H3270 *hSession,unsigned char all) | ||
382 | if(!lib3270_connected(hSession)) | 382 | if(!lib3270_connected(hSession)) |
383 | return NULL; | 383 | return NULL; |
384 | 384 | ||
385 | - ret = malloc(buflen); | 385 | + ret = lib3270_malloc(buflen); |
386 | 386 | ||
387 | baddr = 0; | 387 | baddr = 0; |
388 | for(row=0;row < hSession->rows;row++) | 388 | for(row=0;row < hSession->rows;row++) |
@@ -405,14 +405,14 @@ static char * get_text(H3270 *hSession,unsigned char all) | @@ -405,14 +405,14 @@ static char * get_text(H3270 *hSession,unsigned char all) | ||
405 | 405 | ||
406 | if(!sz) | 406 | if(!sz) |
407 | { | 407 | { |
408 | - free(ret); | 408 | + lib3270_free(ret); |
409 | return NULL; | 409 | return NULL; |
410 | } | 410 | } |
411 | 411 | ||
412 | ret[sz++] = 0; | 412 | ret[sz++] = 0; |
413 | 413 | ||
414 | if(sz != buflen) | 414 | if(sz != buflen) |
415 | - ret = realloc(ret,sz); | 415 | + ret = lib3270_realloc(ret,sz); |
416 | 416 | ||
417 | return ret; | 417 | return ret; |
418 | } | 418 | } |
@@ -434,7 +434,7 @@ LIB3270_EXPORT char * lib3270_get_region(H3270 *h, int start_pos, int end_pos, u | @@ -434,7 +434,7 @@ LIB3270_EXPORT char * lib3270_get_region(H3270 *h, int start_pos, int end_pos, u | ||
434 | if(start_pos < 0 || start_pos > maxlen || end_pos < 0 || end_pos > maxlen || end_pos < start_pos) | 434 | if(start_pos < 0 || start_pos > maxlen || end_pos < 0 || end_pos > maxlen || end_pos < start_pos) |
435 | return NULL; | 435 | return NULL; |
436 | 436 | ||
437 | - text = malloc(maxlen); | 437 | + text = lib3270_malloc(maxlen); |
438 | 438 | ||
439 | for(baddr=start_pos;baddr<end_pos;baddr++) | 439 | for(baddr=start_pos;baddr<end_pos;baddr++) |
440 | { | 440 | { |
@@ -446,7 +446,7 @@ LIB3270_EXPORT char * lib3270_get_region(H3270 *h, int start_pos, int end_pos, u | @@ -446,7 +446,7 @@ LIB3270_EXPORT char * lib3270_get_region(H3270 *h, int start_pos, int end_pos, u | ||
446 | } | 446 | } |
447 | text[sz++] = 0; | 447 | text[sz++] = 0; |
448 | 448 | ||
449 | - return realloc(text,sz); | 449 | + return lib3270_realloc(text,sz); |
450 | } | 450 | } |
451 | 451 | ||
452 | LIB3270_EXPORT char * lib3270_get_text(H3270 *h, int offset, int len) | 452 | LIB3270_EXPORT char * lib3270_get_text(H3270 *h, int offset, int len) |
@@ -467,7 +467,7 @@ LIB3270_EXPORT char * lib3270_get_text(H3270 *h, int offset, int len) | @@ -467,7 +467,7 @@ LIB3270_EXPORT char * lib3270_get_text(H3270 *h, int offset, int len) | ||
467 | else if(len > maxlen) | 467 | else if(len > maxlen) |
468 | len = maxlen; | 468 | len = maxlen; |
469 | 469 | ||
470 | - buffer = malloc(len+1); | 470 | + buffer = lib3270_malloc(len+1); |
471 | ptr = buffer; | 471 | ptr = buffer; |
472 | 472 | ||
473 | // trace("len=%d buffer=%p",len,buffer); | 473 | // trace("len=%d buffer=%p",len,buffer); |
src/lib3270/telnet.c
@@ -162,10 +162,7 @@ static unsigned char *sbbuf = (unsigned char *)NULL; | @@ -162,10 +162,7 @@ static unsigned char *sbbuf = (unsigned char *)NULL; | ||
162 | /* telnet sub-option buffer */ | 162 | /* telnet sub-option buffer */ |
163 | static unsigned char *sbptr; | 163 | static unsigned char *sbptr; |
164 | static unsigned char telnet_state; | 164 | static unsigned char telnet_state; |
165 | -static int syncing; | ||
166 | -#if !defined(_WIN32) /*[*/ | ||
167 | -static unsigned long output_id = 0L; | ||
168 | -#endif /*]*/ | 165 | +// static int syncing; |
169 | static char ttype_tmpval[13]; | 166 | static char ttype_tmpval[13]; |
170 | 167 | ||
171 | #if defined(X3270_TN3270E) /*[*/ | 168 | #if defined(X3270_TN3270E) /*[*/ |
@@ -514,7 +511,7 @@ int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Bo | @@ -514,7 +511,7 @@ int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Bo | ||
514 | #endif | 511 | #endif |
515 | 512 | ||
516 | if (netrbuf == (unsigned char *)NULL) | 513 | if (netrbuf == (unsigned char *)NULL) |
517 | - netrbuf = (unsigned char *)Malloc(BUFSZ); | 514 | + netrbuf = (unsigned char *)lib3270_malloc(BUFSZ); |
518 | 515 | ||
519 | #if defined(X3270_ANSI) /*[*/ | 516 | #if defined(X3270_ANSI) /*[*/ |
520 | if (!t_valid) | 517 | if (!t_valid) |
@@ -690,7 +687,7 @@ int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Bo | @@ -690,7 +687,7 @@ int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Bo | ||
690 | msg, | 687 | msg, |
691 | "%s",strerror(rc) ); | 688 | "%s",strerror(rc) ); |
692 | 689 | ||
693 | - Free(msg); | 690 | + lib3270_free(msg); |
694 | close_fail; | 691 | close_fail; |
695 | 692 | ||
696 | } | 693 | } |
@@ -775,8 +772,7 @@ setup_lus(void) | @@ -775,8 +772,7 @@ setup_lus(void) | ||
775 | * Allocate enough memory to construct an argv[] array for | 772 | * Allocate enough memory to construct an argv[] array for |
776 | * the LUs. | 773 | * the LUs. |
777 | */ | 774 | */ |
778 | - Replace(lus, | ||
779 | - (char **)Malloc((n_lus+1) * sizeof(char *) + strlen(h3270.luname) + 1)); | 775 | + Replace(lus,(char **)lib3270_malloc((n_lus+1) * sizeof(char *) + strlen(h3270.luname) + 1)); |
780 | 776 | ||
781 | /* Copy each LU into the array. */ | 777 | /* Copy each LU into the array. */ |
782 | lu = (char *)(lus + n_lus + 1); | 778 | lu = (char *)(lus + n_lus + 1); |
@@ -884,7 +880,7 @@ static void net_connected(H3270 *session) | @@ -884,7 +880,7 @@ static void net_connected(H3270 *session) | ||
884 | ns_rrcvd = 0; | 880 | ns_rrcvd = 0; |
885 | ns_bsent = 0; | 881 | ns_bsent = 0; |
886 | ns_rsent = 0; | 882 | ns_rsent = 0; |
887 | - syncing = 0; | 883 | + session->syncing = 0; |
888 | tn3270e_negotiated = 0; | 884 | tn3270e_negotiated = 0; |
889 | tn3270e_submode = E_NONE; | 885 | tn3270e_submode = E_NONE; |
890 | tn3270e_bound = 0; | 886 | tn3270e_bound = 0; |
@@ -898,10 +894,10 @@ static void net_connected(H3270 *session) | @@ -898,10 +894,10 @@ static void net_connected(H3270 *session) | ||
898 | { | 894 | { |
899 | char *buf; | 895 | char *buf; |
900 | 896 | ||
901 | - buf = Malloc(strlen(session->hostname) + 32); | 897 | + buf = lib3270_malloc(strlen(session->hostname) + 32); |
902 | (void) sprintf(buf, "%s %d\r\n", session->hostname, session->current_port); | 898 | (void) sprintf(buf, "%s %d\r\n", session->hostname, session->current_port); |
903 | (void) send(session->sock, buf, strlen(buf), 0); | 899 | (void) send(session->sock, buf, strlen(buf), 0); |
904 | - Free(buf); | 900 | + lib3270_free(buf); |
905 | } | 901 | } |
906 | } | 902 | } |
907 | 903 | ||
@@ -956,14 +952,17 @@ void net_disconnect(H3270 *session) | @@ -956,14 +952,17 @@ void net_disconnect(H3270 *session) | ||
956 | session->connected_lu = CN; | 952 | session->connected_lu = CN; |
957 | status_lu(&h3270,CN); | 953 | status_lu(&h3270,CN); |
958 | 954 | ||
959 | -#if !defined(_WIN32) /*[*/ | ||
960 | - /* We have no more interest in output buffer space. */ | ||
961 | - if (output_id != 0L) | 955 | +/* |
956 | +#if !defined(_WIN32) | ||
957 | + // We have no more interest in output buffer space. | ||
958 | + if(session->output_id != NULL) | ||
962 | { | 959 | { |
963 | - RemoveInput(output_id); | ||
964 | - output_id = 0L; | 960 | + RemoveInput(session->output_id); |
961 | + session->output_id = NULL; | ||
965 | } | 962 | } |
966 | -#endif /*]*/ | 963 | +#endif |
964 | +*/ | ||
965 | + | ||
967 | } | 966 | } |
968 | 967 | ||
969 | 968 | ||
@@ -1232,7 +1231,8 @@ telnet_fsm(unsigned char c) | @@ -1232,7 +1231,8 @@ telnet_fsm(unsigned char c) | ||
1232 | ansi_data = 4 + sl; | 1231 | ansi_data = 4 + sl; |
1233 | } | 1232 | } |
1234 | trace_dsn("%s",see_chr); | 1233 | trace_dsn("%s",see_chr); |
1235 | - if (!syncing) { | 1234 | + if (!h3270.syncing) |
1235 | + { | ||
1236 | if (linemode && h3270.onlcr && c == '\n') | 1236 | if (linemode && h3270.onlcr && c == '\n') |
1237 | ansi_process((unsigned int) '\r'); | 1237 | ansi_process((unsigned int) '\r'); |
1238 | ansi_process((unsigned int) c); | 1238 | ansi_process((unsigned int) c); |
@@ -1295,14 +1295,14 @@ telnet_fsm(unsigned char c) | @@ -1295,14 +1295,14 @@ telnet_fsm(unsigned char c) | ||
1295 | case SB: | 1295 | case SB: |
1296 | telnet_state = TNS_SB; | 1296 | telnet_state = TNS_SB; |
1297 | if (sbbuf == (unsigned char *)NULL) | 1297 | if (sbbuf == (unsigned char *)NULL) |
1298 | - sbbuf = (unsigned char *)Malloc(1024); | 1298 | + sbbuf = (unsigned char *)lib3270_malloc(1024); |
1299 | sbptr = sbbuf; | 1299 | sbptr = sbbuf; |
1300 | break; | 1300 | break; |
1301 | case DM: | 1301 | case DM: |
1302 | trace_dsn("\n"); | 1302 | trace_dsn("\n"); |
1303 | - if (syncing) | 1303 | + if (h3270.syncing) |
1304 | { | 1304 | { |
1305 | - syncing = 0; | 1305 | + h3270.syncing = 0; |
1306 | x_except_on(&h3270); | 1306 | x_except_on(&h3270); |
1307 | } | 1307 | } |
1308 | telnet_state = TNS_DATA; | 1308 | telnet_state = TNS_DATA; |
@@ -1480,7 +1480,7 @@ telnet_fsm(unsigned char c) | @@ -1480,7 +1480,7 @@ telnet_fsm(unsigned char c) | ||
1480 | status_lu(&h3270,h3270.connected_lu); | 1480 | status_lu(&h3270,h3270.connected_lu); |
1481 | 1481 | ||
1482 | tb_len = 4 + tt_len + 2; | 1482 | tb_len = 4 + tt_len + 2; |
1483 | - tt_out = Malloc(tb_len + 1); | 1483 | + tt_out = lib3270_malloc(tb_len + 1); |
1484 | (void) sprintf(tt_out, "%c%c%c%c%s%s%s%c%c", | 1484 | (void) sprintf(tt_out, "%c%c%c%c%s%s%s%c%c", |
1485 | IAC, SB, TELOPT_TTYPE, TELQUAL_IS, | 1485 | IAC, SB, TELOPT_TTYPE, TELQUAL_IS, |
1486 | h3270.termtype, | 1486 | h3270.termtype, |
@@ -1494,7 +1494,7 @@ telnet_fsm(unsigned char c) | @@ -1494,7 +1494,7 @@ telnet_fsm(unsigned char c) | ||
1494 | telquals[TELQUAL_IS], | 1494 | telquals[TELQUAL_IS], |
1495 | tt_len, tt_out + 4, | 1495 | tt_len, tt_out + 4, |
1496 | cmd(SE)); | 1496 | cmd(SE)); |
1497 | - Free(tt_out); | 1497 | + lib3270_free(tt_out); |
1498 | 1498 | ||
1499 | /* Advance to the next LU name. */ | 1499 | /* Advance to the next LU name. */ |
1500 | next_lu(); | 1500 | next_lu(); |
@@ -1536,7 +1536,7 @@ tn3270e_request(void) | @@ -1536,7 +1536,7 @@ tn3270e_request(void) | ||
1536 | tt_len += strlen(try_lu) + 1; | 1536 | tt_len += strlen(try_lu) + 1; |
1537 | 1537 | ||
1538 | tb_len = 5 + tt_len + 2; | 1538 | tb_len = 5 + tt_len + 2; |
1539 | - tt_out = Malloc(tb_len + 1); | 1539 | + tt_out = lib3270_malloc(tb_len + 1); |
1540 | t = tt_out; | 1540 | t = tt_out; |
1541 | t += sprintf(tt_out, "%c%c%c%c%c%s", | 1541 | t += sprintf(tt_out, "%c%c%c%c%c%s", |
1542 | IAC, SB, TELOPT_TN3270E, TN3270E_OP_DEVICE_TYPE, | 1542 | IAC, SB, TELOPT_TN3270E, TN3270E_OP_DEVICE_TYPE, |
@@ -1559,7 +1559,7 @@ tn3270e_request(void) | @@ -1559,7 +1559,7 @@ tn3270e_request(void) | ||
1559 | (try_lu != CN && *try_lu) ? try_lu : "", | 1559 | (try_lu != CN && *try_lu) ? try_lu : "", |
1560 | cmd(SE)); | 1560 | cmd(SE)); |
1561 | 1561 | ||
1562 | - Free(tt_out); | 1562 | + lib3270_free(tt_out); |
1563 | } | 1563 | } |
1564 | 1564 | ||
1565 | /* | 1565 | /* |
@@ -1884,7 +1884,7 @@ process_bind(unsigned char *buf, int buflen) | @@ -1884,7 +1884,7 @@ process_bind(unsigned char *buf, int buflen) | ||
1884 | static int | 1884 | static int |
1885 | process_eor(void) | 1885 | process_eor(void) |
1886 | { | 1886 | { |
1887 | - if (syncing || !(ibptr - ibuf)) | 1887 | + if (h3270.syncing || !(ibptr - ibuf)) |
1888 | return(0); | 1888 | return(0); |
1889 | 1889 | ||
1890 | #if defined(X3270_TN3270E) /*[*/ | 1890 | #if defined(X3270_TN3270E) /*[*/ |
@@ -1968,15 +1968,17 @@ process_eor(void) | @@ -1968,15 +1968,17 @@ process_eor(void) | ||
1968 | */ | 1968 | */ |
1969 | void net_exception(H3270 *session) | 1969 | void net_exception(H3270 *session) |
1970 | { | 1970 | { |
1971 | + CHECK_SESSION_HANDLE(session); | ||
1972 | + | ||
1971 | trace_dsn("RCVD urgent data indication\n"); | 1973 | trace_dsn("RCVD urgent data indication\n"); |
1972 | - if (!syncing) | 1974 | + if (!session->syncing) |
1973 | { | 1975 | { |
1974 | - syncing = 1; | 1976 | + session->syncing = 1; |
1975 | 1977 | ||
1976 | if(session->excepting) | 1978 | if(session->excepting) |
1977 | { | 1979 | { |
1978 | RemoveInput(session->ns_exception_id); | 1980 | RemoveInput(session->ns_exception_id); |
1979 | - session->excepting = False; | 1981 | + session->excepting = 0; |
1980 | } | 1982 | } |
1981 | // x_except_off(session); | 1983 | // x_except_off(session); |
1982 | } | 1984 | } |
@@ -2105,7 +2107,7 @@ net_hexansi_out(unsigned char *buf, int len) | @@ -2105,7 +2107,7 @@ net_hexansi_out(unsigned char *buf, int len) | ||
2105 | #endif /*]*/ | 2107 | #endif /*]*/ |
2106 | 2108 | ||
2107 | /* Expand it. */ | 2109 | /* Expand it. */ |
2108 | - tbuf = xbuf = (unsigned char *)Malloc(2*len); | 2110 | + tbuf = xbuf = (unsigned char *)lib3270_malloc(2*len); |
2109 | while (len) { | 2111 | while (len) { |
2110 | unsigned char c = *buf++; | 2112 | unsigned char c = *buf++; |
2111 | 2113 | ||
@@ -2119,7 +2121,7 @@ net_hexansi_out(unsigned char *buf, int len) | @@ -2119,7 +2121,7 @@ net_hexansi_out(unsigned char *buf, int len) | ||
2119 | 2121 | ||
2120 | /* Send it to the host. */ | 2122 | /* Send it to the host. */ |
2121 | net_rawout(xbuf, tbuf - xbuf); | 2123 | net_rawout(xbuf, tbuf - xbuf); |
2122 | - Free(xbuf); | 2124 | + lib3270_free(xbuf); |
2123 | } | 2125 | } |
2124 | 2126 | ||
2125 | /* | 2127 | /* |
@@ -2212,7 +2214,7 @@ static void | @@ -2212,7 +2214,7 @@ static void | ||
2212 | cooked_init(void) | 2214 | cooked_init(void) |
2213 | { | 2215 | { |
2214 | if (lbuf == (unsigned char *)NULL) | 2216 | if (lbuf == (unsigned char *)NULL) |
2215 | - lbuf = (unsigned char *)Malloc(BUFSZ); | 2217 | + lbuf = (unsigned char *)lib3270_malloc(BUFSZ); |
2216 | lbptr = lbuf; | 2218 | lbptr = lbuf; |
2217 | lnext = 0; | 2219 | lnext = 0; |
2218 | backslashed = 0; | 2220 | backslashed = 0; |
@@ -2486,7 +2488,7 @@ check_in3270(void) | @@ -2486,7 +2488,7 @@ check_in3270(void) | ||
2486 | 2488 | ||
2487 | /* Allocate the initial 3270 input buffer. */ | 2489 | /* Allocate the initial 3270 input buffer. */ |
2488 | if (new_cstate >= CONNECTED_INITIAL && !ibuf_size) { | 2490 | if (new_cstate >= CONNECTED_INITIAL && !ibuf_size) { |
2489 | - ibuf = (unsigned char *)Malloc(BUFSIZ); | 2491 | + ibuf = (unsigned char *)lib3270_malloc(BUFSIZ); |
2490 | ibuf_size = BUFSIZ; | 2492 | ibuf_size = BUFSIZ; |
2491 | ibptr = ibuf; | 2493 | ibptr = ibuf; |
2492 | } | 2494 | } |
@@ -2726,7 +2728,7 @@ net_output(void) | @@ -2726,7 +2728,7 @@ net_output(void) | ||
2726 | need_resize++; | 2728 | need_resize++; |
2727 | } | 2729 | } |
2728 | if (need_resize) { | 2730 | if (need_resize) { |
2729 | - Replace(xobuf, (unsigned char *)Malloc(xobuf_len)); | 2731 | + Replace(xobuf, (unsigned char *)lib3270_malloc(xobuf_len)); |
2730 | } | 2732 | } |
2731 | 2733 | ||
2732 | /* Copy and expand IACs. */ | 2734 | /* Copy and expand IACs. */ |
src/lib3270/trace_ds.c
@@ -421,7 +421,7 @@ static char * create_tracefile_header(const char *mode) | @@ -421,7 +421,7 @@ static char * create_tracefile_header(const char *mode) | ||
421 | time_t clk; | 421 | time_t clk; |
422 | 422 | ||
423 | // Create a buffer and redirect output. | 423 | // Create a buffer and redirect output. |
424 | - buf = Malloc(MAX_HEADER_SIZE); | 424 | + buf = lib3270_malloc(MAX_HEADER_SIZE); |
425 | tracef_bufptr = buf; | 425 | tracef_bufptr = buf; |
426 | 426 | ||
427 | // Display current status | 427 | // Display current status |
@@ -583,7 +583,7 @@ static void tracefile_callback(Widget w, XtPointer client_data, XtPointer call_d | @@ -583,7 +583,7 @@ static void tracefile_callback(Widget w, XtPointer client_data, XtPointer call_d | ||
583 | if (strchr(tfn, '\'') || ((int)strlen(tfn) > 0 && tfn[strlen(tfn)-1] == '\\')) | 583 | if (strchr(tfn, '\'') || ((int)strlen(tfn) > 0 && tfn[strlen(tfn)-1] == '\\')) |
584 | { | 584 | { |
585 | popup_an_error("Illegal file name: %s", tfn); | 585 | popup_an_error("Illegal file name: %s", tfn); |
586 | - Free(tfn); | 586 | + lib3270_free(tfn); |
587 | return; | 587 | return; |
588 | } | 588 | } |
589 | 589 | ||
@@ -604,7 +604,7 @@ static void tracefile_callback(Widget w, XtPointer client_data, XtPointer call_d | @@ -604,7 +604,7 @@ static void tracefile_callback(Widget w, XtPointer client_data, XtPointer call_d | ||
604 | if (tracef_max && !access(tfn, R_OK)) | 604 | if (tracef_max && !access(tfn, R_OK)) |
605 | { | 605 | { |
606 | popup_an_error("Trace file '%s' already exists",tfn); | 606 | popup_an_error("Trace file '%s' already exists",tfn); |
607 | - Free(tfn); | 607 | + lib3270_free(tfn); |
608 | return; | 608 | return; |
609 | } | 609 | } |
610 | 610 | ||
@@ -616,7 +616,7 @@ static void tracefile_callback(Widget w, XtPointer client_data, XtPointer call_d | @@ -616,7 +616,7 @@ static void tracefile_callback(Widget w, XtPointer client_data, XtPointer call_d | ||
616 | if (tracef == (FILE *)NULL) | 616 | if (tracef == (FILE *)NULL) |
617 | { | 617 | { |
618 | popup_an_errno(errno, tfn); | 618 | popup_an_errno(errno, tfn); |
619 | - Free(tfn); | 619 | + lib3270_free(tfn); |
620 | return; | 620 | return; |
621 | } | 621 | } |
622 | (void) SETLINEBUF(tracef); | 622 | (void) SETLINEBUF(tracef); |
@@ -629,7 +629,7 @@ static void tracefile_callback(Widget w, XtPointer client_data, XtPointer call_d | @@ -629,7 +629,7 @@ static void tracefile_callback(Widget w, XtPointer client_data, XtPointer call_d | ||
629 | if(!tracewindow_handle) | 629 | if(!tracewindow_handle) |
630 | tracewindow_handle = console_window_new( tfn, NULL ); | 630 | tracewindow_handle = console_window_new( tfn, NULL ); |
631 | 631 | ||
632 | - Free(tfn); | 632 | + lib3270_free(tfn); |
633 | 633 | ||
634 | // We're really tracing, turn the flag on. | 634 | // We're really tracing, turn the flag on. |
635 | appres.toggle[trace_reason].value = True; | 635 | appres.toggle[trace_reason].value = True; |
@@ -639,7 +639,7 @@ static void tracefile_callback(Widget w, XtPointer client_data, XtPointer call_d | @@ -639,7 +639,7 @@ static void tracefile_callback(Widget w, XtPointer client_data, XtPointer call_d | ||
639 | // Display current status | 639 | // Display current status |
640 | buf = create_tracefile_header("started"); | 640 | buf = create_tracefile_header("started"); |
641 | wtrace("%s", buf); | 641 | wtrace("%s", buf); |
642 | - Free(buf); | 642 | + lib3270_free(buf); |
643 | 643 | ||
644 | } | 644 | } |
645 | 645 | ||
@@ -696,7 +696,7 @@ tracefile_on(int reason, LIB3270_TOGGLE_TYPE tt) | @@ -696,7 +696,7 @@ tracefile_on(int reason, LIB3270_TOGGLE_TYPE tt) | ||
696 | { | 696 | { |
697 | tracefile_callback((Widget)NULL, tracefile, PN); | 697 | tracefile_callback((Widget)NULL, tracefile, PN); |
698 | if (tracefile_buf != NULL) | 698 | if (tracefile_buf != NULL) |
699 | - Free(tracefile_buf); | 699 | + lib3270_free(tracefile_buf); |
700 | return; | 700 | return; |
701 | } | 701 | } |
702 | #if defined(X3270_DISPLAY) | 702 | #if defined(X3270_DISPLAY) |
@@ -718,7 +718,7 @@ tracefile_on(int reason, LIB3270_TOGGLE_TYPE tt) | @@ -718,7 +718,7 @@ tracefile_on(int reason, LIB3270_TOGGLE_TYPE tt) | ||
718 | #endif | 718 | #endif |
719 | 719 | ||
720 | if (tracefile_buf != NULL) | 720 | if (tracefile_buf != NULL) |
721 | - Free(tracefile_buf); | 721 | + lib3270_free(tracefile_buf); |
722 | } | 722 | } |
723 | 723 | ||
724 | // Close the trace file. | 724 | // Close the trace file. |
@@ -856,10 +856,10 @@ screentrace_cb(char *tfn) | @@ -856,10 +856,10 @@ screentrace_cb(char *tfn) | ||
856 | screentracef = fopen(tfn, "a"); | 856 | screentracef = fopen(tfn, "a"); |
857 | if (screentracef == (FILE *)NULL) { | 857 | if (screentracef == (FILE *)NULL) { |
858 | popup_an_errno(errno, tfn); | 858 | popup_an_errno(errno, tfn); |
859 | - Free(tfn); | 859 | + lib3270_free(tfn); |
860 | return False; | 860 | return False; |
861 | } | 861 | } |
862 | - Free(tfn); | 862 | + lib3270_free(tfn); |
863 | (void) SETLINEBUF(screentracef); | 863 | (void) SETLINEBUF(screentracef); |
864 | #if !defined(_WIN32) | 864 | #if !defined(_WIN32) |
865 | (void) fcntl(fileno(screentracef), F_SETFD, 1); | 865 | (void) fcntl(fileno(screentracef), F_SETFD, 1); |
@@ -941,7 +941,7 @@ void toggle_screenTrace(H3270 *session, struct toggle *t unused, LIB3270_TOGGLE_ | @@ -941,7 +941,7 @@ void toggle_screenTrace(H3270 *session, struct toggle *t unused, LIB3270_TOGGLE_ | ||
941 | if (tt == TT_INITIAL || tt == TT_ACTION) { | 941 | if (tt == TT_INITIAL || tt == TT_ACTION) { |
942 | (void) screentrace_cb(NewString(tracefile)); | 942 | (void) screentrace_cb(NewString(tracefile)); |
943 | if (tracefile_buf != NULL) | 943 | if (tracefile_buf != NULL) |
944 | - Free(tracefile_buf); | 944 | + lib3270_free(tracefile_buf); |
945 | return; | 945 | return; |
946 | } | 946 | } |
947 | #if defined(X3270_DISPLAY) | 947 | #if defined(X3270_DISPLAY) |
@@ -965,7 +965,7 @@ void toggle_screenTrace(H3270 *session, struct toggle *t unused, LIB3270_TOGGLE_ | @@ -965,7 +965,7 @@ void toggle_screenTrace(H3270 *session, struct toggle *t unused, LIB3270_TOGGLE_ | ||
965 | } | 965 | } |
966 | 966 | ||
967 | if (tracefile_buf != NULL) | 967 | if (tracefile_buf != NULL) |
968 | - Free(tracefile_buf); | 968 | + lib3270_free(tracefile_buf); |
969 | } | 969 | } |
970 | */ | 970 | */ |
971 | 971 |
src/lib3270/utf8.c
@@ -432,7 +432,7 @@ utf8_set_display_charsets(char *cslist, char *csname) | @@ -432,7 +432,7 @@ utf8_set_display_charsets(char *cslist, char *csname) | ||
432 | } | 432 | } |
433 | if (tok == CN) { | 433 | if (tok == CN) { |
434 | popup_an_error(NULL,"Invalid displayCharset specification"); | 434 | popup_an_error(NULL,"Invalid displayCharset specification"); |
435 | - Free(dup); | 435 | + lib3270_free(dup); |
436 | return False; | 436 | return False; |
437 | } | 437 | } |
438 | 438 | ||
@@ -444,11 +444,11 @@ utf8_set_display_charsets(char *cslist, char *csname) | @@ -444,11 +444,11 @@ utf8_set_display_charsets(char *cslist, char *csname) | ||
444 | if (dcs[i] == CN) { | 444 | if (dcs[i] == CN) { |
445 | popup_an_error(NULL,"Unknown displayCharset specification '%s'", | 445 | popup_an_error(NULL,"Unknown displayCharset specification '%s'", |
446 | csname); | 446 | csname); |
447 | - Free(dup); | 447 | + lib3270_free(dup); |
448 | return False; | 448 | return False; |
449 | } | 449 | } |
450 | utf8_ix = i; | 450 | utf8_ix = i; |
451 | - Free(dup); | 451 | + lib3270_free(dup); |
452 | return True; | 452 | return True; |
453 | } | 453 | } |
454 | */ | 454 | */ |
src/lib3270/util.c
@@ -54,6 +54,10 @@ | @@ -54,6 +54,10 @@ | ||
54 | #include <pwd.h> | 54 | #include <pwd.h> |
55 | #endif // _WIN32 | 55 | #endif // _WIN32 |
56 | 56 | ||
57 | +#ifdef HAVE_MALLOC_H | ||
58 | + #include <malloc.h> | ||
59 | +#endif | ||
60 | + | ||
57 | #ifndef ANDROID | 61 | #ifndef ANDROID |
58 | #include <stdlib.h> | 62 | #include <stdlib.h> |
59 | #endif // !ANDROID | 63 | #endif // !ANDROID |
@@ -177,7 +181,7 @@ char * xs_vsprintf(const char *fmt, va_list args) | @@ -177,7 +181,7 @@ char * xs_vsprintf(const char *fmt, va_list args) | ||
177 | nc = vsprintf(buf, fmt, args); | 181 | nc = vsprintf(buf, fmt, args); |
178 | if (nc > sizeof(buf)) | 182 | if (nc > sizeof(buf)) |
179 | Error(NULL,"Internal buffer overflow"); | 183 | Error(NULL,"Internal buffer overflow"); |
180 | - r = Malloc(nc + 1); | 184 | + r = lib3270_malloc(nc + 1); |
181 | return strcpy(r, buf); | 185 | return strcpy(r, buf); |
182 | #endif /*]*/ | 186 | #endif /*]*/ |
183 | } | 187 | } |
@@ -210,7 +214,7 @@ xs_warning(const char *fmt, ...) | @@ -210,7 +214,7 @@ xs_warning(const char *fmt, ...) | ||
210 | r = xs_vsprintf(fmt, args); | 214 | r = xs_vsprintf(fmt, args); |
211 | va_end(args); | 215 | va_end(args); |
212 | Warning(NULL,r); | 216 | Warning(NULL,r); |
213 | - Free(r); | 217 | + lib3270_free(r); |
214 | } | 218 | } |
215 | 219 | ||
216 | void | 220 | void |
@@ -223,7 +227,7 @@ xs_error(const char *fmt, ...) | @@ -223,7 +227,7 @@ xs_error(const char *fmt, ...) | ||
223 | r = xs_vsprintf(fmt, args); | 227 | r = xs_vsprintf(fmt, args); |
224 | va_end(args); | 228 | va_end(args); |
225 | Error(NULL,r); | 229 | Error(NULL,r); |
226 | - Free(r); | 230 | + lib3270_free(r); |
227 | } | 231 | } |
228 | 232 | ||
229 | /* Prettyprinter for strings with unprintable data. */ | 233 | /* Prettyprinter for strings with unprintable data. */ |
@@ -406,11 +410,11 @@ split_dbcs_resource(const char *value, char sep, char **part1, char **part2) | @@ -406,11 +410,11 @@ split_dbcs_resource(const char *value, char sep, char **part1, char **part2) | ||
406 | if (f_end == f_start) { | 410 | if (f_end == f_start) { |
407 | if (c == sep) { | 411 | if (c == sep) { |
408 | if (*part1) { | 412 | if (*part1) { |
409 | - Free(*part1); | 413 | + lib3270_free(*part1); |
410 | *part1 = NULL; | 414 | *part1 = NULL; |
411 | } | 415 | } |
412 | if (*part2) { | 416 | if (*part2) { |
413 | - Free(*part2); | 417 | + lib3270_free(*part2); |
414 | *part2 = NULL; | 418 | *part2 = NULL; |
415 | } | 419 | } |
416 | return -1; | 420 | return -1; |
@@ -427,7 +431,7 @@ split_dbcs_resource(const char *value, char sep, char **part1, char **part2) | @@ -427,7 +431,7 @@ split_dbcs_resource(const char *value, char sep, char **part1, char **part2) | ||
427 | default: | 431 | default: |
428 | return 3; | 432 | return 3; |
429 | } | 433 | } |
430 | - *rp = Malloc(f_end - f_start + 1); | 434 | + *rp = lib3270_malloc(f_end - f_start + 1); |
431 | strncpy(*rp, f_start, f_end - f_start); | 435 | strncpy(*rp, f_start, f_end - f_start); |
432 | (*rp)[f_end - f_start] = '\0'; | 436 | (*rp)[f_end - f_start] = '\0'; |
433 | f_end = CN; | 437 | f_end = CN; |
@@ -539,7 +543,7 @@ var_subst(const char *s) | @@ -539,7 +543,7 @@ var_subst(const char *s) | ||
539 | return NewString(s); | 543 | return NewString(s); |
540 | 544 | ||
541 | o_len = strlen(s) + 1; | 545 | o_len = strlen(s) + 1; |
542 | - ob = Malloc(o_len); | 546 | + ob = lib3270_malloc(o_len); |
543 | o = ob; | 547 | o = ob; |
544 | # define LBR '{' | 548 | # define LBR '{' |
545 | # define RBR '}' | 549 | # define RBR '}' |
@@ -604,7 +608,7 @@ var_subst(const char *s) | @@ -604,7 +608,7 @@ var_subst(const char *s) | ||
604 | state = VS_BASE; | 608 | state = VS_BASE; |
605 | continue; /* rescan */ | 609 | continue; /* rescan */ |
606 | } | 610 | } |
607 | - vn = Malloc(vn_len + 1); | 611 | + vn = lib3270_malloc(vn_len + 1); |
608 | (void) strncpy(vn, vn_start, vn_len); | 612 | (void) strncpy(vn, vn_start, vn_len); |
609 | vn[vn_len] = '\0'; | 613 | vn[vn_len] = '\0'; |
610 | 614 | ||
@@ -625,7 +629,7 @@ var_subst(const char *s) | @@ -625,7 +629,7 @@ var_subst(const char *s) | ||
625 | } | 629 | } |
626 | #endif // !ANDROID | 630 | #endif // !ANDROID |
627 | 631 | ||
628 | - Free(vn); | 632 | + lib3270_free(vn); |
629 | if (state == VS_VNB) { | 633 | if (state == VS_VNB) { |
630 | state = VS_BASE; | 634 | state = VS_BASE; |
631 | break; | 635 | break; |
@@ -670,7 +674,7 @@ tilde_subst(const char *s) | @@ -670,7 +674,7 @@ tilde_subst(const char *s) | ||
670 | if (slash) { | 674 | if (slash) { |
671 | int len = slash - s; | 675 | int len = slash - s; |
672 | 676 | ||
673 | - mname = Malloc(len + 1); | 677 | + mname = lib3270_malloc(len + 1); |
674 | (void) strncpy(mname, s, len); | 678 | (void) strncpy(mname, s, len); |
675 | mname[len] = '\0'; | 679 | mname[len] = '\0'; |
676 | name = mname; | 680 | name = mname; |
@@ -687,13 +691,13 @@ tilde_subst(const char *s) | @@ -687,13 +691,13 @@ tilde_subst(const char *s) | ||
687 | p = getpwnam(name + 1); | 691 | p = getpwnam(name + 1); |
688 | 692 | ||
689 | /* Free any temporary copy. */ | 693 | /* Free any temporary copy. */ |
690 | - Free(mname); | 694 | + lib3270_free(mname); |
691 | 695 | ||
692 | /* Substitute and return. */ | 696 | /* Substitute and return. */ |
693 | if (p == (struct passwd *)NULL) | 697 | if (p == (struct passwd *)NULL) |
694 | r = NewString(s); | 698 | r = NewString(s); |
695 | else { | 699 | else { |
696 | - r = Malloc(strlen(p->pw_dir) + strlen(rest) + 1); | 700 | + r = lib3270_malloc(strlen(p->pw_dir) + strlen(rest) + 1); |
697 | (void) strcpy(r, p->pw_dir); | 701 | (void) strcpy(r, p->pw_dir); |
698 | (void) strcat(r, rest); | 702 | (void) strcat(r, rest); |
699 | } | 703 | } |
@@ -716,7 +720,7 @@ do_subst(const char *s, Boolean do_vars, Boolean do_tilde) | @@ -716,7 +720,7 @@ do_subst(const char *s, Boolean do_vars, Boolean do_tilde) | ||
716 | char *u; | 720 | char *u; |
717 | 721 | ||
718 | u = tilde_subst(t); | 722 | u = tilde_subst(t); |
719 | - Free(t); | 723 | + lib3270_free(t); |
720 | return u; | 724 | return u; |
721 | } | 725 | } |
722 | #endif /*]*/ | 726 | #endif /*]*/ |
@@ -871,7 +875,7 @@ rpf(rpf_t *r, char *fmt, ...) | @@ -871,7 +875,7 @@ rpf(rpf_t *r, char *fmt, ...) | ||
871 | void | 875 | void |
872 | rpf_free(rpf_t *r) | 876 | rpf_free(rpf_t *r) |
873 | { | 877 | { |
874 | - Free(r->buf); | 878 | + lib3270_free(r->buf); |
875 | r->buf = NULL; | 879 | r->buf = NULL; |
876 | r->alloc_len = 0; | 880 | r->alloc_len = 0; |
877 | r->cur_len = 0; | 881 | r->cur_len = 0; |
src/pw3270/v3270/accessible.c
@@ -37,7 +37,7 @@ | @@ -37,7 +37,7 @@ | ||
37 | #include <glib/gi18n.h> | 37 | #include <glib/gi18n.h> |
38 | 38 | ||
39 | #include <pw3270.h> | 39 | #include <pw3270.h> |
40 | - #include <malloc.h> | 40 | +// #include <malloc.h> |
41 | #include "v3270.h" | 41 | #include "v3270.h" |
42 | #include "private.h" | 42 | #include "private.h" |
43 | #include "accessible.h" | 43 | #include "accessible.h" |
@@ -393,7 +393,7 @@ static gchar * v3270_accessible_get_text_at_offset(AtkText *atk_text, gint offse | @@ -393,7 +393,7 @@ static gchar * v3270_accessible_get_text_at_offset(AtkText *atk_text, gint offse | ||
393 | g_error_free(error); | 393 | g_error_free(error); |
394 | } | 394 | } |
395 | 395 | ||
396 | - free(text); | 396 | + lib3270_free(text); |
397 | return utfchar; | 397 | return utfchar; |
398 | } | 398 | } |
399 | 399 | ||
@@ -432,7 +432,7 @@ static gchar * v3270_accessible_get_text(AtkText *atk_text, gint start_pos, gint | @@ -432,7 +432,7 @@ static gchar * v3270_accessible_get_text(AtkText *atk_text, gint start_pos, gint | ||
432 | g_error_free(error); | 432 | g_error_free(error); |
433 | } | 433 | } |
434 | 434 | ||
435 | - free(text); | 435 | + lib3270_free(text); |
436 | 436 | ||
437 | // trace("%s:\n%s\n",__FUNCTION__,utftext); | 437 | // trace("%s:\n%s\n",__FUNCTION__,utftext); |
438 | 438 |
src/pw3270/v3270/iocallback.c
@@ -43,9 +43,9 @@ | @@ -43,9 +43,9 @@ | ||
43 | #include <glib.h> | 43 | #include <glib.h> |
44 | #include "../globals.h" | 44 | #include "../globals.h" |
45 | 45 | ||
46 | -#ifdef HAVE_MALLOC_H | ||
47 | - #include <malloc.h> | ||
48 | -#endif | 46 | +//#ifdef HAVE_MALLOC_H |
47 | +// #include <malloc.h> | ||
48 | +//#endif | ||
49 | 49 | ||
50 | static int static_CallAndWait(int(*callback)(H3270 *session, void *), H3270 *session, void *parm); | 50 | static int static_CallAndWait(int(*callback)(H3270 *session, void *), H3270 *session, void *parm); |
51 | static void * static_AddInput(int source, H3270 *session, void (*fn)(H3270 *session)); | 51 | static void * static_AddInput(int source, H3270 *session, void (*fn)(H3270 *session)); |
src/pw3270/v3270/selection.c
@@ -29,7 +29,7 @@ | @@ -29,7 +29,7 @@ | ||
29 | 29 | ||
30 | #include <gtk/gtk.h> | 30 | #include <gtk/gtk.h> |
31 | #include <pw3270.h> | 31 | #include <pw3270.h> |
32 | - #include <malloc.h> | 32 | +// #include <malloc.h> |
33 | #include "v3270.h" | 33 | #include "v3270.h" |
34 | #include "private.h" | 34 | #include "private.h" |
35 | #include <lib3270/selection.h> | 35 | #include <lib3270/selection.h> |
@@ -92,7 +92,7 @@ gchar * v3270_get_text(GtkWidget *widget, int offset, int len) | @@ -92,7 +92,7 @@ gchar * v3270_get_text(GtkWidget *widget, int offset, int len) | ||
92 | 92 | ||
93 | text = g_convert(str, -1, "UTF-8", lib3270_get_charset(terminal->host), NULL, NULL, NULL); | 93 | text = g_convert(str, -1, "UTF-8", lib3270_get_charset(terminal->host), NULL, NULL, NULL); |
94 | 94 | ||
95 | - free(str); | 95 | + lib3270_free(str); |
96 | return text; | 96 | return text; |
97 | } | 97 | } |
98 | 98 | ||
@@ -110,7 +110,7 @@ static gchar * v3270_get_selected(v3270 *widget) | @@ -110,7 +110,7 @@ static gchar * v3270_get_selected(v3270 *widget) | ||
110 | if(text) | 110 | if(text) |
111 | { | 111 | { |
112 | gchar *str = g_strdup(text); | 112 | gchar *str = g_strdup(text); |
113 | - free(text); | 113 | + lib3270_free(text); |
114 | return str; | 114 | return str; |
115 | } | 115 | } |
116 | return NULL; | 116 | return NULL; |
@@ -255,7 +255,7 @@ const gchar * v3270_copy_append(GtkWidget *widget) | @@ -255,7 +255,7 @@ const gchar * v3270_copy_append(GtkWidget *widget) | ||
255 | 255 | ||
256 | text = g_convert(str, -1, "UTF-8", lib3270_get_charset(terminal->host), NULL, NULL, NULL); | 256 | text = g_convert(str, -1, "UTF-8", lib3270_get_charset(terminal->host), NULL, NULL, NULL); |
257 | 257 | ||
258 | - free(str); | 258 | + lib3270_free(str); |
259 | 259 | ||
260 | clip = g_strconcat(terminal->clipboard,"\n",text,NULL); | 260 | clip = g_strconcat(terminal->clipboard,"\n",text,NULL); |
261 | 261 | ||
@@ -462,7 +462,7 @@ gchar * v3270_get_region(GtkWidget *widget, gint start_pos, gint end_pos, gboole | @@ -462,7 +462,7 @@ gchar * v3270_get_region(GtkWidget *widget, gint start_pos, gint end_pos, gboole | ||
462 | 462 | ||
463 | utftext = g_convert(str, -1, "UTF-8", lib3270_get_charset(GTK_V3270(widget)->host), NULL, NULL, NULL); | 463 | utftext = g_convert(str, -1, "UTF-8", lib3270_get_charset(GTK_V3270(widget)->host), NULL, NULL, NULL); |
464 | 464 | ||
465 | - free(str); | 465 | + lib3270_free(str); |
466 | 466 | ||
467 | return utftext; | 467 | return utftext; |
468 | } | 468 | } |