~ubuntu-branches/ubuntu/lucid/libx11/lucid

« back to all changes in this revision

Viewing changes to src/Text.c

  • Committer: Bazaar Package Importer
  • Author(s): Timo Aaltonen
  • Date: 2009-01-17 16:34:54 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20090117163454-gaey3cd32xyavueo
Tags: 2:1.1.99.2-1build1
Fakesync with Debian, all previous Ubuntu changes are included
in the new upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
    int y,
41
41
    _Xconst char *string,
42
42
    int length)
43
 
{   
 
43
{
44
44
    int Datalength = 0;
45
45
    register xPolyText8Req *req;
46
46
 
62
62
    req->length += (Datalength + 3)>>2;  /* convert to number of 32-bit words */
63
63
 
64
64
 
65
 
    /* 
 
65
    /*
66
66
     * If the entire request does not fit into the remaining space in the
67
67
     * buffer, flush the buffer first.   If the request does fit into the
68
68
     * empty buffer, then we won't have to flush it at the end to keep
69
 
     * the buffer 32-bit aligned. 
 
69
     * the buffer 32-bit aligned.
70
70
     */
71
71
 
72
72
    if (dpy->bufptr + Datalength > dpy->bufmax)
94
94
            PartialNChars = PartialNChars - 254;
95
95
            CharacterOffset += 254;
96
96
        }
97
 
            
 
97
 
98
98
        if (PartialNChars)
99
99
        {
100
100
            nbytes = PartialNChars + SIZEOF(xTextElt);
101
 
            BufAlloc (unsigned char *, tbuf, nbytes); 
 
101
            BufAlloc (unsigned char *, tbuf, nbytes);
102
102
/*    elt->delta = 0;
103
103
 *    elt->len = PartialNChars;
104
104
 */
114
114
 
115
115
    if (Datalength &= 3) {
116
116
        char *pad;
117
 
        /* 
 
117
        /*
118
118
         * BufAlloc is a macro that uses its last argument more than
119
 
         * once, otherwise I'd write "BufAlloc (char *, pad, 4-length)" 
 
119
         * once, otherwise I'd write "BufAlloc (char *, pad, 4-length)"
120
120
         */
121
121
        length = 4 - Datalength;
122
122
        BufAlloc (char *, pad, length);
123
 
        /* 
 
123
        /*
124
124
         * if there are 3 bytes of padding, the first byte MUST be 0
125
 
         * so the pad bytes aren't mistaken for a final xTextElt 
 
125
         * so the pad bytes aren't mistaken for a final xTextElt
126
126
         */
127
127
        *pad = 0;
128
128
        }
129
129
 
130
 
    /* 
 
130
    /*
131
131
     * If the buffer pointer is not now pointing to a 32-bit boundary,
132
132
     * we must flush the buffer so that it does point to a 32-bit boundary
133
 
     * at the end of this routine. 
 
133
     * at the end of this routine.
134
134
     */
135
135
 
136
136
    if ((dpy->bufptr - dpy->buffer) & 3)