summaryrefslogtreecommitdiffstats
path: root/src/sp-image.cpp
diff options
context:
space:
mode:
authorsu_v <suv-sf@users.sourceforge.net>2013-04-08 15:06:08 +0000
committer~suv <suv-sf@users.sourceforge.net>2013-04-08 15:06:08 +0000
commitf332fa6dbb58ab6b8e17f9b720f334c5e2722812 (patch)
tree2ead4c65ceb8f91aeb84628f9ca4849547d281c9 /src/sp-image.cpp
parentmerge from trunk (r12258) (diff)
parentImplement read/write of image-rendering property. To be used to control scaling. (diff)
downloadinkscape-f332fa6dbb58ab6b8e17f9b720f334c5e2722812.tar.gz
inkscape-f332fa6dbb58ab6b8e17f9b720f334c5e2722812.zip
merge from trunk (r12272)
(bzr r11668.1.66)
Diffstat (limited to 'src/sp-image.cpp')
-rw-r--r--src/sp-image.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/sp-image.cpp b/src/sp-image.cpp
index ce8879f70..dacea3417 100644
--- a/src/sp-image.cpp
+++ b/src/sp-image.cpp
@@ -417,8 +417,12 @@ GdkPixbuf* pixbuf_new_from_file( const char *filename, time_t &modTime, gchar*&
pixPath = NULL;
}
+ //test correctness of filename
+ if (!g_file_test (filename, G_FILE_TEST_EXISTS)){
+ return NULL;
+ }
struct stat stdir;
- g_stat(filename, &stdir);
+ int val = g_stat(filename, &stdir);
if (stdir.st_mode & S_IFDIR){
//filename is not correct: it is a directory name and hence further code can not return valid results
return NULL;
@@ -429,11 +433,11 @@ GdkPixbuf* pixbuf_new_from_file( const char *filename, time_t &modTime, gchar*&
if ( fp )
{
{
- struct stat st;
- memset(&st, 0, sizeof(st));
- int val = g_stat(filename, &st);
+ // struct stat st;
+ // memset(&st, 0, sizeof(st));
+ // int val = g_stat(filename, &st);
if ( !val ) {
- modTime = st.st_mtime;
+ modTime = stdir.st_mtime;//st.st_mtime;
pixPath = g_strdup(filename);
}
}
@@ -1495,7 +1499,10 @@ void sp_image_refresh_if_outdated( SPImage* image )
struct stat st;
memset(&st, 0, sizeof(st));
- int val = g_stat(image->pixPath, &st);
+ int val = 0;
+ if (g_file_test (image->pixPath, G_FILE_TEST_EXISTS)){
+ val = g_stat(image->pixPath, &st);
+ }
if ( !val ) {
// stat call worked. Check time now
if ( st.st_mtime != image->lastMod ) {