diff options
| author | Stefano Facchini <stefano.facchini@gmail.com> | 2017-09-27 18:43:31 +0000 |
|---|---|---|
| committer | Stefano Facchini <stefano.facchini@gmail.com> | 2017-10-19 17:22:34 +0000 |
| commit | 14c4dc0bb1ccc58d8dc97230342a61c927a9addb (patch) | |
| tree | 7058d3eb2b4e9eed10bff0c35a6e3717a90e3484 /src/xml/repr-io.cpp | |
| parent | Delete dead code (diff) | |
| download | inkscape-14c4dc0bb1ccc58d8dc97230342a61c927a9addb.tar.gz inkscape-14c4dc0bb1ccc58d8dc97230342a61c927a9addb.zip | |
Remove a useless conditional
Since "doc" is initialized to 0, the test is always true...
Diffstat (limited to 'src/xml/repr-io.cpp')
| -rw-r--r-- | src/xml/repr-io.cpp | 43 |
1 files changed, 19 insertions, 24 deletions
diff --git a/src/xml/repr-io.cpp b/src/xml/repr-io.cpp index 7b02fe784..f4b86a140 100644 --- a/src/xml/repr-io.cpp +++ b/src/xml/repr-io.cpp @@ -323,14 +323,13 @@ int XmlSource::close() */ Document *sp_repr_read_file (const gchar * filename, const gchar *default_ns) { - // g_warning( "Reading file: %s", filename ); xmlDocPtr doc = 0; Document * rdoc = 0; xmlSubstituteEntitiesDefault(1); - g_return_val_if_fail (filename != NULL, NULL); - if (!Inkscape::IO::file_test( filename, G_FILE_TEST_EXISTS )) { + g_return_val_if_fail(filename != NULL, NULL); + if (!Inkscape::IO::file_test(filename, G_FILE_TEST_EXISTS)) { g_warning("Can't open file: %s (doesn't exist)", filename); return NULL; } @@ -343,36 +342,32 @@ Document *sp_repr_read_file (const gchar * filename, const gchar *default_ns) gsize bytesWritten = 0; GError* error = NULL; // TODO: need to replace with our own fopen and reading - gchar* localFilename = g_filename_from_utf8 ( filename, - -1, &bytesRead, &bytesWritten, &error); - g_return_val_if_fail( localFilename != NULL, NULL ); + gchar* localFilename = g_filename_from_utf8(filename, -1, &bytesRead, &bytesWritten, &error); + g_return_val_if_fail(localFilename != NULL, NULL); - Inkscape::IO::dump_fopen_call( filename, "N" ); + Inkscape::IO::dump_fopen_call(filename, "N"); - if ( !doc ) { - XmlSource src; + XmlSource src; - if ( (src.setFile(filename) == 0) ) { + if (src.setFile(filename) == 0) { + doc = src.readXml(); + rdoc = sp_repr_do_read(doc, default_ns); + // For some reason, failed ns loading results in this + // We try a system check version of load with NOENT for adobe + if (rdoc && strcmp(rdoc->root()->name(), "ns:svg") == 0) { + xmlFreeDoc(doc); + src.setFile(filename, true); doc = src.readXml(); - rdoc = sp_repr_do_read( doc, default_ns ); - // For some reason, failed ns loading results in this - // We try a system check version of load with NOENT for adobe - if(rdoc && strcmp(rdoc->root()->name(), "ns:svg") == 0) { - xmlFreeDoc( doc ); - src.setFile(filename, true); - doc = src.readXml(); - rdoc = sp_repr_do_read( doc, default_ns ); - } + rdoc = sp_repr_do_read(doc, default_ns); } } - - if ( doc ) { - xmlFreeDoc( doc ); + if (doc) { + xmlFreeDoc(doc); } - if ( localFilename ) { - g_free( localFilename ); + if (localFilename) { + g_free(localFilename); } return rdoc; |
