summaryrefslogtreecommitdiffstats
path: root/g10/photoid.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2003-06-18 21:56:13 +0200
committerWerner Koch <wk@gnupg.org>2003-06-18 21:56:13 +0200
commitc0c2c58054923d506f61ce9a71d509b48a381211 (patch)
treea8f82bffb44eb68eb726ff6db41fa715bcd29193 /g10/photoid.c
parentA small step for GnuPG but a huge leap for error codes. (diff)
downloadgnupg2-c0c2c58054923d506f61ce9a71d509b48a381211.tar.xz
gnupg2-c0c2c58054923d506f61ce9a71d509b48a381211.zip
Finished the bulk of changes for gnupg 1.9. This included switching
to libgcrypt functions, using shared error codes from libgpg-error, replacing the old functions we used to have in ../util by those in ../jnlib and ../common, renaming the malloc functions and a couple of types. Note, that not all changes are listed below becuause they are too similar and done at far too many places. As of today the code builds using the current libgcrypt from CVS but it is very unlikely that it actually works.
Diffstat (limited to 'g10/photoid.c')
-rw-r--r--g10/photoid.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/g10/photoid.c b/g10/photoid.c
index b311bfa09..1dd6edeca 100644
--- a/g10/photoid.c
+++ b/g10/photoid.c
@@ -49,7 +49,7 @@ PKT_user_id *generate_photo_id(PKT_public_key *pk)
char *filename=NULL;
byte *photo=NULL;
byte header[16];
- IOBUF file;
+ iobuf_t file;
header[0]=0x10; /* little side of photo header length */
header[1]=0; /* big side of photo header length */
@@ -60,7 +60,7 @@ PKT_user_id *generate_photo_id(PKT_public_key *pk)
header[i]=0;
#define EXTRA_UID_NAME_SPACE 71
- uid=m_alloc_clear(sizeof(*uid)+71);
+ uid=xcalloc (1,sizeof(*uid)+71);
printf(_("\nPick an image to use for your photo ID. "
"The image must be a JPEG file.\n"
@@ -73,7 +73,7 @@ PKT_user_id *generate_photo_id(PKT_public_key *pk)
{
printf("\n");
- m_free(filename);
+ xfree (filename);
filename=cpr_get("photoid.jpeg.add",
_("Enter JPEG filename for photo ID: "));
@@ -101,7 +101,7 @@ PKT_user_id *generate_photo_id(PKT_public_key *pk)
}
}
- photo=m_alloc(len);
+ photo=xmalloc (len);
iobuf_read(file,photo,len);
iobuf_close(file);
@@ -110,7 +110,7 @@ PKT_user_id *generate_photo_id(PKT_public_key *pk)
photo[6]!='J' || photo[7]!='F' || photo[8]!='I' || photo[9]!='F')
{
log_error(_("\"%s\" is not a JPEG file\n"),filename);
- m_free(photo);
+ xfree (photo);
photo=NULL;
continue;
}
@@ -132,7 +132,7 @@ PKT_user_id *generate_photo_id(PKT_public_key *pk)
goto scram;
case 0:
free_attributes(uid);
- m_free(photo);
+ xfree (photo);
photo=NULL;
continue;
}
@@ -143,13 +143,13 @@ PKT_user_id *generate_photo_id(PKT_public_key *pk)
uid->ref=1;
scram:
- m_free(filename);
- m_free(photo);
+ xfree (filename);
+ xfree (photo);
if(error)
{
free_attributes(uid);
- m_free(uid);
+ xfree (uid);
return NULL;
}
@@ -283,7 +283,7 @@ void show_photos(const struct user_attribute *attrs,
if(!command)
goto fail;
- name=m_alloc(16+strlen(EXTSEP_S)+
+ name=xmalloc (16+strlen(EXTSEP_S)+
strlen(image_type_to_string(args.imagetype,0))+1);
/* Make the filename. Notice we are not using the image
@@ -302,7 +302,7 @@ void show_photos(const struct user_attribute *attrs,
if(exec_write(&spawn,NULL,command,name,1,1)!=0)
{
- m_free(name);
+ xfree (name);
goto fail;
}
@@ -311,7 +311,7 @@ void show_photos(const struct user_attribute *attrs,
image_type_to_string(args.imagetype,2));
#endif
- m_free(name);
+ xfree (name);
fwrite(&attrs[i].data[offset],attrs[i].len-offset,1,spawn->tochild);