diff options
Diffstat (limited to 'core/io')
-rw-r--r-- | core/io/LICENSE-InfoZip.txt | 60 | ||||
-rw-r--r-- | core/io/LICENSE-MiniZip.txt | 32 | ||||
-rw-r--r-- | core/io/file_access_memory.cpp | 2 | ||||
-rw-r--r-- | core/io/http_client.cpp | 4 | ||||
-rw-r--r-- | core/io/http_client.h | 2 | ||||
-rw-r--r-- | core/io/ioapi.c | 2 | ||||
-rw-r--r-- | core/io/ioapi.h | 2 | ||||
-rw-r--r-- | core/io/resource_loader.cpp | 7 | ||||
-rw-r--r-- | core/io/translation_loader_po.cpp | 25 | ||||
-rw-r--r-- | core/io/translation_loader_po.h | 4 | ||||
-rw-r--r-- | core/io/unzip.c | 2 | ||||
-rw-r--r-- | core/io/unzip.h | 2 | ||||
-rw-r--r-- | core/io/zip.c | 2 | ||||
-rw-r--r-- | core/io/zip.h | 2 |
14 files changed, 129 insertions, 19 deletions
diff --git a/core/io/LICENSE-InfoZip.txt b/core/io/LICENSE-InfoZip.txt new file mode 100644 index 0000000000..bcfe47e978 --- /dev/null +++ b/core/io/LICENSE-InfoZip.txt @@ -0,0 +1,60 @@ +This is version 2007-Mar-4 of the Info-ZIP license. +The definitive version of this document should be available at +ftp://ftp.info-zip.org/pub/infozip/license.html indefinitely and +a copy at http://www.info-zip.org/pub/infozip/license.html. + + +Copyright (c) 1990-2007 Info-ZIP. All rights reserved. + +For the purposes of this copyright and license, "Info-ZIP" is defined as +the following set of individuals: + + Mark Adler, John Bush, Karl Davis, Harald Denker, Jean-Michel Dubois, + Jean-loup Gailly, Hunter Goatley, Ed Gordon, Ian Gorman, Chris Herborth, + Dirk Haase, Greg Hartwig, Robert Heath, Jonathan Hudson, Paul Kienitz, + David Kirschbaum, Johnny Lee, Onno van der Linden, Igor Mandrichenko, + Steve P. Miller, Sergio Monesi, Keith Owens, George Petrov, Greg Roelofs, + Kai Uwe Rommel, Steve Salisbury, Dave Smith, Steven M. Schweda, + Christian Spieler, Cosmin Truta, Antoine Verheijen, Paul von Behren, + Rich Wales, Mike White. + +This software is provided "as is," without warranty of any kind, express +or implied. In no event shall Info-ZIP or its contributors be held liable +for any direct, indirect, incidental, special or consequential damages +arising out of the use of or inability to use this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the above disclaimer and the following restrictions: + + 1. Redistributions of source code (in whole or in part) must retain + the above copyright notice, definition, disclaimer, and this list + of conditions. + + 2. Redistributions in binary form (compiled executables and libraries) + must reproduce the above copyright notice, definition, disclaimer, + and this list of conditions in documentation and/or other materials + provided with the distribution. The sole exception to this condition + is redistribution of a standard UnZipSFX binary (including SFXWiz) as + part of a self-extracting archive; that is permitted without inclusion + of this license, as long as the normal SFX banner has not been removed + from the binary or disabled. + + 3. Altered versions--including, but not limited to, ports to new operating + systems, existing ports with new graphical interfaces, versions with + modified or added functionality, and dynamic, shared, or static library + versions not from Info-ZIP--must be plainly marked as such and must not + be misrepresented as being the original source or, if binaries, + compiled from the original source. Such altered versions also must not + be misrepresented as being Info-ZIP releases--including, but not + limited to, labeling of the altered versions with the names "Info-ZIP" + (or any variation thereof, including, but not limited to, different + capitalizations), "Pocket UnZip," "WiZ" or "MacZip" without the + explicit permission of Info-ZIP. Such altered versions are further + prohibited from misrepresentative use of the Zip-Bugs or Info-ZIP + e-mail addresses or the Info-ZIP URL(s), such as to imply Info-ZIP + will provide support for the altered versions. + + 4. Info-ZIP retains the right to use the names "Info-ZIP," "Zip," "UnZip," + "UnZipSFX," "WiZ," "Pocket UnZip," "Pocket Zip," and "MacZip" for its + own source and binary releases. diff --git a/core/io/LICENSE-MiniZip.txt b/core/io/LICENSE-MiniZip.txt new file mode 100644 index 0000000000..0e8950f86f --- /dev/null +++ b/core/io/LICENSE-MiniZip.txt @@ -0,0 +1,32 @@ +Credits + + Gilles Vollant - Original MiniZip author + Even Rouault - ZIP64 unzip Support + Daniel Borca - BZip Compression method support in unzip + Mathias Svensson - ZIP64 zip support + Mathias Svensson - BZip Compression method support in zip + + This version has been modified for Godot Engine + + +License +---------------------------------------------------------------------------- + Condition of use and distribution are the same than zlib : + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + +---------------------------------------------------------------------------- diff --git a/core/io/file_access_memory.cpp b/core/io/file_access_memory.cpp index 2cc52a9e2d..7db3499505 100644 --- a/core/io/file_access_memory.cpp +++ b/core/io/file_access_memory.cpp @@ -135,7 +135,7 @@ size_t FileAccessMemory::get_len() const { bool FileAccessMemory::eof_reached() const { - return pos >= length; + return pos > length; } uint8_t FileAccessMemory::get_8() const { diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp index 680e0ef7f9..3520680118 100644 --- a/core/io/http_client.cpp +++ b/core/io/http_client.cpp @@ -116,7 +116,7 @@ Error HTTPClient::request_raw( Method p_method, const String& p_url, const Vecto } request+="\r\n"; CharString cs=request.utf8(); - + DVector<uint8_t> data; //Maybe this goes faster somehow? @@ -639,7 +639,7 @@ void HTTPClient::_bind_methods() { ObjectTypeDB::bind_method(_MD("connect:Error","host","port","use_ssl","verify_host"),&HTTPClient::connect,DEFVAL(false),DEFVAL(true)); ObjectTypeDB::bind_method(_MD("set_connection","connection:StreamPeer"),&HTTPClient::set_connection); ObjectTypeDB::bind_method(_MD("get_connection:StreamPeer"),&HTTPClient::get_connection); - ObjectTypeDB::bind_method(_MD("request_raw","method","url","headers","body"),&HTTPClient::request_raw,DEFVAL(String())); + ObjectTypeDB::bind_method(_MD("request_raw","method","url","headers","body"),&HTTPClient::request_raw); ObjectTypeDB::bind_method(_MD("request","method","url","headers","body"),&HTTPClient::request,DEFVAL(String())); ObjectTypeDB::bind_method(_MD("send_body_text","body"),&HTTPClient::send_body_text); ObjectTypeDB::bind_method(_MD("send_body_data","body"),&HTTPClient::send_body_data); diff --git a/core/io/http_client.h b/core/io/http_client.h index a9cfb1ed73..ceb0273a7d 100644 --- a/core/io/http_client.h +++ b/core/io/http_client.h @@ -40,7 +40,7 @@ class HTTPClient : public Reference { OBJ_TYPE(HTTPClient,Reference); public: - enum RespondeCode { + enum ResponseCode { // 1xx informational RESPONSE_CONTINUE = 100, diff --git a/core/io/ioapi.c b/core/io/ioapi.c index 8818199f0b..d6063a5fe6 100644 --- a/core/io/ioapi.c +++ b/core/io/ioapi.c @@ -6,7 +6,7 @@ Modifications for Zip64 support Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) - For more info read MiniZip_info.txt + For more info read LICENSE-MiniZip.txt */ diff --git a/core/io/ioapi.h b/core/io/ioapi.h index 24bf612617..cb6cb7e766 100644 --- a/core/io/ioapi.h +++ b/core/io/ioapi.h @@ -5,7 +5,7 @@ Modifications for Zip64 support Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) - For more info read MiniZip_info.txt + For more info read LICENSE-MiniZip.txt Changes diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp index abb1082256..1bb80e74eb 100644 --- a/core/io/resource_loader.cpp +++ b/core/io/resource_loader.cpp @@ -243,6 +243,7 @@ Ref<ResourceImportMetadata> ResourceLoader::load_import_metadata(const String &p break; } + return ret; } @@ -318,7 +319,11 @@ Ref<ResourceInteractiveLoader> ResourceLoader::load_interactive(const String &p_ if (OS::get_singleton()->is_stdout_verbose()) print_line("load resource: "+local_path+" (cached)"); - return RES( ResourceCache::get(local_path ) ); + Ref<Resource> res_cached = ResourceCache::get(local_path); + Ref<ResourceInteractiveLoaderDefault> ril = Ref<ResourceInteractiveLoaderDefault>(memnew(ResourceInteractiveLoaderDefault)); + + ril->resource = res_cached; + return ril; } if (OS::get_singleton()->is_stdout_verbose()) diff --git a/core/io/translation_loader_po.cpp b/core/io/translation_loader_po.cpp index fe101a8676..4ddb276a27 100644 --- a/core/io/translation_loader_po.cpp +++ b/core/io/translation_loader_po.cpp @@ -30,13 +30,8 @@ #include "os/file_access.h" #include "translation.h" -RES TranslationLoaderPO::load(const String &p_path, const String& p_original_path, Error *r_error) { - if (r_error) - *r_error=ERR_CANT_OPEN; - - FileAccess *f=FileAccess::open(p_path,FileAccess::READ); - ERR_FAIL_COND_V(!f,RES()); +RES TranslationLoaderPO::load_translation(FileAccess *f, Error *r_error, const String &p_path) { String l = f->get_line(); @@ -52,6 +47,8 @@ RES TranslationLoaderPO::load(const String &p_path, const String& p_original_pat String msg_id; String msg_str; String config; + int msg_line=0; + if (r_error) *r_error=ERR_FILE_CORRUPT; @@ -87,7 +84,7 @@ RES TranslationLoaderPO::load(const String &p_path, const String& p_original_pat if (status==STATUS_READING_ID) { memdelete(f); - ERR_EXPLAIN(p_path+":"+itos(line)+" nexpected 'msgid', was expecting 'msgstr' while parsing: "); + ERR_EXPLAIN(p_path+":"+itos(line)+" Unexpected 'msgid', was expecting 'msgstr' while parsing: "); ERR_FAIL_V(RES()); } @@ -100,6 +97,7 @@ RES TranslationLoaderPO::load(const String &p_path, const String& p_original_pat status=STATUS_READING_ID; msg_id=""; msg_str=""; + msg_line=line; } if (l.begins_with("msgstr")) { @@ -113,6 +111,7 @@ RES TranslationLoaderPO::load(const String &p_path, const String& p_original_pat l=l.substr(6,l.length()).strip_edges(); status=STATUS_READING_STRING; + msg_line=line; } if (l=="" || l.begins_with("#")) { @@ -183,6 +182,18 @@ RES TranslationLoaderPO::load(const String &p_path, const String& p_original_pat *r_error=OK; return translation; +} + +RES TranslationLoaderPO::load(const String &p_path, const String& p_original_path, Error *r_error) { + + if (r_error) + *r_error=ERR_CANT_OPEN; + + FileAccess *f=FileAccess::open(p_path,FileAccess::READ); + ERR_FAIL_COND_V(!f,RES()); + + + return load_translation(f,r_error); } diff --git a/core/io/translation_loader_po.h b/core/io/translation_loader_po.h index a569674d80..b0c4e42682 100644 --- a/core/io/translation_loader_po.h +++ b/core/io/translation_loader_po.h @@ -30,10 +30,12 @@ #define TRANSLATION_LOADER_PO_H #include "io/resource_loader.h" - +#include "translation.h" +#include "os/file_access.h" class TranslationLoaderPO : public ResourceFormatLoader { public: + static RES load_translation(FileAccess *f, Error *r_error,const String& p_path=String()); virtual RES load(const String &p_path,const String& p_original_path="",Error *r_error=NULL); virtual void get_recognized_extensions(List<String> *p_extensions) const; virtual bool handles_type(const String& p_type) const; diff --git a/core/io/unzip.c b/core/io/unzip.c index b438021ad7..78672677f9 100644 --- a/core/io/unzip.c +++ b/core/io/unzip.c @@ -10,7 +10,7 @@ Modifications for Zip64 support on both zip and unzip Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) - For more info read MiniZip_info.txt + For more info read LICENSE-MiniZip.txt ------------------------------------------------------------------------------------ diff --git a/core/io/unzip.h b/core/io/unzip.h index cb3d239eac..f67c3b2fa8 100644 --- a/core/io/unzip.h +++ b/core/io/unzip.h @@ -10,7 +10,7 @@ Modifications for Zip64 support on both zip and unzip Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) - For more info read MiniZip_info.txt + For more info read LICENSE-MiniZip.txt --------------------------------------------------------------------------------- diff --git a/core/io/zip.c b/core/io/zip.c index c4ab93ab81..44c79195d9 100644 --- a/core/io/zip.c +++ b/core/io/zip.c @@ -7,7 +7,7 @@ Modifications for Zip64 support Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) - For more info read MiniZip_info.txt + For more info read LICENSE-MiniZip.txt Changes Oct-2009 - Mathias Svensson - Remove old C style function prototypes diff --git a/core/io/zip.h b/core/io/zip.h index 85f93568c9..37478b34c0 100644 --- a/core/io/zip.h +++ b/core/io/zip.h @@ -6,7 +6,7 @@ Modifications for Zip64 support Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) - For more info read MiniZip_info.txt + For more info read LICENSE-MiniZip.txt --------------------------------------------------------------------------- |