$OpenBSD: patch-sync_c,v 1.1.1.1 2001/05/29 00:54:46 pvalchev Exp $
--- sync.c.orig	Mon Feb  5 14:33:14 2001
+++ sync.c	Sun May 27 17:12:01 2001
@@ -104,10 +104,6 @@ int pdb_file_read_record_by_id(char *DB_
 
 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");
@@ -631,10 +627,8 @@ int jpilot_sync(struct my_sync_info *syn
       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");
 
@@ -760,15 +754,6 @@ int slow_sync_application(char *DB_name,
 	    }
 	 }
 
-	 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);
@@ -1479,61 +1464,6 @@ static int sync_rotate_backups(const int
    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;
@@ -1551,7 +1481,6 @@ int fast_sync_local_recs(char *DB_name, 
    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");
 
@@ -1609,14 +1538,6 @@ int fast_sync_local_recs(char *DB_name, 
 	    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");
