*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/*
FAMILY_FIRST = 1
} name_order;
-gboolean convert_charcode;
+gboolean convert_charcode = TRUE;
/*
* Create new pilot file object.
*buf_size=0;
if( pilotFile->path ) {
- in = fopen( pilotFile->path, "rb" );
+ in = g_fopen( pilotFile->path, "rb" );
if( !in ) {
return MGU_OPEN_FILE;
}
/* Shamelessly copied from JPilot (libplugin.c) */
static int unpack_header(PC3RecordHeader *header, unsigned char *packed_header) {
unsigned char *p;
- unsigned long l;
+ guint32 l;
p = packed_header;
/* Shamelessly copied from JPilot (libplugin.c) */
static int read_header(FILE *pc_in, PC3RecordHeader *header) {
- unsigned long l, len;
+ guint32 l;
+ unsigned long len;
unsigned char packed_header[256];
int num;
return MGU_BAD_ARGS;
}
- in = fopen( pilotFile->path, "rb" );
- if( ! in ) {
+ in = g_fopen( pilotFile->path, "rb" );
+ if (!in) {
return MGU_OPEN_FILE;
}
/* Read the PC3 file, if present */
pcFile = jpilot_get_pc3_file( pilotFile );
if( pcFile == NULL ) return MGU_SUCCESS;
- pc_in = fopen( pcFile, "rb" );
+ pc_in = g_fopen( pcFile, "rb");
g_free( pcFile );
if( pc_in == NULL ) {
strcpy( buffer, labelEntry );
node = list = jpilot_parse_email( buffer );
while( node ) {
- gchar convertBuff[JPILOT_LEN_LABEL];
email = addritem_create_item_email();
addritem_email_set_address( email, node->data );
if (convert_charcode) {
gchar *convertBuff;
- convertBuff = conv_codeset_strdup( ai->labels[ind], CS_SHIFT_JIS, CS_INTERNAL );
+ convertBuff = conv_codeset_strdup( labelEntry,
+ conv_get_locale_charset_str_no_utf8(),
+ CS_INTERNAL );
addritem_email_set_remarks( email, convertBuff );
g_free( convertBuff );
}
if( convert_charcode ) {
gchar *nameConv;
- nameConv = conv_codeset_strdup( fullName, CS_SHIFT_JIS, CS_INTERNAL );
+ nameConv = conv_codeset_strdup( fullName,
+ conv_get_locale_charset_str_no_utf8(),
+ CS_INTERNAL );
strncpy2( fullName, nameConv, FULLNAME_BUFSIZE );
g_free( nameConv );
}
gchar convertBuff[ JPILOT_LEN_LABEL ];
if( convert_charcode ) {
- labelName = conv_codeset_strdup( labelName, CS_SHIFT_JIS, CS_INTERNAL );
+ labelName = conv_codeset_strdup( labelName,
+ conv_get_locale_charset_str_no_utf8(),
+ CS_INTERNAL );
strncpy2( convertBuff, labelName, JPILOT_LEN_LABEL );
g_free( labelName );
labelName = convertBuff;
if( labelName ) {
if( convert_charcode ) {
- labelName = conv_codeset_strdup( labelName, CS_SHIFT_JIS, CS_INTERNAL );
+ labelName = conv_codeset_strdup( labelName,
+ conv_get_locale_charset_str_no_utf8(),
+ CS_INTERNAL );
}
else {
labelName = g_strdup( labelName );
g_strchug( labelName );
if( *labelName != '\0' ) {
if( convert_charcode ) {
- labelName = conv_codeset_strdup( labelName, CS_SHIFT_JIS, CS_INTERNAL );
+ labelName = conv_codeset_strdup( labelName,
+ conv_get_locale_charset_str_no_utf8(),
+ CS_INTERNAL );
}
else {
labelName = g_strdup( labelName );
if( convert_charcode ) {
gchar *catName;
- catName = conv_codeset_strdup( cat->name[i], CS_SHIFT_JIS, CS_INTERNAL );
+ catName = conv_codeset_strdup( cat->name[i],
+ conv_get_locale_charset_str_no_utf8(),
+ CS_INTERNAL );
addritem_folder_set_name( folder, catName );
g_free( catName );
}
const gchar *cur_locale;
name_order = FAMILY_LAST;
- convert_charcode = FALSE;
cur_locale = conv_get_current_locale();
name_order = FAMILY_FIRST;
}
- if( conv_get_current_charset() == C_EUC_JP ) {
- convert_charcode = TRUE;
- }
-
g_return_val_if_fail( pilotFile != NULL, -1 );
pilotFile->retVal = MGU_SUCCESS;
gint len;
FILE *fp;
- homedir = g_get_home_dir();
+ homedir = get_home_dir();
if( ! homedir ) return g_strdup( "" );
strcpy( str, homedir );
strcat( str, JPILOT_DBHOME_FILE );
/* Attempt to open */
- if( ( fp = fopen( str, "rb" ) ) != NULL ) {
+ if( ( fp = g_fopen( str, "rb" ) ) != NULL ) {
fclose( fp );
}
else {