X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fio%2Furistream.cpp;h=05d7f020af8d1e2066d388f795357eb1b4c98d8f;hb=5631ed32020cc6eb670765a4463eb1c66d2b90d6;hp=e06498d527ddc5d84e8f9bb7072130f6781a4785;hpb=6b15695578f07a3f72c4c9475c1a261a3021472a;p=inkscape.git diff --git a/src/io/uristream.cpp b/src/io/uristream.cpp index e06498d52..05d7f020a 100644 --- a/src/io/uristream.cpp +++ b/src/io/uristream.cpp @@ -13,6 +13,8 @@ #include "uristream.h" #include "sys.h" +#include +#include #ifdef WIN32 // For now to get at is_os_wide(). @@ -105,19 +107,19 @@ UriInputStream::UriInputStream(Inkscape::URI &source) throw (StreamException): uri(source) { //get information from uri - char *schemestr = (char *) uri.getScheme(); + char const *schemestr = uri.getScheme(); scheme = SCHEME_FILE; if (!schemestr || strncmp("file", schemestr, 4)==0) scheme = SCHEME_FILE; else if (strncmp("data", schemestr, 4)==0) scheme = SCHEME_DATA; //printf("in schemestr:'%s' scheme:'%d'\n", schemestr, scheme); - char *cpath = NULL; + gchar *cpath = NULL; switch (scheme) { case SCHEME_FILE: - cpath = (char *) uri.toNativeFilename(); + cpath = uri.toNativeFilename(); //printf("in cpath:'%s'\n", cpath); inf = fopen_utf8name(cpath, FILE_READ); //inf = fopen(cpath, "rb"); @@ -317,18 +319,18 @@ UriOutputStream::UriOutputStream(Inkscape::URI &destination) scheme(SCHEME_FILE) { //get information from uri - char *schemestr = (char *) uri.getScheme(); + char const *schemestr = uri.getScheme(); if (!schemestr || strncmp("file", schemestr, 4)==0) scheme = SCHEME_FILE; else if (strncmp("data", schemestr, 4)==0) scheme = SCHEME_DATA; //printf("out schemestr:'%s' scheme:'%d'\n", schemestr, scheme); - char *cpath = NULL; + gchar *cpath = NULL; switch (scheme) { case SCHEME_FILE: - cpath = (char *) uri.toNativeFilename(); + cpath = uri.toNativeFilename(); //printf("out path:'%s'\n", cpath); outf = fopen_utf8name(cpath, FILE_WRITE); //outf = fopen(cpath, "wb"); @@ -427,7 +429,10 @@ void UriOutputStream::put(int ch) throw(StreamException) if (!outf) return; uch = (unsigned char)(ch & 0xff); - fputc(uch, outf); + if (fputc(uch, outf) == EOF) { + Glib::ustring err = "ERROR writing to file "; + throw StreamException(err); + } //fwrite(uch, 1, 1, outf); break;