~ubuntu-branches/ubuntu/natty/libxdmcp/natty

« back to all changes in this revision

Viewing changes to Whead.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2005-05-23 20:02:59 UTC
  • Revision ID: james.westby@ubuntu.com-20050523200259-qw2i2s1fmsbz2748
Tags: 1:0.1.3-2
* Add build dependencies: pkg-config, x11proto-core-dev
* Change Build-Depends-Indep to Build-Depends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * $Xorg: Whead.c,v 1.4 2001/02/09 02:03:49 xorgcvs Exp $
 
3
 *
 
4
 * 
 
5
Copyright 1989, 1998  The Open Group
 
6
 
 
7
Permission to use, copy, modify, distribute, and sell this software and its
 
8
documentation for any purpose is hereby granted without fee, provided that
 
9
the above copyright notice appear in all copies and that both that
 
10
copyright notice and this permission notice appear in supporting
 
11
documentation.
 
12
 
 
13
The above copyright notice and this permission notice shall be included in
 
14
all copies or substantial portions of the Software.
 
15
 
 
16
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
17
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
18
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
 
19
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
 
20
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 
21
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
22
 
 
23
Except as contained in this notice, the name of The Open Group shall not be
 
24
used in advertising or otherwise to promote the sale, use or other dealings
 
25
in this Software without prior written authorization from The Open Group.
 
26
 * *
 
27
 * Author:  Keith Packard, MIT X Consortium
 
28
 */
 
29
 
 
30
/* $XFree86: xc/lib/Xdmcp/Whead.c,v 1.3 2001/01/17 19:42:44 dawes Exp $ */
 
31
 
 
32
#ifdef HAVE_CONFIG_H
 
33
#include <config.h>
 
34
#endif
 
35
#include <X11/Xos.h>
 
36
#include <X11/X.h>
 
37
#include <X11/Xmd.h>
 
38
#include <X11/Xdmcp.h>
 
39
 
 
40
int
 
41
XdmcpWriteHeader (
 
42
    XdmcpBufferPtr  buffer,
 
43
    XdmcpHeaderPtr  header)
 
44
{
 
45
    BYTE    *newData;
 
46
 
 
47
    if ((int)buffer->size < 6 + (int)header->length)
 
48
    {
 
49
        newData = (BYTE *) Xalloc (XDM_MAX_MSGLEN * sizeof (BYTE));
 
50
        if (!newData)
 
51
            return FALSE;
 
52
        Xfree ((unsigned long *)(buffer->data));
 
53
        buffer->data = newData;
 
54
        buffer->size = XDM_MAX_MSGLEN;
 
55
    }
 
56
    buffer->pointer = 0;
 
57
    if (!XdmcpWriteCARD16 (buffer, header->version))
 
58
        return FALSE;
 
59
    if (!XdmcpWriteCARD16 (buffer, header->opcode))
 
60
        return FALSE;
 
61
    if (!XdmcpWriteCARD16 (buffer, header->length))
 
62
        return FALSE;
 
63
    return TRUE;
 
64
}