pike.git / lib / modules / Standards.pmod / IIM.pmod

version» Context lines:

pike.git/lib/modules/Standards.pmod/IIM.pmod:1:   // Extracts IPTC Information Interchange Model data (aka "IPTC   // headers") from JPEG files created with PhotoShop.   //   // http://www.iptc.org/IIM/   // - // $Id: IIM.pmod,v 1.2 2006/09/11 16:19:44 grubba Exp $ + // $Id: IIM.pmod,v 1.3 2006/09/11 16:56:05 grubba Exp $   //   // Anders Johansson & Henrik Grubbström      mapping(int:mapping(int:string)) fields =    ([    1: ([ // ENVELOPE RECORD    0: "model version",    5: "destinatino",    20: "file format",    22: "file format version",
pike.git/lib/modules/Standards.pmod/IIM.pmod:219:       if (marker == "%!") {    int bytes = -1;    // Note: We use the split iterator by hand to make sure '\r' is    // valid as a line terminator.    foreach(String.SplitIterator(marker, (<'\r','\n'>), 1,    fd->read_function(8192));    int lineno; string line) {    if (line[0] != '%') continue;    if (bytes < 0) sscanf(line, "%%BeginPhotoshop: %d", bytes); -  else if (has_prefix(line, "% ")) { +  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    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 (has_prefix(line, "%EndPhotoshop")) { -  break; +     } -  } +     } else if (marker == "\xff\xd8") {    do {    string app = fd->read(2);    if (sizeof(app) != 2)    break;    string length_s = fd->read(2);    int length;    if (sizeof(length_s) == 2)    length = short_value(length_s);    //werror ("length: %O\n", short_value(length_s));