~ubuntu-branches/ubuntu/raring/libxfont/raring-security

« back to all changes in this revision

Viewing changes to src/bitmap/snfread.c

  • Committer: Package Import Robot
  • Author(s): Cyril Brulebois, Cyril Brulebois, Julien Cristau
  • Date: 2012-03-04 09:24:59 UTC
  • mfrom: (1.1.15)
  • Revision ID: package-import@ubuntu.com-20120304092459-cbu7e0ujz24lslpt
Tags: 1:1.4.5-1
[ Cyril Brulebois ]
* New upstream release.
* Switch to dh:
  - Bump debhelper build-dep and compat.
  - Rewrite debian/rules, using autoreconf and quilt sequences.
  - Adjust build dependencies accordingly.
  - Use build-main and build-udeb as build directories.
  - Adjust .install accordingly.
* Remove xsfbs accordingly.
* Add support for hardened build flags through dpkg-buildflags, based
  on a patch by Moritz Muehlenhoff, thanks! (Closes: #654154).

[ Julien Cristau ]
* Remove David Nusinow from Uploaders.

Show diffs side-by-side

added added

removed removed

Lines of Context:
60
60
 
61
61
#include <stdarg.h>
62
62
 
63
 
static void
 
63
static void _X_ATTRIBUTE_PRINTF(1, 2)
64
64
snfError(const char* message, ...)
65
65
{
66
66
    va_list args;
71
71
    vfprintf(stderr, message, args);
72
72
    va_end(args);
73
73
}
74
 
              
 
74
 
75
75
static void snfUnloadFont(FontPtr pFont);
76
76
 
77
77
static int
211
211
}
212
212
 
213
213
int
214
 
snfReadFont(FontPtr pFont, FontFilePtr file, 
 
214
snfReadFont(FontPtr pFont, FontFilePtr file,
215
215
            int bit, int byte, int glyph, int scan)
216
216
{
217
217
    snfFontInfoRec fi;
239
239
    /*
240
240
     * we'll allocate one chunk of memory and split it among the various parts
241
241
     * of the font:
242
 
     * 
 
242
     *
243
243
     * BitmapFontRec CharInfoRec's Glyphs Encoding DIX Properties Ink CharInfoRec's
244
244
     *
245
245
     * If the glyphpad is not the same as the font file, then the glyphs
253
253
    metrics_off = bytestoalloc;
254
254
    bytestoalloc += num_chars * sizeof(CharInfoRec);    /* metrics */
255
255
    encoding_off = bytestoalloc;
256
 
    bytestoalloc += NUM_SEGMENTS(num_chars) * sizeof(CharInfoPtr**);    
 
256
    bytestoalloc += NUM_SEGMENTS(num_chars) * sizeof(CharInfoPtr**);
257
257
                                                /* encoding */
258
258
    props_off = bytestoalloc;
259
259
    bytestoalloc += fi.nProps * sizeof(FontPropRec);    /* props */
299
299
     */
300
300
 
301
301
    ret = Successful;
302
 
    memset(bitmapFont->encoding, 0, 
 
302
    memset(bitmapFont->encoding, 0,
303
303
           NUM_SEGMENTS(num_chars)*sizeof(CharInfoPtr*));
304
304
    for (i = 0; ret == Successful && i < num_chars; i++) {
305
305
        ret = snfReadCharInfo(file, &bitmapFont->metrics[i], bitmaps);
454
454
 
455
455
    pFontInfo->props = malloc(fi.nProps * sizeof(FontPropRec));
456
456
    if (!pFontInfo->props) {
457
 
      snfError("snfReadFontInfo(): Couldn't allocate props (%d*%d)\n", fi.nProps, sizeof(FontPropRec));
 
457
        snfError("snfReadFontInfo(): Couldn't allocate props (%d*%d)\n",
 
458
                 fi.nProps, (int) sizeof(FontPropRec));
458
459
        return AllocError;
459
460
    }
460
461
    pFontInfo->isStringProp = malloc(fi.nProps * sizeof(char));
461
462
    if (!pFontInfo->isStringProp) {
462
 
      snfError("snfReadFontInfo(): Couldn't allocate isStringProp (%d*%d)\n", fi.nProps, sizeof(char));
 
463
        snfError("snfReadFontInfo(): Couldn't allocate isStringProp (%d*%d)\n",
 
464
                 fi.nProps, (int) sizeof(char));
463
465
        free(pFontInfo->props);
464
466
        return AllocError;
465
467
    }