Пример #1
0
void AnsiTerminalLoggerSink::log(LogMessage const& message) {
    MutexLock l(_mutex);

    StringLiteral const WhenColorStart = BlueColorStart;
    StringLiteral const ThreadNameColorStart = MagentaColorStart;
    StringLiteral const AuthorColorStart = GreenColorStart;
    StringLiteral const LogLevelColorStart = LogLevelColorMapper()(message.level);

    printf(
        "%s[%s]%s %s{%s}%s %s[%s]%s %s[%s]%s %s%s%s\n",
        WhenColorStart.c_str(),
        to_string(message.when).c_str(),
        AttributeReset.c_str(),
        ThreadNameColorStart.c_str(),
        message.thread->c_str(),
        AttributeReset.c_str(),
        AuthorColorStart.c_str(),
        message.author.c_str(),
        AttributeReset.c_str(),
        LogLevelColorStart.c_str(),
        message.level.to_string().c_str(),
        AttributeReset.c_str(),
        LogLevelColorStart.c_str(),
        message.message.c_str(),
        AttributeReset.c_str());
}
Пример #2
0
    static void read_and_verify_archive_file_signature(fstream& fs)
    {
        static constexpr StringLiteral FILE_START = "!<arch>\n";
        static constexpr size_t FILE_START_SIZE = 8;

        fs.seekg(std::fstream::beg);

        char file_start[FILE_START_SIZE];
        fs.read(file_start, FILE_START_SIZE);
        verify_equal_strings(VCPKG_LINE_INFO, FILE_START.c_str(), file_start, FILE_START_SIZE, "LIB FILE_START");
    }
Пример #3
0
    static void read_and_verify_pe_signature(fstream& fs)
    {
        static constexpr size_t OFFSET_TO_PE_SIGNATURE_OFFSET = 0x3c;

        static constexpr StringLiteral PE_SIGNATURE = "PE\0\0";
        static constexpr size_t PE_SIGNATURE_SIZE = 4;

        fs.seekg(OFFSET_TO_PE_SIGNATURE_OFFSET, ios_base::beg);
        const auto offset_to_pe_signature = read_value_from_stream<int32_t>(fs);

        fs.seekg(offset_to_pe_signature);
        char signature[PE_SIGNATURE_SIZE];
        fs.read(signature, PE_SIGNATURE_SIZE);
        verify_equal_strings(VCPKG_LINE_INFO, PE_SIGNATURE.c_str(), signature, PE_SIGNATURE_SIZE, "PE_SIGNATURE");
        fs.seekg(offset_to_pe_signature + PE_SIGNATURE_SIZE, ios_base::beg);
    }
Пример #4
0
        static ArchiveMemberHeader read(fstream& fs)
        {
            static constexpr size_t HEADER_END_OFFSET = 58;
            static constexpr StringLiteral HEADER_END = "`\n";
            static constexpr size_t HEADER_END_SIZE = 2;

            ArchiveMemberHeader ret;
            ret.data.resize(HEADER_SIZE);
            fs.read(&ret.data[0], HEADER_SIZE);

            if (ret.data[0] != '\0') // Due to freeglut. github issue #223
            {
                const std::string header_end = ret.data.substr(HEADER_END_OFFSET, HEADER_END_SIZE);
                verify_equal_strings(
                    VCPKG_LINE_INFO, HEADER_END.c_str(), header_end.c_str(), HEADER_END_SIZE, "LIB HEADER_END");
            }

            return ret;
        }