bool write_bits_from_seq<WholeNumSequence>(
		BitSeq_t& bit_seq,
		const std::vector<uintmax_t>& seq
	)
{
	RhoTracker tracker;
	for (auto iter = seq.begin(); iter < seq.end(); ++iter) {
		if (
				!has_static_encoding(*iter, tracker.should_use_SBS1())
				|| !write_bits_from_str(bit_seq, encoding_str(*iter, tracker.should_use_SBS1()))
			)
			return false;
		tracker.push_back(*iter);
	}
	return true;
}
Example #2
0
static void open_result_multipart(FILE *fp, int rc,
                                  const char *new_boundary,
                                  const char *err_str,
                                  const char *err_charset)
{
    fprintf(fp, "Content-Type: multipart/x-mimegpg; xpgpstatus=%d;"
            " boundary=\"%s\"\n"
            "\nThis is a mimegpg-processed message.  If you see this text, it means\n"
            "that your E-mail software does not support MIME-formatted messages.\n\n"
            "--%s\n"
            "Content-Type: text/x-gpg-output; charset=%s\n"
            "Content-Transfer-Encoding: %s\n\n%s",
            rc, new_boundary, new_boundary,
            err_charset,
            encoding_str(err_str),
            err_str);
}
bool check_bits_against_seq<WholeNumSequence>(
	BitSeq_t& bit_seq, const std::vector<uintmax_t>& seq)
{
	RhoTracker tracker;
	std::string bits_str, bits_str_expected;

	for (auto iter = seq.begin(); iter < seq.end(); ++iter) {
		bits_str.clear();
		bits_str_expected = encoding_str(*iter, tracker.should_use_SBS1());
		if (
				!read_bits_to_str(bit_seq, bits_str, bits_str_expected.length())
				|| bits_str != bits_str_expected
			) 
			return false;
		tracker.push_back(*iter);
	}
	return true;
}