static void readNSizResource()

in dmg/resources.c [411:466]


static void readNSizResource(NSizResource* data, char** location) {
  char* curLoc;
  char* tagBegin;
  char* tagEnd;
  char* dictEnd;
  size_t strLen;
  size_t dummy;
  
  curLoc = *location;
  
  data->isVolume = FALSE;
  data->sha1Digest = NULL;
  data->blockChecksum2 = 0;
  data->bytes = 0;
  data->modifyDate = 0;
  data->partitionNumber = 0;
  data->version = 0;
  data->volumeSignature = 0;
  
  curLoc = strstr(curLoc, "<dict>");
  dictEnd = strstr(curLoc, "</dict>"); /* hope there's not a dict type in this resource data! */
  while(curLoc != NULL && curLoc < dictEnd) {
    curLoc = strstr(curLoc, "<key>");
    if(!curLoc)
      break;
    curLoc += sizeof("<key>") - 1;
    
    tagEnd = strstr(curLoc, "</key>");
    
    strLen = (size_t)(tagEnd - curLoc);
    tagBegin = curLoc;
    curLoc = tagEnd + sizeof("</key>") - 1;
    
    if(strncmp(tagBegin, "SHA-1-digest", strLen) == 0) {
      data->sha1Digest = getXMLData(&curLoc, &dummy, 0, 0);
      /*flipEndian(data->sha1Digest, 4);*/
    } else if(strncmp(tagBegin, "block-checksum-2", strLen) == 0) {
      data->blockChecksum2 = getXMLInteger(&curLoc);
    } else if(strncmp(tagBegin, "bytes", strLen) == 0) {
      data->bytes = getXMLInteger(&curLoc);
    } else if(strncmp(tagBegin, "date", strLen) == 0) {
      data->modifyDate = getXMLInteger(&curLoc);
    } else if(strncmp(tagBegin, "part-num", strLen) == 0) {
      data->partitionNumber = getXMLInteger(&curLoc);
    } else if(strncmp(tagBegin, "version", strLen) == 0) {
      data->version = getXMLInteger(&curLoc);
    } else if(strncmp(tagBegin, "volume-signature", strLen) == 0) {
      data->volumeSignature = getXMLInteger(&curLoc);
      data->isVolume = TRUE;
    }
  }
  
  curLoc = dictEnd + sizeof("</dict>") - 1;
  
  *location = curLoc;
}