diff --git a/tiny_gltf.h b/tiny_gltf.h index a2c2018..82a2e6a 100644 --- a/tiny_gltf.h +++ b/tiny_gltf.h @@ -253,7 +253,6 @@ bool DecodeDataURI(std::vector *out, std::string &mime_type, #ifdef __clang__ #pragma clang diagnostic push // Suppress warning for : static Value null_value -// https://stackoverflow.com/questions/15708411/how-to-deal-with-global-constructor-warning-in-clang #pragma clang diagnostic ignored "-Wexit-time-destructors" #pragma clang diagnostic ignored "-Wpadded" #endif @@ -2191,47 +2190,35 @@ std::string base64_decode(std::string const &encoded_string) { // TODO(syoyo): Use uriparser https://uriparser.github.io/ for stricter Uri // decoding? // -// https://stackoverflow.com/questions/18307429/encode-decode-url-in-c +// Uri Decoding from DLIB // http://dlib.net/dlib/server/server_http.cpp.html - -// --- dlib beign ------------------------------------------------------------ +// --- dlib begin ------------------------------------------------------------ // Copyright (C) 2003 Davis E. King (davis@dlib.net) -// License: Boost Software License See LICENSE.txt for the full license. +// License: Boost Software License +// Boost Software License - Version 1.0 - August 17th, 2003 +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// namespace dlib { -#if 0 - inline unsigned char to_hex( unsigned char x ) - { - return x + (x > 9 ? ('A'-10) : '0'); - } - - const std::string urlencode( const std::string& s ) - { - std::ostringstream os; - - for ( std::string::const_iterator ci = s.begin(); ci != s.end(); ++ci ) - { - if ( (*ci >= 'a' && *ci <= 'z') || - (*ci >= 'A' && *ci <= 'Z') || - (*ci >= '0' && *ci <= '9') ) - { // allowed - os << *ci; - } - else if ( *ci == ' ') - { - os << '+'; - } - else - { - os << '%' << to_hex(static_cast(*ci >> 4)) << to_hex(static_cast(*ci % 16)); - } - } - - return os.str(); - } -#endif - inline unsigned char from_hex(unsigned char ch) { if (ch <= '9' && ch >= '0') ch -= '0';