Bug 1863 - local variable used before set in PsPolyGlyphBlt()
Summary: local variable used before set in PsPolyGlyphBlt()
Status: RESOLVED WONTFIX
Alias: None
Product: xprint
Classification: Unclassified
Component: Server: DDX: PostScript (show other bugs)
Version: unspecified
Hardware: x86 (IA32) Linux (All)
: high normal
Assignee: Roland Mainz
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-11-15 03:52 UTC by dcb314
Modified: 2011-09-13 14:10 UTC (History)
3 users (show)

See Also:
i915 platform:
i915 features:


Attachments

Description dcb314 2004-11-15 03:52:23 UTC
Hello there,

I just tried to compile X11R6.8.1 with the most excellent Intel C
8.1 compiler, on a Linux Fedora Core 3 box. The compiler said

PsText.c(527): remark #592: variable "pPixmap" is used before its value is set

The source code is in file

programs/Xserver/Xprint/ps/PsText.c

The source code is

        (*pDrawable->pScreen->DestroyPixmap)(pPixmap);

Suggest init pPixmap before first use.
Comment 1 Roland Mainz 2004-11-24 14:36:46 UTC
Looking at the code:
-- snip --
void
PsPolyGlyphBlt(
  DrawablePtr   pDrawable,
  GCPtr         pGC,
  int           x,
  int           y,
  unsigned int  nGlyphs,
  CharInfoPtr  *pCharInfo,
  pointer       pGlyphBase)
{
    int width, height;
    PixmapPtr pPixmap;
    int nbyLine;                        /* bytes per line of padded pixmap */
    FontPtr pfont;
    GCPtr pGCtmp;
    register int i;
    register int j;
    unsigned char *pbits;               /* buffer for PutImage */
    register unsigned char *pb;         /* temp pointer into buffer */
    register CharInfoPtr pci;           /* currect char info */
    register unsigned char *pglyph;     /* pointer bits in glyph */
    int gWidth, gHeight;                /* width and height of glyph */
    register int nbyGlyphWidth;         /* bytes per scanline of glyph */
    int nbyPadGlyph;                    /* server padded line of glyph */
    int w, tmpx;
    XID gcvals[3];

    pfont = pGC->font;
    width = FONTMAXBOUNDS(pfont,rightSideBearing) -
            FONTMINBOUNDS(pfont,leftSideBearing);
    height = FONTMAXBOUNDS(pfont,ascent) +
             FONTMAXBOUNDS(pfont,descent);

    if ((width == 0) || (height == 0) )
        return;
    {
        int i;
        w = 0;
        for (i=0; i < nGlyphs; i++) w += pCharInfo[i]->metrics.characterWidth;
    }
    pGCtmp = GetScratchGC(1, pDrawable->pScreen);
    if (!pGCtmp)
    {
        (*pDrawable->pScreen->DestroyPixmap)(pPixmap);
        return;
    }
[snip]
-- snip --

It seems that the whole statement
|(*pDrawable->pScreen->DestroyPixmap)(pPixmap);| can be removed (same applies to
the |PsDestroyPixmap(pPixmap);| statement later in the code) ...

Jay:
Just curious: For what purpose was the |pPixmap| being used ?
Comment 2 Corbin Simpson 2011-09-13 14:10:35 UTC
Closing WONTFIX because nobody cares about Xprint. Reopen if you plan to address this bug.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.