systemMessage(MSG_BAD_ZIP_FILE, "Bad ZIP file %s", file);
systemMessage(MSG_BAD_ZIP_FILE, N_("Bad ZIP file %s"), file);
static u8 *utilLoadFromZip(const char *file,                           bool (*accept)(const char *),                           u8 *data,                           int &size){  char buffer[2048];    unzFile unz = unzOpen(file);      if(unz == NULL) {    systemMessage(MSG_CANNOT_OPEN_FILE, "Cannot open file %s", file);    return NULL;  }  int r = unzGoToFirstFile(unz);      if(r != UNZ_OK) {    unzClose(unz);    systemMessage(MSG_BAD_ZIP_FILE, "Bad ZIP file %s", file);    return NULL;  }      bool found = false;      unz_file_info info;    while(true) {    r = unzGetCurrentFileInfo(unz,                              &info,                              buffer,                              sizeof(buffer),                              NULL,                              0,                              NULL,                              0);          if(r != UNZ_OK) {      unzClose(unz);      systemMessage(MSG_BAD_ZIP_FILE,"Bad ZIP file %s", file);      return NULL;    }    if(accept(buffer)) {      found = true;      break;    }        r = unzGoToNextFile(unz);          if(r != UNZ_OK)      break;  }  if(!found) {    unzClose(unz);    systemMessage(MSG_NO_IMAGE_ON_ZIP,                  "No image found on ZIP file %s", file);    return NULL;  }    int fileSize = info.uncompressed_size;  if(size == 0)    size = fileSize;  r = unzOpenCurrentFile(unz);  if(r != UNZ_OK) {    unzClose(unz);    systemMessage(MSG_ERROR_OPENING_IMAGE,"Error opening image %s", buffer);    return NULL;  }  u8 *image = data;    if(image == NULL) {    image = (u8 *)malloc(utilGetSize(size));    if(image == NULL) {      unzCloseCurrentFile(unz);      unzClose(unz);      systemMessage(MSG_OUT_OF_MEMORY, "Failed to allocate memory for %s",                    "data");      return NULL;    }    size = fileSize;  }  int read = fileSize <= size ? fileSize : size;  r = unzReadCurrentFile(unz,                         image,                         read);  unzCloseCurrentFile(unz);  unzClose(unz);    if(r != (int)read) {    systemMessage(MSG_ERROR_READING_IMAGE,                  "Error reading image %s", buffer);    if(data == NULL)      free(image);    return NULL;  }  size = fileSize;  return image;}