FDBLibTLS/FDBLibTLSPolicy.cpp
// Does not handle "raw" form (e.g. #28C4D1), only escaped text
Does not handle "raw" form , only escaped text
Does not handle " raw " form only escaped text
static std::string de4514(std::string const& input, int start, int& out_end) {
	std::string output;
	if(input[start] == '#' || input[start] == ' ') {
		out_end = start;
		return output;
	}
	int space_count = 0;
	for(int p = start; p < input.size();) {
		switch(input[p]) {
		case '\\': 
			if(p == input.size() - 1) {
				out_end = p;
				goto FIN;
			}
			switch(input[p+1]) {
			case ' ':
			case '"':
			case '#':
			case '+':
			case ',':
			case ';':
			case '<':
			case '=':
			case '>':
			case '\\':
				output += input[p+1];
				p += 2;
				space_count = 0;
				continue;
			default:
				if(p == input.size() - 2) {
					out_end = p;
					goto FIN;
				}
				try {
					output += hexValue(input[p+1]) * 16 + hexValue(input[p+2]);
					p += 3;
					space_count = 0;
					continue;
				} catch( ... ) {
					out_end = p;
					goto FIN;
				}
			}
		case '"':
		case '+':
		case ',':
		case ';':
		case '<':
		case '>':
		case 0:
			out_end = p;
			goto FIN;
		default:
			output += input[p];
			if(input[p] == ' ')
				space_count++;
			else
				space_count = 0;
			p++;
		}
	}
	out_end = input.size();
 FIN:
	out_end -= space_count;
	output.resize(output.size() - space_count);
	return output;
}
static std :: string de4514 ( std :: string const & input , int start , int & out_end ) { std :: string output ; if ( input [ start ] == ' ' || input [ start ] == ' ' ) { out_end = start ; return output ; } int space_count = 0 ; for ( int p = start ; p < input . size ( ) ; ) { switch ( input [ p ] ) { case ' \\ ' : if ( p == input . size ( ) - 1 ) { out_end = p ; goto FIN ; } switch ( input [ p + 1 ] ) { case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : case ' \\ ' : output += input [ p + 1 ] ; p += 2 ; space_count = 0 ; continue ; default : if ( p == input . size ( ) - 2 ) { out_end = p ; goto FIN ; } try { output += hexValue ( input [ p + 1 ] ) * 16 + hexValue ( input [ p + 2 ] ) ; p += 3 ; space_count = 0 ; continue ; } catch ( ... ) { out_end = p ; goto FIN ; } } case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : case 0 : out_end = p ; goto FIN ; default : output += input [ p ] ; if ( input [ p ] == ' ' ) space_count ++ ; else space_count = 0 ; p ++ ; } } out_end = input . size ( ) ; FIN : out_end -= space_count ; output . resize ( output . size ( ) - space_count ) ; return output ; }
Does not handle "raw" form (e.g.
Does not handle " raw " form ( e . g .
// Handle escaped sequence // Backslash escaping nothing! // Backslash escaping pair of hex digits requires two characters // All of these must have been escaped // Character is what it is