Copyright 2010, SIL International All rights reserved.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should also have received a copy of the GNU Lesser General Public License along with this library in the file named "LICENSE". If not, write to the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA or visit their web page on the internet at http://www.fsf.org/licenses/lgpl.html.
Alternatively, the contents of this file may be used under the terms of the Mozilla Public License (http://mozilla.org/MPL) or the GNU General Public License, as published by the Free Software Foundation, either version 2 of the License or (at your option) any later version.
*/ #include <cstring> #include"graphite2/Segment.h" #include"inc/CmapCache.h" #include"inc/debug.h" #include"inc/Decompressor.h" #include"inc/Endian.h" #include"inc/Face.h" #include"inc/FileFace.h" #include"inc/GlyphFace.h" #include"inc/json.h" #include"inc/Segment.h" #include"inc/NameTable.h" #include"inc/Error.h"
const byte * p = _p; const uint32 version = be::read<uint32>(p); // Table version number.
// The scheme is in the top 5 bits of the 1st uint32. const uint32 hdr = be::read<uint32>(p); switch(compression(hdr >> 27))
{ case NONE: return e;
case LZ4:
{
uncompressed_size = hdr & 0x07ffffff;
uncompressed_table = gralloc<byte>(uncompressed_size); if (!e.test(!uncompressed_table || uncompressed_size < 4, E_OUTOFMEM))
{
memset(uncompressed_table, 0, 4); // make sure version number is initialised // coverity[forward_null : FALSE] - uncompressed_table has been checked so can't be null // coverity[checked_return : FALSE] - we test e later
e.test(lz4::decompress(p, _sz - 2*sizeof(uint32), uncompressed_table, uncompressed_size) != signed(uncompressed_size), E_SHRINKERFAILED);
} break;
}
default:
e.error(E_BADSCHEME);
};
// Check the uncompressed version number against the original. if (!e) // coverity[forward_null : FALSE] - uncompressed_table has already been tested so can't be null // coverity[checked_return : FALSE] - we test e later
e.test(be::peek<uint32>(uncompressed_table) != version, E_SHRINKERFAILED);
// Tell the provider to release the compressed form since were replacing // it anyway.
release();
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.