Arrange file saving for error handling to fix warnings
This commit is contained in:
parent
59ff9878c9
commit
e019c677bb
2 changed files with 21 additions and 3 deletions
|
@ -419,6 +419,7 @@ katze_net_icon_transfer_cb (KatzeNetRequest* request,
|
||||||
FILE* fp;
|
FILE* fp;
|
||||||
GdkPixbuf* pixbuf_scaled;
|
GdkPixbuf* pixbuf_scaled;
|
||||||
gint icon_width, icon_height;
|
gint icon_width, icon_height;
|
||||||
|
size_t ret;
|
||||||
|
|
||||||
if (request->status == KATZE_NET_MOVED)
|
if (request->status == KATZE_NET_MOVED)
|
||||||
return;
|
return;
|
||||||
|
@ -428,8 +429,13 @@ katze_net_icon_transfer_cb (KatzeNetRequest* request,
|
||||||
{
|
{
|
||||||
if ((fp = fopen (priv->icon_file, "wb")))
|
if ((fp = fopen (priv->icon_file, "wb")))
|
||||||
{
|
{
|
||||||
fwrite (request->data, 1, request->length, fp);
|
ret = fwrite (request->data, 1, request->length, fp);
|
||||||
fclose (fp);
|
fclose (fp);
|
||||||
|
if ((ret - request->length) != 0)
|
||||||
|
{
|
||||||
|
/* FIXME: We need error handling. If this is called,
|
||||||
|
it means there was a write error */
|
||||||
|
}
|
||||||
pixbuf = gdk_pixbuf_new_from_file (priv->icon_file, NULL);
|
pixbuf = gdk_pixbuf_new_from_file (priv->icon_file, NULL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -635,14 +635,20 @@ midori_browser_save_transfer_cb (KatzeNetRequest* request,
|
||||||
gchar* filename)
|
gchar* filename)
|
||||||
{
|
{
|
||||||
FILE* fp;
|
FILE* fp;
|
||||||
|
size_t ret;
|
||||||
|
|
||||||
if (request->data)
|
if (request->data)
|
||||||
{
|
{
|
||||||
/* FIXME: Show an error message if the file cannot be saved */
|
/* FIXME: Show an error message if the file cannot be saved */
|
||||||
if ((fp = fopen (filename, "wb")))
|
if ((fp = fopen (filename, "wb")))
|
||||||
{
|
{
|
||||||
fwrite (request->data, 1, request->length, fp);
|
ret = fwrite (request->data, 1, request->length, fp);
|
||||||
fclose (fp);
|
fclose (fp);
|
||||||
|
if ((ret - request->length) != 0)
|
||||||
|
{
|
||||||
|
/* FIXME: We need error handling. If this is called,
|
||||||
|
i means there was a write error */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
g_free (filename);
|
g_free (filename);
|
||||||
|
@ -1822,6 +1828,7 @@ midori_browser_source_transfer_cb (KatzeNetRequest* request,
|
||||||
gchar* text_editor;
|
gchar* text_editor;
|
||||||
gint fd;
|
gint fd;
|
||||||
FILE* fp;
|
FILE* fp;
|
||||||
|
size_t ret;
|
||||||
|
|
||||||
if (request->data)
|
if (request->data)
|
||||||
{
|
{
|
||||||
|
@ -1833,8 +1840,13 @@ midori_browser_source_transfer_cb (KatzeNetRequest* request,
|
||||||
{
|
{
|
||||||
if ((fp = fdopen (fd, "w")))
|
if ((fp = fdopen (fd, "w")))
|
||||||
{
|
{
|
||||||
fwrite (request->data, 1, request->length, fp);
|
ret = fwrite (request->data, 1, request->length, fp);
|
||||||
fclose (fp);
|
fclose (fp);
|
||||||
|
if ((ret - request->length) != 0)
|
||||||
|
{
|
||||||
|
/* FIXME: We need error handling. If this is called,
|
||||||
|
it means there was a write error */
|
||||||
|
}
|
||||||
g_object_get (browser->settings,
|
g_object_get (browser->settings,
|
||||||
"text-editor", &text_editor, NULL);
|
"text-editor", &text_editor, NULL);
|
||||||
sokoke_spawn_program (text_editor, unique_filename);
|
sokoke_spawn_program (text_editor, unique_filename);
|
||||||
|
|
Loading…
Reference in a new issue