Hi,
here is a small patch for the shot module.
1) 'fsize' should be long, and doesn't need to be global (as 'fdata' ?)
2) At l.475, we leak 'fd'
3) Error dialogs' titles should be simplified
4) Also added some strerror(errno) in error messages...
Tested on OpenBSD.
Ok/Comments ?
Index: e_mod_main.c
===================================================================
--- e_mod_main.c (révision 81690)
+++ e_mod_main.c (copie de travail)
@@ -32,7 +32,6 @@
static Evas_Object *o_label = NULL;
static Evas_Object *o_entry = NULL;
static unsigned char *fdata = NULL;
-static int fsize = 0;
static Ecore_Con_Url *url_up = NULL;
static Eina_List *handlers = NULL;
static char *url_ret = NULL;
@@ -434,6 +433,7 @@
char buf[PATH_MAX];
FILE *f;
int i, fd = -1;
+ long fsize;
srand(time(NULL));
for (i = 0; i < 10240; i++)
@@ -449,7 +449,7 @@
}
if (fd < 0)
{
- e_util_dialog_show(_("Error - Can't create file"),
+ e_util_dialog_show(_("Error"),
_("Cannot create temporary file '%s': %s"),
buf, strerror(errno));
if (win)
@@ -468,18 +468,19 @@
f = fdopen(fd, "rb");
if (!f)
{
- e_util_dialog_show(_("Error - Can't open file"),
+ e_util_dialog_show(_("Error"),
_("Cannot open temporary file '%s': %s"),
buf, strerror(errno));
+ close(fd);
return;
}
fseek(f, 0, SEEK_END);
fsize = ftell(f);
if (fsize < 1)
{
- e_util_dialog_show(_("Error - Bad size"),
- _("Cannot get size of file '%s'"),
- buf);
+ e_util_dialog_show(_("Error"),
+ _("Cannot get size of file '%s': %s"),
+ buf, strerror(errno));
fclose(f);
return;
}
@@ -488,7 +489,7 @@
fdata = malloc(fsize);
if (!fdata)
{
- e_util_dialog_show(_("Error - Can't allocate memory"),
+ e_util_dialog_show(_("Error"),
_("Cannot allocate memory for picture: %s"),
strerror(errno));
fclose(f);
@@ -496,8 +497,8 @@
}
if (fread(fdata, fsize, 1, f) != 1)
{
- e_util_dialog_show(_("Error - Can't read picture"),
- _("Cannot read picture"));
+ e_util_dialog_show(_("Error"),
+ _("Cannot read picture: %s"), strerror(errno));
E_FREE(fdata);
fclose(f);
return;
------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel