aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMunechika SUMIKAWA <sumikawa@FreeBSD.org>2001-03-06 11:17:09 +0000
committerMunechika SUMIKAWA <sumikawa@FreeBSD.org>2001-03-06 11:17:09 +0000
commit01c3a1755661d217e07b786e0281aaf59443d476 (patch)
tree9a87a6cf39c48491673d83c9449034d123cac35f
parentf543893faf994cdeec81c5395619df28722e8bc9 (diff)
downloadports-01c3a1755661d217e07b786e0281aaf59443d476.tar.gz
ports-01c3a1755661d217e07b786e0281aaf59443d476.zip
Notes
-rw-r--r--palm/jpilot/Makefile2
-rw-r--r--palm/jpilot/files/patch-Makefile.in (renamed from palm/jpilot/files/patch-ba)0
-rw-r--r--palm/jpilot/files/patch-address.c97
-rw-r--r--palm/jpilot/files/patch-datebook.c120
-rw-r--r--palm/jpilot/files/patch-datebook_gui.c47
-rw-r--r--palm/jpilot/files/patch-japanese.c157
-rw-r--r--palm/jpilot/files/patch-memo.c86
-rw-r--r--palm/jpilot/files/patch-sync.c155
-rw-r--r--palm/jpilot/files/patch-todo_gui.c21
-rw-r--r--palm/jpilot/files/patch-utils.c70
-rw-r--r--palm/jpilot/files/patch-utils.h23
11 files changed, 777 insertions, 1 deletions
diff --git a/palm/jpilot/Makefile b/palm/jpilot/Makefile
index 7bf3e799e25a..bff6f6556935 100644
--- a/palm/jpilot/Makefile
+++ b/palm/jpilot/Makefile
@@ -8,7 +8,7 @@
PORTNAME= jpilot
PORTVERSION= 0.99
-PORTREVISION?= 1
+PORTREVISION?= 2
CATEGORIES+= palm comms
MASTER_SITES= http://jpilot.org/
diff --git a/palm/jpilot/files/patch-ba b/palm/jpilot/files/patch-Makefile.in
index 863f24b7f9c6..863f24b7f9c6 100644
--- a/palm/jpilot/files/patch-ba
+++ b/palm/jpilot/files/patch-Makefile.in
diff --git a/palm/jpilot/files/patch-address.c b/palm/jpilot/files/patch-address.c
new file mode 100644
index 000000000000..dbb316b8a94c
--- /dev/null
+++ b/palm/jpilot/files/patch-address.c
@@ -0,0 +1,97 @@
+Index: address.c
+diff -u address.c:1.1.1.1 address.c:1.1.1.1.4.3
+--- address.c:1.1.1.1 Sun Feb 4 12:58:54 2001
++++ address.c Sat Feb 17 20:37:52 2001
+@@ -31,10 +31,6 @@
+ #include "libplugin.h"
+ #include "password.h"
+
+-#include "japanese.h"
+-#include "cp1250.h"
+-#include "russian.h"
+-
+ #define ADDRESS_EOF 7
+
+ static int glob_sort_by_company;
+@@ -224,8 +220,16 @@
+ unsigned int *unique_id)
+ {
+ char record[65536];
+- int rec_len;
++ int rec_len,i;
+ buf_rec br;
++ long char_set;
++
++ get_pref(PREF_CHAR_SET, &char_set, NULL);
++ if (char_set != CHAR_SET_ENGLISH) {
++ for (i = 0; i < 19; i++) {
++ if (a->entry[i]) charset_j2p(a->entry[i], strlen(a->entry[i])+1, char_set);
++ }
++ }
+
+ rec_len = pack_Address(a, record, 65535);
+ if (!rec_len) {
+@@ -275,36 +279,22 @@
+ return -1;
+ }
+
+- get_pref(PREF_CHAR_SET, &char_set, NULL);
+- if (char_set==CHAR_SET_JAPANESE ||
+- char_set==CHAR_SET_1250 ||
+- char_set==CHAR_SET_1251 ||
+- char_set==CHAR_SET_1251_B
+- ) {
++ get_pref(PREF_CHAR_SET, &char_set, NULL);
++ if (char_set != CHAR_SET_ENGLISH) {
+ /* Convert to character set */
+- {
+ int i;
+ for (i = 0; i < 16; i++)
+ if (ai->category.name[i][0] != '\0') {
+- if (char_set==CHAR_SET_JAPANESE) Sjis2Euc(ai->category.name[i], 16);
+- if (char_set==CHAR_SET_1250) Win2Lat(ai->category.name[i], 16);
+- if (char_set==CHAR_SET_1251) win1251_to_koi8(ai->category.name[i], 16);
++ charset_p2j(ai->category.name[i], 16, char_set);
+ }
+ for (i = 0; i < 19 + 3; i++)
+ if (ai->labels[i][0] != '\0') {
+- if (char_set==CHAR_SET_JAPANESE) Sjis2Euc(ai->labels[i], 16);
+- if (char_set==CHAR_SET_1250) Win2Lat(ai->labels[i], 16);
+- if (char_set==CHAR_SET_1251) win1251_to_koi8(ai->labels[i], 16);
+- if (char_set==CHAR_SET_1251_B) koi8_to_win1251(ai->labels[i], 16);
++ charset_p2j(ai->labels[i],16, char_set);
+ }
+ for (i = 0; i < 8; i++)
+ if (ai->phoneLabels[i][0] != '\0') {
+- if (char_set==CHAR_SET_JAPANESE) Sjis2Euc(ai->phoneLabels[i], 16);
+- if (char_set==CHAR_SET_1250) Win2Lat(ai->phoneLabels[i], 16);
+- if (char_set==CHAR_SET_1251) win1251_to_koi8(ai->phoneLabels[i], 16);
+- if (char_set==CHAR_SET_1251_B) koi8_to_win1251(ai->phoneLabels[i], 16);
++ charset_p2j(ai->phoneLabels[i],16, char_set);
+ }
+- }
+ }
+
+ return 0;
+@@ -386,17 +376,11 @@
+ }
+
+ get_pref(PREF_CHAR_SET, &char_set, NULL);
+- if (char_set==CHAR_SET_JAPANESE ||
+- char_set==CHAR_SET_1250 ||
+- char_set==CHAR_SET_1251 ||
+- char_set==CHAR_SET_1251_B
+- ) {
+- int i;
++ if (char_set != CHAR_SET_ENGLISH) {
+ for (i = 0; i < 19; i++) {
+- if (char_set==CHAR_SET_JAPANESE) Sjis2Euc(a.entry[i], 65536);
+- if (char_set==CHAR_SET_1250) Win2Lat(a.entry[i], 65536);
+- if (char_set==CHAR_SET_1251) win1251_to_koi8(a.entry[i], 65536);
+- if (char_set==CHAR_SET_1251_B) koi8_to_win1251(a.entry[i], 65536);
++ if ((a.entry[i] != NULL) && (a.entry[i][0] != '\0')) {
++ charset_p2j(a.entry[i], strlen(a.entry[i])+1, char_set);
++ }
+ }
+ }
+
diff --git a/palm/jpilot/files/patch-datebook.c b/palm/jpilot/files/patch-datebook.c
new file mode 100644
index 000000000000..eadf8052766d
--- /dev/null
+++ b/palm/jpilot/files/patch-datebook.c
@@ -0,0 +1,120 @@
+Index: datebook.c
+diff -u datebook.c:1.1.1.1 datebook.c:1.1.1.1.4.5
+--- datebook.c:1.1.1.1 Sun Feb 4 12:58:54 2001
++++ datebook.c Sat Feb 17 21:51:55 2001
+@@ -37,10 +37,6 @@
+ #include "libplugin.h"
+ #include "password.h"
+
+-#include "japanese.h"
+-#include "cp1250.h"
+-#include "russian.h"
+-
+ #ifndef FALSE
+ #define FALSE 0
+ #endif
+@@ -205,6 +201,13 @@
+ char record[65536];
+ int rec_len;
+ buf_rec br;
++ long char_set;
++
++ get_pref(PREF_CHAR_SET, &char_set, NULL);
++ if (char_set != CHAR_SET_ENGLISH) {
++ if (a->description) charset_j2p(a->description, strlen(a->description)+1, char_set);
++ if (a->note) charset_j2p(a->note, strlen(a->note)+1, char_set);
++ }
+
+ rec_len = pack_Appointment(a, record, 65535);
+ if (!rec_len) {
+@@ -212,7 +215,7 @@
+ jpilot_logf(LOG_WARN, "pack_Appointment %s\n", _("error"));
+ return -1;
+ }
+- br.rt=rt;
++ br.rt=rt;
+ br.attrib = attrib;
+ br.buf = record;
+ br.size = rec_len;
+@@ -535,9 +538,10 @@
+
+ int get_datebook_app_info(struct AppointmentAppInfo *ai)
+ {
+- int num;
++ int num,i;
+ unsigned int rec_size;
+ unsigned char *buf;
++ long char_set;
+
+ bzero(ai, sizeof(*ai));
+
+@@ -550,6 +554,12 @@
+ jpilot_logf(LOG_WARN, _("Error reading"), "DatebookDB.pdb");
+ return -1;
+ }
++ get_pref(PREF_CHAR_SET, &char_set, NULL);
++ if (char_set != CHAR_SET_ENGLISH) {
++ for (i = 0; i < 16; i++) {
++ if (ai->category.name[i][0] != '\0') charset_p2j(ai->category.name[i], 16, char_set);
++ }
++ }
+
+ return 0;
+ }
+@@ -688,14 +698,14 @@
+ AppointmentList *temp_a_list;
+ long keep_modified, keep_deleted;
+ int keep_priv;
+- long char_set;
+ buf_rec *br;
+ #ifdef USE_DB3
+ long use_db3_tags;
+ time_t ltime;
+ struct tm *today;
+ #endif
+-
++ long char_set;
++
+ #ifdef USE_DB3
+ time(&ltime);
+ today = localtime(&ltime);
+@@ -763,22 +773,8 @@
+ }
+
+ get_pref(PREF_CHAR_SET, &char_set, NULL);
+- if (char_set==CHAR_SET_JAPANESE) {
+- Sjis2Euc(a.description, 65536);
+- Sjis2Euc(a.note, 65536);
+- }
+- if (char_set==CHAR_SET_1250) {
+- Win2Lat(a.description, 65536);
+- Win2Lat(a.note, 65536);
+- }
+- if (char_set==CHAR_SET_1251) {
+- win1251_to_koi8(a.description, 65536);
+- win1251_to_koi8(a.note, 65536);
+- }
+- if (char_set==CHAR_SET_1251_B) {
+- koi8_to_win1251(a.description, 65536);
+- koi8_to_win1251(a.note, 65536);
+- }
++ if (a.description) charset_p2j(a.description, strlen(a.description)+1, char_set);
++ if (a.note) charset_p2j(a.note, strlen(a.note)+1, char_set);
+
+ temp_a_list = malloc(sizeof(AppointmentList));
+ if (!temp_a_list) {
+@@ -793,6 +789,8 @@
+ temp_a_list->next = *appointment_list;
+ *appointment_list = temp_a_list;
+ recs_returned++;
++
++
+ }
+
+ jp_free_DB_records(&records);
+@@ -803,3 +801,5 @@
+
+ return recs_returned;
+ }
++
++
diff --git a/palm/jpilot/files/patch-datebook_gui.c b/palm/jpilot/files/patch-datebook_gui.c
new file mode 100644
index 000000000000..0d79ce8ccd7e
--- /dev/null
+++ b/palm/jpilot/files/patch-datebook_gui.c
@@ -0,0 +1,47 @@
+Index: datebook_gui.c
+diff -u datebook_gui.c:1.1.1.1 datebook_gui.c:1.1.1.1.4.4
+--- datebook_gui.c:1.1.1.1 Sun Feb 4 12:58:54 2001
++++ datebook_gui.c Sat Feb 17 21:48:47 2001
+@@ -224,7 +224,6 @@
+
+ void cb_date_cats(GtkWidget *widget, gpointer data)
+ {
+- unsigned char *buf;
+ int size;
+ struct AppointmentAppInfo ai;
+ int i;
+@@ -241,13 +240,7 @@
+ return;
+ }
+
+- get_app_info("DatebookDB", &buf, &size);
+- jpilot_logf(LOG_DEBUG, "Got datebook app info, size = %d", size);
+- if (size<1) {
+- return;
+- }
+- unpack_AppointmentAppInfo(&ai, buf, size);
+- free(buf);
++ get_datebook_app_info(&ai);
+
+ window_date_cats = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+
+@@ -268,10 +261,8 @@
+ gtk_table_set_col_spacings(GTK_TABLE(table),0);
+ gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0);
+
+- get_pref(PREF_CHAR_SET, &char_set, NULL);
+ for (i=0, bit=1; i<16; i++, bit <<= 1) {
+ if (ai.category.name[i][0]) {
+- if (char_set == CHAR_SET_JAPANESE) Sjis2Euc(ai.category.name[i], 65536);
+ toggle_button[i]=gtk_toggle_button_new_with_label
+ (ai.category.name[i]);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle_button[i]),
+@@ -945,7 +936,7 @@
+ if (a->note) {
+ jpilot_logf(LOG_DEBUG, "text2=[%s]\n",a->note);
+ }
+-
++
+ /* We won't allow a repeat frequency of less than 1 */
+ if ((page != PAGE_NONE) && (a->repeatFrequency < 1)) {
+ jpilot_logf(LOG_WARN,
diff --git a/palm/jpilot/files/patch-japanese.c b/palm/jpilot/files/patch-japanese.c
new file mode 100644
index 000000000000..8b2fffbf35e3
--- /dev/null
+++ b/palm/jpilot/files/patch-japanese.c
@@ -0,0 +1,157 @@
+Index: japanese.c
+diff -u japanese.c:1.1.1.1 japanese.c:1.1.1.1.4.3
+--- japanese.c:1.1.1.1 Sun Feb 4 12:58:54 2001
++++ japanese.c Sat Feb 17 21:19:41 2001
+@@ -10,7 +10,7 @@
+
+ #include <stdlib.h>
+ #include <stdio.h>
+-
++
+ /* In utils.c, also a prototype in utils.h */
+ void multibyte_safe_strncpy(char *dst, char *src, size_t max_len);
+
+@@ -23,7 +23,14 @@
+ #define isEuc(c) \
+ (0xa0 < ((unsigned char) (c)) && ((unsigned char) (c)) < 0xff)
+
++/* convert SJIS char to EUC char
++
++ this does not support Machine dependent codes.
++ args: hi: first byte of sjis char.
++ lo: second byte of sjis char.
++ return: euc char in 16bit value.
+
++ */
+ static unsigned int SjisToEuc(unsigned char hi, unsigned char lo)
+ {
+ if (lo >= 0x9f)
+@@ -32,8 +39,12 @@
+ return ((hi * 2 - (hi >= 0xe0 ? 0xe1 : 0x61)) << 8) |
+ (lo + (lo >= 0x7f ? 0x60 : 0x61));
+ }
+-
+
++/*
++ args: source char pointer, destination source pointer, a length of srting
++ Length include null termination.
++ return the pointer of nul termination code.
++ */
+ unsigned char *Sjis2EucCpy(unsigned char *dest, unsigned char *src, int max_len)
+ {
+ unsigned char *p, *q;
+@@ -43,8 +54,8 @@
+
+ p = src;
+ q = dest;
+- while ((*p) && (n < max_len-1)) {
+- if (isSjis1stByte(*p)) {
++ while ((*p) && (n < max_len-2)) {
++ if (isSjis1stByte(*p)) {
+ hi = *p++;
+ lo = *p++;
+ w = SjisToEuc(hi, lo);
+@@ -58,27 +69,48 @@
+ } else if ((*p) & 0x80) { /* irregular japanese char */
+ p++; /* ??abort and return NULL?? */
+ /* discard it */
+- } else {
++ } else {
+ *q++ = *p++;
+ n++;
+ }
+ }
+- *q = '\0';
+- return dest;
++ if ((*p) && !(*p & 0x80) && (n < max_len-1)) {
++ *q++ = *p++;
++ *q = '\0';
++ } else {
++ *q = '\0';
++ }
++ return q;
+ }
+
++/*
++ convert strings from Sjis to EUC.
++ max_len includes null termiantion.
++ size of buf must be more than max_len.
++
++*/
++
+ void Sjis2Euc(unsigned char *buf, int max_len)
+ {
+ unsigned char *dst;
+
+ if (buf == NULL) return;
+- if ((dst = (unsigned char *)malloc(max_len*2)) != NULL) {
+- if (Sjis2EucCpy(dst, buf, max_len*2) != NULL)
++ if ((dst = (unsigned char *)malloc(max_len)) != NULL) {
++ /* assign buffer for destination. */
++ if (Sjis2EucCpy(dst, buf, max_len) != NULL) {
+ multibyte_safe_strncpy(buf, dst, max_len);
++ buf[max_len-1] = '\0'; /* i am a paranoire B-) */
++ }
+ free(dst);
+- }
++ }
+ }
+
++/*
++ Convert one char from euc to sjis.
++ args: hi: first byte of euc code.
++ lo: second byte of euc code.
++ return: 16bit value of sjis char code.
++ */
+ static unsigned int EucToSjis(unsigned char hi, unsigned char lo)
+ {
+ if (hi & 1)
+@@ -88,6 +120,11 @@
+ return ((hi / 2 + (hi < 0xdf ? 0x30 : 0x70)) << 8) | (lo - 2);
+ }
+
++/*
++ Convert string from euc to sjis with coping to another buffer.
++ Theoritically, strlen(EUC) >= strlen(SJIS),
++ then it is ok that dest == src.
++ */
+ unsigned char *Euc2SjisCpy(unsigned char *dest, unsigned char *src, int max_len)
+ {
+ unsigned char *p, *q;
+@@ -97,7 +134,7 @@
+
+ p = src;
+ q = dest;
+- while ((*p) && (n < max_len-1)) {
++ while ((*p) && (n < max_len-2)) {
+ if (isEucKana(*p)) { /* euc kana(2byte) -> sjis(1byte) */
+ p++;
+ *q++ = *p++;
+@@ -113,13 +150,25 @@
+ *q++ = *p++;
+ n++;
+ }
++ }
++ if ((*p) && !(*p & 0x80) && n < max_len-1) {
++ *q++ = *p++;
++ *q = '\0';
++ } else {
++ *q = '\0';
+ }
+- *q = '\0';
+ return dest;
+ }
++/*
++ convert euc to sjis.
++ size of buf must be more than man_len.
++ it simply call Euc2SjisCpy().
++ this function exists for symmetry.
++ */
+
+ void Euc2Sjis(unsigned char *buf, int max_len)
+ {
+ if (buf == NULL) return;
+- Euc2SjisCpy(buf, buf, max_len);
++ if (max_len <= 0) return;
++ (void *)Euc2SjisCpy(buf, buf, max_len);
+ }
diff --git a/palm/jpilot/files/patch-memo.c b/palm/jpilot/files/patch-memo.c
new file mode 100644
index 000000000000..44143b6fc1f1
--- /dev/null
+++ b/palm/jpilot/files/patch-memo.c
@@ -0,0 +1,86 @@
+Index: memo.c
+diff -u memo.c:1.1.1.1 memo.c:1.1.1.1.4.4
+--- memo.c:1.1.1.1 Sun Feb 4 12:58:54 2001
++++ memo.c Sat Feb 17 21:47:54 2001
+@@ -32,10 +32,6 @@
+ #include "libplugin.h"
+ #include "password.h"
+
+-#include "japanese.h"
+-#include "cp1250.h"
+-#include "russian.h"
+-
+ #define MEMO_EOF 7
+
+ int memo_compare(const void *v1, const void *v2)
+@@ -133,6 +129,12 @@
+ char record[65536];
+ int rec_len;
+ buf_rec br;
++ long char_set;
++
++ get_pref(PREF_CHAR_SET, &char_set, NULL);
++ if (char_set != CHAR_SET_ENGLISH) {
++ if (memo->text) charset_j2p(memo->text, strlen(memo->text)+1, char_set);
++ }
+
+ rec_len = pack_Memo(memo, record, 65535);
+ if (!rec_len) {
+@@ -165,7 +167,7 @@
+
+ int get_memo_app_info(struct MemoAppInfo *ai)
+ {
+- int num;
++ int num,i;
+ unsigned int rec_size;
+ unsigned char *buf;
+ long char_set;
+@@ -183,18 +185,12 @@
+ }
+
+ get_pref(PREF_CHAR_SET, &char_set, NULL);
+- if (char_set==CHAR_SET_JAPANESE ||
+- char_set==CHAR_SET_1250 ||
+- char_set==CHAR_SET_1251 ||
+- char_set==CHAR_SET_1251_B) {
+- int i;
+- for (i = 0; i < 16; i++)
+- if (ai->category.name[i][0] != '\0') {
+- if (char_set==CHAR_SET_JAPANESE) Sjis2Euc(ai->category.name[i], 16);
+- if (char_set==CHAR_SET_1250) Win2Lat(ai->category.name[i], 16);
+- if (char_set==CHAR_SET_1251) win1251_to_koi8(ai->category.name[i], 16);
+- if (char_set==CHAR_SET_1251_B) koi8_to_win1251(ai->category.name[i], 16);
+- }
++ if (char_set != CHAR_SET_ENGLISH) {
++ for (i = 0; i < 16; i++) {
++ if (ai->category.name[i][0] != '\0') {
++ charset_p2j(ai->category.name[i], 16, char_set);
++ }
++ }
+ }
+
+ return 0;
+@@ -218,8 +214,8 @@
+ MemoList *temp_memo_list;
+ long keep_modified, keep_deleted;
+ int keep_priv;
+- long char_set;
+ buf_rec *br;
++ long char_set;
+
+ jpilot_logf(LOG_DEBUG, "get_memos2()\n");
+ if (modified==2) {
+@@ -274,12 +270,8 @@
+ if ( ((br->attrib & 0x0F) != category) && category != CATEGORY_ALL) {
+ continue;
+ }
+-
+ get_pref(PREF_CHAR_SET, &char_set, NULL);
+- if (char_set==CHAR_SET_JAPANESE) Sjis2Euc(memo.text, 65536);
+- if (char_set==CHAR_SET_1250) Win2Lat(memo.text, 65536);
+- if (char_set==CHAR_SET_1251) win1251_to_koi8(memo.text, 65536);
+- if (char_set==CHAR_SET_1251_B) koi8_to_win1251(memo.text, 65536);
++ if (memo.text) charset_p2j(memo.text, strlen(memo.text)+1, char_set);
+
+ temp_memo_list = malloc(sizeof(MemoList));
+ if (!temp_memo_list) {
diff --git a/palm/jpilot/files/patch-sync.c b/palm/jpilot/files/patch-sync.c
new file mode 100644
index 000000000000..70995499296c
--- /dev/null
+++ b/palm/jpilot/files/patch-sync.c
@@ -0,0 +1,155 @@
+Index: sync.c
+diff -u sync.c:1.1.1.1 sync.c:1.1.1.1.4.1
+--- sync.c:1.1.1.1 Sun Feb 4 12:58:55 2001
++++ sync.c Sat Feb 17 17:07:51 2001
+@@ -105,10 +105,6 @@
+
+ int pdb_file_delete_record_by_id(char *DB_name, pi_uid_t uid_in);
+
+-
+-void recode_packed_record(char *DB_name, void *record, int rec_len, long char_seet);
+-
+-
+ void sig_handler(int sig)
+ {
+ jpilot_logf(LOG_DEBUG, "caught signal SIGCHLD\n");
+@@ -624,10 +620,8 @@
+ return 0;
+ }
+ get_pref(PREF_CHAR_SET, &char_set, NULL);
+- if (char_set == CHAR_SET_JAPANESE) Euc2Sjis(buf, 1023);
+- if (char_set == CHAR_SET_1250) Lat2Win(buf, 1023);
+- if (char_set == CHAR_SET_1251) koi8_to_win1251(buf, 1023);
+- if (char_set == CHAR_SET_1251_B) win1251_to_koi8(buf, 1023);
++ charset_j2p(buf,1023,char_set);
++
+ dlp_AddSyncLogEntry(sd, buf);
+ dlp_AddSyncLogEntry(sd, "\n\r");
+
+@@ -751,15 +745,6 @@
+ }
+ }
+
+- get_pref(PREF_CHAR_SET, &char_set, NULL);
+- if (char_set==CHAR_SET_JAPANESE ||
+- char_set==CHAR_SET_1250 ||
+- char_set==CHAR_SET_1251 ||
+- char_set==CHAR_SET_1251_B
+- ) {
+- recode_packed_record(DB_name, record, rec_len, char_set);
+- }
+-
+ ret = dlp_WriteRecord(sd, db, header.attrib & dlpRecAttrSecret,
+ 0, header.attrib & 0x0F,
+ record, rec_len, &new_id);
+@@ -1469,61 +1454,6 @@
+ return 0;
+ }
+
+-void recode_packed_record(char *DB_name, void *record, int rec_len, long char_set)
+-{
+- /*todo move this to before the record is written out?*/
+- /* Convert to SJIS Japanese Kanji code (Palm use this code) */
+- /* or convert to different encoding */
+- /*Write the record to the Palm Pilot */
+- if (!strcmp(DB_name, "DatebookDB")) {
+- struct Appointment a;
+- unpack_Appointment(&a, record, rec_len);
+- if (char_set == CHAR_SET_JAPANESE) Euc2Sjis(a.description, 65536);
+- if (char_set == CHAR_SET_1250) Lat2Win(a.description, 65536);
+- if (char_set == CHAR_SET_1251) koi8_to_win1251(a.description, 65536);
+- if (char_set == CHAR_SET_1251_B) win1251_to_koi8(a.description, 65536);
+- if (char_set == CHAR_SET_JAPANESE) Euc2Sjis(a.note, 65536);
+- if (char_set == CHAR_SET_1250) Lat2Win(a.note, 65536);
+- if (char_set == CHAR_SET_1251) koi8_to_win1251(a.note, 65536);
+- if (char_set == CHAR_SET_1251_B) win1251_to_koi8(a.note, 65536);
+- rec_len = pack_Appointment(&a, record, 65535);
+- }
+- if (!strcmp(DB_name, "AddressDB")) {
+- struct Address a;
+- int i;
+- unpack_Address(&a, record, rec_len);
+- for (i = 0; i < 19; i++) {
+- if (char_set == CHAR_SET_JAPANESE) Euc2Sjis(a.entry[i], 65536);
+- if (char_set == CHAR_SET_1250) Lat2Win(a.entry[i], 65536);
+- if (char_set == CHAR_SET_1251) koi8_to_win1251(a.entry[i], 65536);
+- if (char_set == CHAR_SET_1251_B) win1251_to_koi8(a.entry[i], 65536);
+- }
+- rec_len = pack_Address(&a, record, 65535);
+- }
+- if (!strcmp(DB_name, "ToDoDB")) {
+- struct ToDo t;
+- unpack_ToDo(&t, record, rec_len);
+- if (char_set == CHAR_SET_JAPANESE) Euc2Sjis(t.description, 65536);
+- if (char_set == CHAR_SET_1250) Lat2Win(t.description, 65536);
+- if (char_set == CHAR_SET_1251) koi8_to_win1251(t.description, 65536);
+- if (char_set == CHAR_SET_1251_B) win1251_to_koi8(t.description, 65536);
+- if (char_set == CHAR_SET_JAPANESE) Euc2Sjis(t.note, 65536);
+- if (char_set == CHAR_SET_1250) Lat2Win(t.note, 65536);
+- if (char_set == CHAR_SET_1251) koi8_to_win1251(t.note, 65536);
+- if (char_set == CHAR_SET_1251_B) win1251_to_koi8(t.note, 65536);
+- rec_len = pack_ToDo(&t, record, 65535);
+- }
+- if (!strcmp(DB_name, "MemoDB")) {
+- struct Memo m;
+- unpack_Memo(&m, record, rec_len);
+- if (char_set == CHAR_SET_JAPANESE) Euc2Sjis(m.text, 65536);
+- if (char_set == CHAR_SET_1250) Lat2Win(m.text, 65536);
+- if (char_set == CHAR_SET_1251) koi8_to_win1251(m.text, 65536);
+- if (char_set == CHAR_SET_1251_B) win1251_to_koi8(m.text, 65536);
+- rec_len = pack_Memo(&m, record, 65535);
+- }
+-}
+-
+ int fast_sync_local_recs(char *DB_name, int sd, int db)
+ {
+ unsigned long new_id;
+@@ -1541,7 +1471,6 @@
+ char error_log_message_d[256];
+ char delete_log_message[256];
+ int index, size, attr, category;
+- long char_set;
+
+ jpilot_logf(LOG_DEBUG, "fast_sync_local_recs\n");
+
+@@ -1599,14 +1528,6 @@
+ if (ferror(pc_in)) {
+ break;
+ }
+- }
+- get_pref(PREF_CHAR_SET, &char_set, NULL);
+- if (char_set==CHAR_SET_JAPANESE ||
+- char_set==CHAR_SET_1250 ||
+- char_set==CHAR_SET_1251 ||
+- char_set==CHAR_SET_1251_B
+- ) {
+- recode_packed_record(DB_name, record, rec_len, char_set);
+ }
+
+ jpilot_logf(LOG_DEBUG, "Writing PC record to palm\n");
+Index: todo.c
+diff -u todo.c:1.1.1.1 todo.c:1.1.1.1.4.3
+--- todo.c:1.1.1.1 Sun Feb 4 12:58:55 2001
++++ todo.c Sat Feb 17 20:37:52 2001
+@@ -31,10 +31,6 @@
+ #include "libplugin.h"
+ #include "password.h"
+
+-#include "japanese.h"
+-#include "cp1250.h"
+-#include "russian.h"
+-
+ #define TODO_EOF 7
+
+ static struct ToDoAppInfo *glob_Ptodo_app_info;
+@@ -241,6 +237,13 @@
+ char record[65536];
+ int rec_len;
+ buf_rec br;
++ long char_set;
++
++ get_pref(PREF_CHAR_SET, &char_set, NULL);
++ if (char_set != CHAR_SET_ENGLISH) {
++ if (todo->description) charset_j2p(todo->description, strlen(todo->description)+1, char_set);
++ if (todo->note) charset_j2p(todo->note, strlen(todo->note)+1, char_set);
++ }
diff --git a/palm/jpilot/files/patch-todo_gui.c b/palm/jpilot/files/patch-todo_gui.c
new file mode 100644
index 000000000000..42017b957433
--- /dev/null
+++ b/palm/jpilot/files/patch-todo_gui.c
@@ -0,0 +1,21 @@
+Index: todo_gui.c
+diff -u todo_gui.c:1.1.1.1 todo_gui.c:1.1.1.1.4.1
+--- todo_gui.c:1.1.1.1 Sun Feb 4 12:58:55 2001
++++ todo_gui.c Sat Feb 17 17:07:51 2001
+@@ -426,12 +426,16 @@
+ /*it will show it though. I allow it. */
+ new_todo->description = gtk_editable_get_chars
+ (GTK_EDITABLE(todo_text), 0, -1);
++/* charset_j2p(new_todo->description, 65536); */
+ new_todo->note = gtk_editable_get_chars
+ (GTK_EDITABLE(todo_text_note), 0, -1);
+ if (new_todo->note[0]=='\0') {
+ free(new_todo->note);
+ new_todo->note=NULL;
+ }
++/* else {
++ charset_j2p(new_todo->note, 65536);
++ }*/
+
+ for (i=0; i<NUM_TODO_CAT_ITEMS; i++) {
+ if (GTK_IS_WIDGET(todo_cat_menu_item2[i])) {
diff --git a/palm/jpilot/files/patch-utils.c b/palm/jpilot/files/patch-utils.c
new file mode 100644
index 000000000000..49e31777875a
--- /dev/null
+++ b/palm/jpilot/files/patch-utils.c
@@ -0,0 +1,70 @@
+Index: utils.c
+diff -u utils.c:1.1.1.1 utils.c:1.1.1.1.4.1
+--- utils.c:1.1.1.1 Sun Feb 4 12:58:55 2001
++++ utils.c Sat Feb 17 17:07:51 2001
+@@ -40,6 +40,9 @@
+ #include "plugins.h"
+ #include "libplugin.h"
+
++#include "japanese.h"
++#include "cp1250.h"
++#include "russian.h"
+
+ #include <pi-source.h>
+ #include <pi-socket.h>
+@@ -1981,7 +1984,7 @@
+ char *p, *q;
+ int n = 0;
+ p = src; q = dst;
+- while ((*p) && n < (max_len-1)) {
++ while ((*p) && n < (max_len-2)) {
+ if ((*p) & 0x80) {
+ *q++ = *p++;
+ n++;
+@@ -1994,11 +1997,10 @@
+ n++;
+ }
+ }
+- if ((*p & 0x80 ) && (n < max_len)) {
+- *q = *p;
+- } else {
+- *q = '\0';
+- }
++ if (!(*p & 0x80 ) && (n < max_len-1))
++ *q++ = *p++;
++
++ *q = '\0';
+ } else {
+ strncpy(dst, src, max_len);
+ }
+@@ -2022,7 +2024,7 @@
+ int n = 0;
+
+ p = (char *)src; q = dst;
+- while ((*p) && (n < (len -1))) {
++ while ((*p) && (n < (len -2))) {
+ if ((*p) & 0x80) {
+ *q++ = *p++;
+ n++;
+@@ -2033,15 +2035,15 @@
+ } else {
+ *q++ = *p++;
+ n++;
++ if (*(p-1) == (char)(c & 0xff)) return q;
+ }
+- if (*(p-1) == (char)(c & 0xff)) return q;
+- }
+- if ((*p & 0x80) && (n < len)) {
+- *q = *p;
+- } else {
+- *q = '\0';
+ }
++ if (!(*p & 0x80) && (n < len-1))
++ *q++ = *p++;
++
++ *q = '\0';
+ return NULL;
+ } else
+ return memccpy(dst, src, c, len);
+ }
++
diff --git a/palm/jpilot/files/patch-utils.h b/palm/jpilot/files/patch-utils.h
new file mode 100644
index 000000000000..3f5b8e4bcb52
--- /dev/null
+++ b/palm/jpilot/files/patch-utils.h
@@ -0,0 +1,23 @@
+Index: utils.h
+diff -u utils.h:1.1.1.1 utils.h:1.1.1.1.4.3
+--- utils.h:1.1.1.1 Sun Feb 4 12:58:55 2001
++++ utils.h Sat Feb 17 21:56:24 2001
+@@ -303,3 +303,18 @@
+
+ void multibyte_safe_strncpy(char *dst, char *src, size_t max_len);
+ char *multibyte_safe_memccpy(char *dst, const char *src, int c, size_t len);
++
++/*************************************
++ * convert char code
++ *************************************/
++#define charset_j2p(buf, max_len, char_set) {\
++ if (char_set == CHAR_SET_JAPANESE) Euc2Sjis(buf, max_len);\
++ if (char_set == CHAR_SET_1250) Lat2Win(buf,max_len);\
++ if (char_set == CHAR_SET_1251) koi8_to_win1251(buf, max_len);\
++ if (char_set == CHAR_SET_1251_B) win1251_to_koi8(buf, max_len);}
++#define charset_p2j(buf, max_len, char_set) {\
++ if (char_set == CHAR_SET_JAPANESE) Sjis2Euc(buf, max_len);\
++ if (char_set == CHAR_SET_1250) Win2Lat(buf,max_len);\
++ if (char_set == CHAR_SET_1251) win1251_to_koi8(buf, max_len);\
++ if (char_set == CHAR_SET_1251_B) koi8_to_win1251(buf, max_len);}
++