diff options
| author | Andrew Higginson <at.higginson@gmail.com> | 2011-12-27 21:04:47 +0000 |
|---|---|---|
| committer | Andrew <at.higginson@gmail.com> | 2011-12-27 21:04:47 +0000 |
| commit | 80960b623a99aae1402ab651b2974ef544ed3b03 (patch) | |
| tree | ba49d42c2789e9e11f805e2d5263e10f9fedeef8 /src/io | |
| parent | try to fix bug (diff) | |
| parent | GDL: Cherry-pick upstream patch 73852 (2011-03-23) - Add missing return value. (diff) | |
| download | inkscape-80960b623a99aae1402ab651b2974ef544ed3b03.tar.gz inkscape-80960b623a99aae1402ab651b2974ef544ed3b03.zip | |
merged with trunk so I can build again...
(bzr r10092.1.36)
Diffstat (limited to 'src/io')
| -rw-r--r-- | src/io/CMakeLists.txt | 46 | ||||
| -rw-r--r-- | src/io/base64stream.cpp | 15 | ||||
| -rw-r--r-- | src/io/base64stream.h | 10 | ||||
| -rw-r--r-- | src/io/ftos.cpp | 2 | ||||
| -rw-r--r-- | src/io/gzipstream.cpp | 6 | ||||
| -rw-r--r-- | src/io/gzipstream.h | 10 | ||||
| -rw-r--r-- | src/io/inkjar.cpp | 19 | ||||
| -rw-r--r-- | src/io/inkjar.h | 3 | ||||
| -rw-r--r-- | src/io/inkscapestream.cpp | 2 | ||||
| -rw-r--r-- | src/io/inkscapestream.h | 10 | ||||
| -rw-r--r-- | src/io/resource.cpp | 5 | ||||
| -rw-r--r-- | src/io/resource.h | 7 | ||||
| -rw-r--r-- | src/io/streamtest.cpp | 8 | ||||
| -rw-r--r-- | src/io/stringstream.cpp | 2 | ||||
| -rw-r--r-- | src/io/sys.cpp | 12 | ||||
| -rw-r--r-- | src/io/sys.h | 4 | ||||
| -rw-r--r-- | src/io/uristream.cpp | 39 | ||||
| -rw-r--r-- | src/io/uristream.h | 19 | ||||
| -rw-r--r-- | src/io/xsltstream.cpp | 2 | ||||
| -rw-r--r-- | src/io/xsltstream.h | 11 |
20 files changed, 116 insertions, 116 deletions
diff --git a/src/io/CMakeLists.txt b/src/io/CMakeLists.txt index 13b8f568b..c5606779e 100644 --- a/src/io/CMakeLists.txt +++ b/src/io/CMakeLists.txt @@ -1,16 +1,32 @@ -SET(io_SRC -base64stream.cpp -ftos.cpp -gzipstream.cpp -inkscapestream.cpp -resource.cpp -simple-sax.cpp -#streamtest.cpp -stringstream.cpp -sys.cpp -uristream.cpp -xsltstream.cpp + +set(io_SRC + base64stream.cpp + ftos.cpp + gzipstream.cpp + inkjar.cpp + inkscapestream.cpp + resource.cpp + simple-sax.cpp + stringstream.cpp + sys.cpp + uristream.cpp + xsltstream.cpp + + + # ------- + # Headers + base64stream.h + ftos.h + gzipstream.h + inkjar.h + inkscapestream.h + resource.h + simple-sax.h + stringstream.h + sys.h + uristream.h + xsltstream.h ) -ADD_LIBRARY(io STATIC ${io_SRC}) -TARGET_LINK_LIBRARIES(io -2geom ${INKSCAPE_LIBS})
\ No newline at end of file + +# add_inkscape_lib(io_LIB "${io_SRC}") +add_inkscape_source("${io_SRC}") diff --git a/src/io/base64stream.cpp b/src/io/base64stream.cpp index c90f3760b..0a28a8cc3 100644 --- a/src/io/base64stream.cpp +++ b/src/io/base64stream.cpp @@ -1,4 +1,4 @@ -/** +/* * Base64-enabled input and output streams * * This class allows easy encoding and decoding @@ -51,12 +51,15 @@ static int base64decode[] = * */ Base64InputStream::Base64InputStream(InputStream &sourceStream) - : BasicInputStream(sourceStream) + : BasicInputStream(sourceStream), + outCount(0), + padCount(0), + done(false) { - outCount = 0; - padCount = 0; - closed = false; - done = false; + for (int k=0;k<3;k++) + { + outBytes[k]=0; + } } /** diff --git a/src/io/base64stream.h b/src/io/base64stream.h index 7bfe73e5f..554a92fe2 100644 --- a/src/io/base64stream.h +++ b/src/io/base64stream.h @@ -1,13 +1,15 @@ -#ifndef __INKSCAPE_IO_BASE64STREAM_H__ -#define __INKSCAPE_IO_BASE64STREAM_H__ +#ifndef SEEN_INKSCAPE_IO_BASE64STREAM_H +#define SEEN_INKSCAPE_IO_BASE64STREAM_H /** + * @file * Base64-enabled input and output streams * * This class allows easy encoding and decoding * of Base64 data with a stream interface, hiding * the implementation from the user. - * + */ +/* * Authors: * Bob Jamison <rjamison@titan.com> * @@ -119,4 +121,4 @@ private: } // namespace Inkscape -#endif /* __INKSCAPE_IO_BASE64STREAM_H__ */ +#endif // SEEN_INKSCAPE_IO_BASE64STREAM_H diff --git a/src/io/ftos.cpp b/src/io/ftos.cpp index 47f0dc232..b8d161ca4 100644 --- a/src/io/ftos.cpp +++ b/src/io/ftos.cpp @@ -320,6 +320,7 @@ string ftos(double val, char mode, int sigfig, int precision, int options) break; default: + g_free(p); return "**bad mode**"; } @@ -413,6 +414,7 @@ string ftos(double val, char mode, int sigfig, int precision, int options) fprintf(stderr, "*** End of ftos with ascii = ", ascii.c_str()); #endif /* finally, we can return */ + g_free(p); return ascii; } diff --git a/src/io/gzipstream.cpp b/src/io/gzipstream.cpp index ece0ddc67..ed94974fe 100644 --- a/src/io/gzipstream.cpp +++ b/src/io/gzipstream.cpp @@ -1,4 +1,4 @@ -/** +/* * Zlib-enabled input and output streams * * This is a thin wrapper of libz calls, in order @@ -172,7 +172,7 @@ bool GzipInputStream::load() std::vector<unsigned char>::iterator iter; Bytef *p = srcBuf; - for (iter=inputBuf.begin() ; iter != inputBuf.end() ; iter++) + for (iter=inputBuf.begin() ; iter != inputBuf.end() ; ++iter) *p++ = *iter; int headerLen = 10; @@ -390,7 +390,7 @@ void GzipOutputStream::flush() std::vector<unsigned char>::iterator iter; Bytef *p = srcbuf; - for (iter=inputBuf.begin() ; iter != inputBuf.end() ; iter++) + for (iter=inputBuf.begin() ; iter != inputBuf.end() ; ++iter) *p++ = *iter; crc = crc32(crc, (const Bytef *)srcbuf, srclen); diff --git a/src/io/gzipstream.h b/src/io/gzipstream.h index adaf50967..4debbfca9 100644 --- a/src/io/gzipstream.h +++ b/src/io/gzipstream.h @@ -1,12 +1,14 @@ -#ifndef __INKSCAPE_IO_GZIPSTREAM_H__ -#define __INKSCAPE_IO_GZIPSTREAM_H__ +#ifndef SEEN_INKSCAPE_IO_GZIPSTREAM_H +#define SEEN_INKSCAPE_IO_GZIPSTREAM_H /** - * Zlib-enabled input and output streams + * @file + * Zlib-enabled input and output streams. * * This is a thin wrapper of libz calls, in order * to provide a simple interface to our developers * for gzip input and output. - * + */ +/* * Authors: * Bob Jamison <rjamison@titan.com> * diff --git a/src/io/inkjar.cpp b/src/io/inkjar.cpp index c238aba36..20b164b99 100644 --- a/src/io/inkjar.cpp +++ b/src/io/inkjar.cpp @@ -139,16 +139,18 @@ bool JarFile::read_signature() #endif if (signature == 0x08074b50) { - //skip data descriptor - bytes = (guint8 *)malloc(sizeof(guint8) * 12); - if (!read(bytes, 12)) { - g_free(bytes); - return false; - } + //skip data descriptor + bytes = (guint8 *)g_malloc(sizeof(guint8) * 12); + if (!read(bytes, 12)) { + g_free(bytes); + return false; + } else { + g_free(bytes); + } } else if (signature == 0x02014b50 || signature == 0x04034b50) { - return true; + return true; } else { - return false; + return false; } return false; } @@ -214,6 +216,7 @@ GByteArray *JarFile::get_next_file_contents() if (_last_filename != NULL) g_free(_last_filename); _last_filename = NULL; + g_free(bytes); return NULL; } diff --git a/src/io/inkjar.h b/src/io/inkjar.h index 0fe088b24..ea4b0ee32 100644 --- a/src/io/inkjar.h +++ b/src/io/inkjar.h @@ -26,8 +26,7 @@ # endif #endif -#include <glib/garray.h> -#include <glib/gtypes.h> +#include <glib.h> namespace Inkjar { diff --git a/src/io/inkscapestream.cpp b/src/io/inkscapestream.cpp index c89dd70fc..da7870add 100644 --- a/src/io/inkscapestream.cpp +++ b/src/io/inkscapestream.cpp @@ -1,4 +1,4 @@ -/** +/* * Our base input/output stream classes. These are is directly * inherited from iostreams, and includes any extra * functionality that we might need. diff --git a/src/io/inkscapestream.h b/src/io/inkscapestream.h index 9358b4d51..a766e16e0 100644 --- a/src/io/inkscapestream.h +++ b/src/io/inkscapestream.h @@ -1,8 +1,6 @@ -#ifndef __INKSCAPE_IO_INKSCAPESTREAM_H__ -#define __INKSCAPE_IO_INKSCAPESTREAM_H__ -/** - * Our base basic stream classes. - * +#ifndef SEEN_INKSCAPE_IO_INKSCAPESTREAM_H +#define SEEN_INKSCAPE_IO_INKSCAPESTREAM_H +/* * Authors: * Bob Jamison <rjamison@titan.com> * @@ -667,4 +665,4 @@ void pipeStream(InputStream &source, OutputStream &dest); } // namespace Inkscape -#endif /* __INKSCAPE_IO_INKSCAPESTREAM_H__ */ +#endif // SEEN_INKSCAPE_IO_INKSCAPESTREAM_H diff --git a/src/io/resource.cpp b/src/io/resource.cpp index 8c76c7132..ac1c5f06b 100644 --- a/src/io/resource.cpp +++ b/src/io/resource.cpp @@ -1,4 +1,4 @@ -/** \file +/* * Inkscape::IO::Resource - simple resource API * * Copyright 2006 MenTaLguY <mental@rydia.net> @@ -17,9 +17,6 @@ #endif #include <glib.h> // g_assert() -#include <glib/gmessages.h> -#include <glib/gstrfuncs.h> -#include <glib/gfileutils.h> #include "path-prefix.h" #include "inkscape.h" #include "io/resource.h" diff --git a/src/io/resource.h b/src/io/resource.h index be3ff21b7..36fe5f81e 100644 --- a/src/io/resource.h +++ b/src/io/resource.h @@ -1,6 +1,4 @@ -/** \file - * Inkscape::IO::Resource - simple resource API - * +/* * Copyright 2006 MenTaLguY <mental@rydia.net> * * This program is free software; you can redistribute it and/or @@ -21,6 +19,9 @@ namespace Inkscape { namespace IO { +/** + * simple resource API + */ namespace Resource { enum Type { diff --git a/src/io/streamtest.cpp b/src/io/streamtest.cpp index b25ef43f0..2030e6a85 100644 --- a/src/io/streamtest.cpp +++ b/src/io/streamtest.cpp @@ -219,13 +219,15 @@ int main(int argc, char **argv) // create temp files somewhere else instead of current dir // TODO: clean them up too char * testpath = strdup("/tmp/streamtest-XXXXXX"); - testpath = mkdtemp(testpath); - if (!testpath) + char * testpath2; + testpath2 = mkdtemp(testpath); + free(testpath); + if (!testpath2) { perror("mkdtemp"); return 1; } - if (chdir(testpath)) + if (chdir(testpath2)) { perror("chdir"); return 1; diff --git a/src/io/stringstream.cpp b/src/io/stringstream.cpp index 45fb6fe30..44d11dd04 100644 --- a/src/io/stringstream.cpp +++ b/src/io/stringstream.cpp @@ -1,4 +1,4 @@ -/** +/* * Our base String stream classes. We implement these to * be based on Glib::ustring * diff --git a/src/io/sys.cpp b/src/io/sys.cpp index e7fdfaa2d..5f19ee5db 100644 --- a/src/io/sys.cpp +++ b/src/io/sys.cpp @@ -17,23 +17,13 @@ #include <glib.h> #include <glib/gstdio.h> -#include <glib/gutils.h> #include <glibmm/fileutils.h> -#if GLIB_CHECK_VERSION(2,6,0) - #include <glib/gstdio.h> -#endif #include <glibmm/ustring.h> -#include <gtk/gtkmessagedialog.h> +#include <gtk/gtk.h> #include "preferences.h" #include "sys.h" -#ifdef WIN32 -// For now to get at is_os_wide(). -#include "extension/internal/win32.h" -using Inkscape::Extension::Internal::PrintWin32; -#endif // WIN32 - //#define INK_DUMP_FILENAME_CONV 1 #undef INK_DUMP_FILENAME_CONV diff --git a/src/io/sys.h b/src/io/sys.h index 8ece3b84a..fbfe4d4c4 100644 --- a/src/io/sys.h +++ b/src/io/sys.h @@ -15,9 +15,7 @@ #include <stdio.h> #include <sys/stat.h> #include <sys/types.h> -#include <glib/gtypes.h> -#include <glib/gdir.h> -#include <glib/gfileutils.h> +#include <glib.h> #include <glibmm/spawn.h> #include <string> diff --git a/src/io/uristream.cpp b/src/io/uristream.cpp index 05d7f020a..19994bc82 100644 --- a/src/io/uristream.cpp +++ b/src/io/uristream.cpp @@ -1,4 +1,4 @@ -/** +/* * Our base String stream classes. We implement these to * be based on Glib::ustring * @@ -16,12 +16,6 @@ #include <string> #include <cstring> -#ifdef WIN32 -// For now to get at is_os_wide(). -# include "extension/internal/win32.h" -using Inkscape::Extension::Internal::PrintWin32; -#endif - namespace Inkscape { @@ -65,7 +59,7 @@ static FILE *fopen_utf8name( char const *utf8name, int mode ) g_free(filename); } #else - if ( PrintWin32::is_os_wide() ) { + { gunichar2 *wideName = g_utf8_to_utf16( utf8name, -1, NULL, NULL, NULL ); if ( wideName ) { if (mode == FILE_READ) @@ -78,15 +72,6 @@ static FILE *fopen_utf8name( char const *utf8name, int mode ) g_message("Unable to convert filename from UTF-8 to UTF-16 [%s]", safe); g_free(safe); } - } else { - gchar *filename = g_filename_from_utf8( utf8name, -1, NULL, NULL, NULL ); - if ( filename ) { - if (mode == FILE_READ) - fp = std::fopen(filename, "rb"); - else - fp = std::fopen(filename, "wb"); - g_free(filename); - } } #endif @@ -113,27 +98,26 @@ UriInputStream::UriInputStream(Inkscape::URI &source) scheme = SCHEME_FILE; else if (strncmp("data", schemestr, 4)==0) scheme = SCHEME_DATA; - //printf("in schemestr:'%s' scheme:'%d'\n", schemestr, scheme); - gchar *cpath = NULL; + gchar *cpath = NULL; switch (scheme) { case SCHEME_FILE: cpath = uri.toNativeFilename(); - //printf("in cpath:'%s'\n", cpath); inf = fopen_utf8name(cpath, FILE_READ); - //inf = fopen(cpath, "rb"); - g_free(cpath); if (!inf) { Glib::ustring err = "UriInputStream cannot open file "; err += cpath; + g_free(cpath); throw StreamException(err); } + else{ + g_free(cpath); + } break; case SCHEME_DATA: data = (unsigned char *) uri.getPath(); - //printf("in data:'%s'\n", data); dataPos = 0; dataLen = strlen((const char *)data); break; @@ -146,15 +130,18 @@ UriInputStream::UriInputStream(Inkscape::URI &source) * */ UriInputStream::UriInputStream(FILE *source, Inkscape::URI &uri) - throw (StreamException): inf(source), - uri(uri) + throw (StreamException): uri(uri), + inf(source), + data(0), + dataPos(0), + dataLen(0), + closed(false) { scheme = SCHEME_FILE; if (!inf) { Glib::ustring err = "UriInputStream passed NULL"; throw StreamException(err); } - closed = false; } /** diff --git a/src/io/uristream.h b/src/io/uristream.h index d62065976..16b1b0894 100644 --- a/src/io/uristream.h +++ b/src/io/uristream.h @@ -1,9 +1,11 @@ -#ifndef __INKSCAPE_IO_URISTREAM_H__ -#define __INKSCAPE_IO_URISTREAM_H__ +#ifndef SEEN_INKSCAPE_IO_URISTREAM_H +#define SEEN_INKSCAPE_IO_URISTREAM_H /** + * @file * This should be the only way that we provide sources/sinks * to any input/output stream. - * + */ +/* * Authors: * Bob Jamison <rjamison@titan.com> * @@ -48,18 +50,15 @@ public: virtual int get() throw(StreamException); private: - - bool closed; - + Inkscape::URI &uri; FILE *inf; //for file: uris unsigned char *data; //for data: uris int dataPos; // current read position in data field int dataLen; // length of data buffer - - Inkscape::URI &uri; - + bool closed; int scheme; + }; // class UriInputStream @@ -170,4 +169,4 @@ private: } // namespace Inkscape -#endif /* __INKSCAPE_IO_URISTREAM_H__ */ +#endif // SEEN_INKSCAPE_IO_URISTREAM_H diff --git a/src/io/xsltstream.cpp b/src/io/xsltstream.cpp index 6f35d9cb6..6b72627d3 100644 --- a/src/io/xsltstream.cpp +++ b/src/io/xsltstream.cpp @@ -1,4 +1,4 @@ -/** +/* * XSL Transforming input and output classes * * Authors: diff --git a/src/io/xsltstream.h b/src/io/xsltstream.h index 32d9d12f8..cfe9e5124 100644 --- a/src/io/xsltstream.h +++ b/src/io/xsltstream.h @@ -1,9 +1,10 @@ -#ifndef __INKSCAPE_IO_XSLTSTREAM_H__ -#define __INKSCAPE_IO_XSLTSTREAM_H__ +#ifndef SEEN_INKSCAPE_IO_XSLTSTREAM_H +#define SEEN_INKSCAPE_IO_XSLTSTREAM_H /** - * Xslt-enabled input and output streams - * - * + * @file + * Xslt-enabled input and output streams. + */ +/* * Authors: * Bob Jamison <ishmalius@gmail.com> * |
