pike.git / src / modules / Image / font.c

version» Context lines:

pike.git/src/modules/Image/font.c:301:    unsigned INT32 cookie;    unsigned INT32 version;    unsigned INT32 chars;    unsigned INT32 height;    unsigned INT32 baseline;    unsigned INT32 o[1];    } *fh = NULL;   #ifdef HAVE_MMAP    size_t mmaped_size = 0;   #endif -  size_t size = 0; +  int size = 0;    char *filename = NULL;       get_all_args("load", args, ".%s", &filename);       if (!filename)    {    fh = (struct file_head *)image_default_font;    size = IMAGE_DEFAULT_FONT_SIZE;    } else {    int fd = -1;
pike.git/src/modules/Image/font.c:324: Inside #if defined(FONT_DEBUG)
   {   #ifdef FONT_DEBUG    fprintf(stderr,"FONT open '%s'\n",sp[-args].u.string->str);   #endif    fd = fd_open(filename,fd_RDONLY,0);    if (errno == EINTR) check_threads_etc();    } while(fd < 0 && errno == EINTR);       if (fd >= 0)    { -  size = (size_t) file_size(fd); +  size = file_size(fd);    if (size > 0)    {    THREADS_ALLOW();   #ifdef HAVE_MMAP    fh = (struct file_head *)    mmap(0, size, PROT_READ, MAP_SHARED, fd, 0);    if (fh != (struct file_head *)MAP_FAILED)    mmaped_size = size;    else    {
pike.git/src/modules/Image/font.c:424:   #endif    new_font->chars = num_chars;    new_font->xspacing_scale = 1.0;    new_font->yspacing_scale = 1.0;    new_font->justification = J_LEFT;    new_font->height=ntohl(fh->height);    new_font->baseline=ntohl(fh->baseline);       for (i=0; i<num_chars; i++)    { -  if (i*sizeof(INT32)<size -  && ntohl(fh->o[i])<size +  if (i*sizeof(INT32)<(size_t)size +  && ntohl(fh->o[i])<(size_t)size    && ! ( ntohl(fh->o[i]) % 4) ) /* must be aligned */    {    ch = (struct char_head*)    (((char *)(fh)) + ntohl(fh->o[i]));    new_font->charinfo[i].width = ntohl(ch->width);    new_font->charinfo[i].spacing = ntohl(ch->spacing);    new_font->charinfo[i].pixels = ch->data;    }    else /* illegal <tm> offset or illegal align */    {