diff --git a/src/io/uristream.cpp b/src/io/uristream.cpp
index e06498d527ddc5d84e8f9bb7072130f6781a4785..05d7f020af8d1e2066d388f795357eb1b4c98d8f 100644 (file)
--- a/src/io/uristream.cpp
+++ b/src/io/uristream.cpp
#include "uristream.h"
#include "sys.h"
+#include <string>
+#include <cstring>
#ifdef WIN32
// For now to get at is_os_wide().
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");
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");
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;