Branch: Tag:

2015-12-01

2015-12-01 01:59:36 by Martin Nilsson <nilsson@fastmail.com>

Let hex2string deal with non-hex characters.

300:    if (bytes < 0) sscanf(line, "%%BeginPhotoshop:%*[ ]%d", bytes);    else if (has_prefix(line, "%EndPhotoshop")) {    break; -  } else if (has_prefix(line, "% ")) { - #if constant(String.hex2string) -  photoshop_data += String.hex2string(line[2..]); - #else -  photoshop_data += Crypto.hex_to_string(line[2..]); - #endif +  } +  // Let hex2string swollow "%" and possible " ". +  photoshop_data += String.hex2string(line);    if (sizeof(photoshop_data) >= bytes) break; -  } else { - #if constant(String.hex2string) -  photoshop_data += String.hex2string(line[1..]); - #else -  photoshop_data += Crypto.hex_to_string(line[1..]); - #endif -  if (sizeof(photoshop_data) >= bytes) break; +     } -  } +     } else if (marker == "\xff\xd8") {    do {    string app = fd->read(2);