Revision 7ccfb2eb block-vmdk.c

b/block-vmdk.c
119 119
    BDRVVmdkState *s = bs->opaque;
120 120
    char desc[DESC_SIZE];
121 121
    uint32_t cid;
122
    char *p_name, *cid_str;
122
    const char *p_name, *cid_str;
123 123
    size_t cid_str_size;
124 124

  
125 125
    /* the descriptor offset = 0x200 */
......
193 193
    uint32_t gde_entries, gd_size;
194 194
    int64_t gd_offset, rgd_offset, capacity, gt_size;
195 195
    char p_desc[DESC_SIZE], s_desc[DESC_SIZE], hdr[HEADER_SIZE];
196
    char *desc_template =
196
    static const char desc_template[] =
197 197
    "# Disk DescriptorFile\n"
198 198
    "version=1\n"
199 199
    "CID=%x\n"
......
202 202
    "parentFileNameHint=\"%s\"\n"
203 203
    "\n"
204 204
    "# Extent description\n"
205
    "RW %lu SPARSE \"%s\"\n"
205
    "RW %u SPARSE \"%s\"\n"
206 206
    "\n"
207 207
    "# The Disk Data Base \n"
208 208
    "#DDB\n"
......
702 702
    int fd, i;
703 703
    VMDK4Header header;
704 704
    uint32_t tmp, magic, grains, gd_size, gt_size, gt_count;
705
    char *desc_template =
705
    static const char desc_template[] =
706 706
        "# Disk DescriptorFile\n"
707 707
        "version=1\n"
708 708
        "CID=%x\n"
......
791 791
        real_filename = temp_str + 1;
792 792
    if ((temp_str = strrchr(real_filename, ':')) != NULL)
793 793
        real_filename = temp_str + 1;
794
    snprintf(desc, sizeof(desc), desc_template, time(NULL), (unsigned long)total_size,
795
             real_filename, (flags & BLOCK_FLAG_COMPAT6 ? 6 : 4), total_size / (63 * 16));
794
    snprintf(desc, sizeof(desc), desc_template, (unsigned int)time(NULL),
795
             (unsigned long)total_size, real_filename,
796
             (flags & BLOCK_FLAG_COMPAT6 ? 6 : 4), total_size / (63 * 16));
796 797

  
797 798
    /* write the descriptor */
798 799
    lseek(fd, le64_to_cpu(header.desc_offset) << 9, SEEK_SET);

Also available in: Unified diff