rem: if ( DEBUG ) printf ( "gsb_file_util_crypt_file : %d\n", crypt );
add: devel_debug ( g_strdup_printf ("gsb_file_util_crypt_file : %d", crypt ));
context: gulong gsb_file_util_crypt_file ( gchar * file_name, gchar **file_content,				gboolean crypt, gulong length ){    gint result;    gchar *key;    gulong position;    if ( DEBUG )	printf ( "gsb_file_util_crypt_file : %d\n", crypt );    if ( crypt )    {	/* we want to encrypt the file */	gchar *encrypted_file;	/* check first if we want to encrypt that file */	if ( !etat.crypt_file )	    return length;	/* now, if we know here a key to crypt, we use it, else, we ask for it */	if ( crypt_key )	    key = crypt_key;	else	    key = gsb_file_util_ask_for_crypt_key ( file_name, TRUE);	/* if we have no key, we will no crypt that file */	if ( !key )	    return length;	/* we create a copy of the file in memory which will begin by "Grisbi encrypted file " */	encrypted_file = g_malloc ( (length + 22) * sizeof ( gchar ));	strncpy ( encrypted_file,		  "Grisbi encrypted file ",		  22 );	memmove ( encrypted_file + 22,		  *file_content,		  length );		position = 0;	while ( position < length)	{	    gulong size;	    if ( (length - position ) < 8192 )	    {		size = length - position;		/* the encryption need to be by block of 8, so the last bytes of the		 * file won't be encrypted... i don't think it's annoying, if it is,		 * we can change here to increase the lenght of the file */		size = size / 8 * 8;	    }	    else		size = 8192;	    result = ecb_crypt ( key,				 encrypted_file + 22 + position,				 size,				 DES_ENCRYPT );	    if ( result == DESERR_BADPARAM )	    {		dialogue_error ( _("Error while crypting the file, the file saved won't be crypted."));		return length;	    }	    position = position + 8192;	}	free (*file_content);	*file_content = encrypted_file;	/* the actual length is the initial + 22 (size of Grisbi encrypted file */	return length + 22;    }    else    {	/* we want to decrypt the file */	gchar *decrypted_file;	/* we set the length on the rigt size */	length = length - 22;	return_bad_password:	/* now, if we know here a key to crypt, we use it, else, we ask for it */	if ( crypt_key )	    key = crypt_key;	else	    key = gsb_file_util_ask_for_crypt_key ( file_name, FALSE);	/* if we have no key, we stop the loading */	if ( !key )	    return 0;	/* we create a copy of the file in memory which will begin by "Grisbi encrypted file " */	decrypted_file = g_malloc ( length * sizeof ( gchar ));	memmove ( decrypted_file,		  *file_content + 22,		  length );		position = 0;	while ( position < length)	{	    gint size;	    if ( (length - position ) < 8192 )	    {		size = length - position;		/* the encryption need to be by block of 8, so the last bytes of the		 * file won't be encrypted... i don't think it's annoying, if it is,		 * we can change here to increase the lenght of the file */		size = size / 8 * 8;	    }	    else		size = 8192;	    result = ecb_crypt ( key,				 decrypted_file + position,				 size,				 DES_DECRYPT );	    if ( result == DESERR_BADPARAM )	    {		dialogue_error ( _("Error while decrypting the file, the file cannot be opened."));		return 0;	    }	    position = position + 8192;	}	/* befor freeing file_content and go back, we check that the password was correct	 * if not, we free the decrypted_file and ask again for the password */	if ( strncmp ( decrypted_file,		       "<?xml version=\"1.0\"?>",		       18 )	     &&	     strncmp ( decrypted_file,		       "Grisbi compressed file ",		       23 ))	{	    /* it seems that it was not the correct password */	    free ( decrypted_file );	    dialogue_error ( _( "The password was incorrect ! Please try again..."));	    crypt_key = NULL;	    goto return_bad_password;	}	free (*file_content);	*file_content = decrypted_file;	return length;    }    /* normally never come here */    return 0;}