(submit/cleanup-xv-dispatch) Xext: xv: use static struct initialization on declaration
A little bit of code simplification by using static initialization of struct right at the point of declaration. Also dropping a few now unneccessary zero assignments. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
		
							parent
							
								
									8b98cf3be3
								
							
						
					
					
						commit
						9d126ef1a1
					
				| 
						 | 
					@ -321,7 +321,6 @@ ProcXvQueryAdaptors(ClientPtr client)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    xvFormat format;
 | 
					    xvFormat format;
 | 
				
			||||||
    xvAdaptorInfo ainfo;
 | 
					    xvAdaptorInfo ainfo;
 | 
				
			||||||
    xvQueryAdaptorsReply rep;
 | 
					 | 
				
			||||||
    int totalSize, na, nf, rc;
 | 
					    int totalSize, na, nf, rc;
 | 
				
			||||||
    int nameSize;
 | 
					    int nameSize;
 | 
				
			||||||
    XvAdaptorPtr pa;
 | 
					    XvAdaptorPtr pa;
 | 
				
			||||||
| 
						 | 
					@ -337,27 +336,20 @@ ProcXvQueryAdaptors(ClientPtr client)
 | 
				
			||||||
    if (rc != Success)
 | 
					    if (rc != Success)
 | 
				
			||||||
        return rc;
 | 
					        return rc;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    xvQueryAdaptorsReply rep = {
 | 
				
			||||||
 | 
					        .type = X_Reply,
 | 
				
			||||||
 | 
					        .sequenceNumber = client->sequence,
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pScreen = pWin->drawable.pScreen;
 | 
					    pScreen = pWin->drawable.pScreen;
 | 
				
			||||||
    pxvs = (XvScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
 | 
					    pxvs = (XvScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
 | 
				
			||||||
                                          XvGetScreenKey());
 | 
					                                          XvGetScreenKey());
 | 
				
			||||||
    if (!pxvs) {
 | 
					    if (!pxvs) {
 | 
				
			||||||
        rep = (xvQueryAdaptorsReply) {
 | 
					 | 
				
			||||||
            .type = X_Reply,
 | 
					 | 
				
			||||||
            .sequenceNumber = client->sequence,
 | 
					 | 
				
			||||||
            .length = 0,
 | 
					 | 
				
			||||||
            .num_adaptors = 0
 | 
					 | 
				
			||||||
        };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        _WriteQueryAdaptorsReply(client, &rep);
 | 
					        _WriteQueryAdaptorsReply(client, &rep);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        return Success;
 | 
					        return Success;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    rep = (xvQueryAdaptorsReply) {
 | 
					    rep.num_adaptors = pxvs->nAdaptors;
 | 
				
			||||||
        .type = X_Reply,
 | 
					 | 
				
			||||||
        .sequenceNumber = client->sequence,
 | 
					 | 
				
			||||||
        .num_adaptors = pxvs->nAdaptors
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* CALCULATE THE TOTAL SIZE OF THE REPLY IN BYTES */
 | 
					    /* CALCULATE THE TOTAL SIZE OF THE REPLY IN BYTES */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -411,7 +403,6 @@ static int
 | 
				
			||||||
ProcXvQueryEncodings(ClientPtr client)
 | 
					ProcXvQueryEncodings(ClientPtr client)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    xvEncodingInfo einfo;
 | 
					    xvEncodingInfo einfo;
 | 
				
			||||||
    xvQueryEncodingsReply rep;
 | 
					 | 
				
			||||||
    int totalSize;
 | 
					    int totalSize;
 | 
				
			||||||
    int nameSize;
 | 
					    int nameSize;
 | 
				
			||||||
    XvPortPtr pPort;
 | 
					    XvPortPtr pPort;
 | 
				
			||||||
| 
						 | 
					@ -423,12 +414,6 @@ ProcXvQueryEncodings(ClientPtr client)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
 | 
					    VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    rep = (xvQueryEncodingsReply) {
 | 
					 | 
				
			||||||
        .type = X_Reply,
 | 
					 | 
				
			||||||
        .sequenceNumber = client->sequence,
 | 
					 | 
				
			||||||
        .num_encodings = pPort->pAdaptor->nEncodings
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /* FOR EACH ENCODING ADD UP THE BYTES FOR ENCODING NAMES */
 | 
					    /* FOR EACH ENCODING ADD UP THE BYTES FOR ENCODING NAMES */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ne = pPort->pAdaptor->nEncodings;
 | 
					    ne = pPort->pAdaptor->nEncodings;
 | 
				
			||||||
| 
						 | 
					@ -439,7 +424,12 @@ ProcXvQueryEncodings(ClientPtr client)
 | 
				
			||||||
        pe++;
 | 
					        pe++;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    rep.length = bytes_to_int32(totalSize);
 | 
					    xvQueryEncodingsReply rep = {
 | 
				
			||||||
 | 
					        .type = X_Reply,
 | 
				
			||||||
 | 
					        .sequenceNumber = client->sequence,
 | 
				
			||||||
 | 
					        .num_encodings = pPort->pAdaptor->nEncodings,
 | 
				
			||||||
 | 
					        .length = bytes_to_int32(totalSize),
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    _WriteQueryEncodingsReply(client, &rep);
 | 
					    _WriteQueryEncodingsReply(client, &rep);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -615,7 +605,6 @@ ProcXvGrabPort(ClientPtr client)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    int result, status;
 | 
					    int result, status;
 | 
				
			||||||
    XvPortPtr pPort;
 | 
					    XvPortPtr pPort;
 | 
				
			||||||
    xvGrabPortReply rep;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    REQUEST(xvGrabPortReq);
 | 
					    REQUEST(xvGrabPortReq);
 | 
				
			||||||
    REQUEST_SIZE_MATCH(xvGrabPortReq);
 | 
					    REQUEST_SIZE_MATCH(xvGrabPortReq);
 | 
				
			||||||
| 
						 | 
					@ -627,10 +616,9 @@ ProcXvGrabPort(ClientPtr client)
 | 
				
			||||||
    if (status != Success) {
 | 
					    if (status != Success) {
 | 
				
			||||||
        return status;
 | 
					        return status;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    rep = (xvGrabPortReply) {
 | 
					    xvGrabPortReply rep = {
 | 
				
			||||||
        .type = X_Reply,
 | 
					        .type = X_Reply,
 | 
				
			||||||
        .sequenceNumber = client->sequence,
 | 
					        .sequenceNumber = client->sequence,
 | 
				
			||||||
        .length = 0,
 | 
					 | 
				
			||||||
        .result = result
 | 
					        .result = result
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -704,7 +692,6 @@ ProcXvGetPortAttribute(ClientPtr client)
 | 
				
			||||||
    INT32 value;
 | 
					    INT32 value;
 | 
				
			||||||
    int status;
 | 
					    int status;
 | 
				
			||||||
    XvPortPtr pPort;
 | 
					    XvPortPtr pPort;
 | 
				
			||||||
    xvGetPortAttributeReply rep;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    REQUEST(xvGetPortAttributeReq);
 | 
					    REQUEST(xvGetPortAttributeReq);
 | 
				
			||||||
    REQUEST_SIZE_MATCH(xvGetPortAttributeReq);
 | 
					    REQUEST_SIZE_MATCH(xvGetPortAttributeReq);
 | 
				
			||||||
| 
						 | 
					@ -722,10 +709,9 @@ ProcXvGetPortAttribute(ClientPtr client)
 | 
				
			||||||
        return status;
 | 
					        return status;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    rep = (xvGetPortAttributeReply) {
 | 
					    xvGetPortAttributeReply rep = {
 | 
				
			||||||
        .type = X_Reply,
 | 
					        .type = X_Reply,
 | 
				
			||||||
        .sequenceNumber = client->sequence,
 | 
					        .sequenceNumber = client->sequence,
 | 
				
			||||||
        .length = 0,
 | 
					 | 
				
			||||||
        .value = value
 | 
					        .value = value
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -739,7 +725,6 @@ ProcXvQueryBestSize(ClientPtr client)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    unsigned int actual_width, actual_height;
 | 
					    unsigned int actual_width, actual_height;
 | 
				
			||||||
    XvPortPtr pPort;
 | 
					    XvPortPtr pPort;
 | 
				
			||||||
    xvQueryBestSizeReply rep;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    REQUEST(xvQueryBestSizeReq);
 | 
					    REQUEST(xvQueryBestSizeReq);
 | 
				
			||||||
    REQUEST_SIZE_MATCH(xvQueryBestSizeReq);
 | 
					    REQUEST_SIZE_MATCH(xvQueryBestSizeReq);
 | 
				
			||||||
| 
						 | 
					@ -751,10 +736,9 @@ ProcXvQueryBestSize(ClientPtr client)
 | 
				
			||||||
                                         stuff->drw_w, stuff->drw_h,
 | 
					                                         stuff->drw_w, stuff->drw_h,
 | 
				
			||||||
                                         &actual_width, &actual_height);
 | 
					                                         &actual_width, &actual_height);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    rep = (xvQueryBestSizeReply) {
 | 
					    xvQueryBestSizeReply rep = {
 | 
				
			||||||
        .type = X_Reply,
 | 
					        .type = X_Reply,
 | 
				
			||||||
        .sequenceNumber = client->sequence,
 | 
					        .sequenceNumber = client->sequence,
 | 
				
			||||||
        .length = 0,
 | 
					 | 
				
			||||||
        .actual_width = actual_width,
 | 
					        .actual_width = actual_width,
 | 
				
			||||||
        .actual_height = actual_height
 | 
					        .actual_height = actual_height
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
| 
						 | 
					@ -770,7 +754,6 @@ ProcXvQueryPortAttributes(ClientPtr client)
 | 
				
			||||||
    int size, i;
 | 
					    int size, i;
 | 
				
			||||||
    XvPortPtr pPort;
 | 
					    XvPortPtr pPort;
 | 
				
			||||||
    XvAttributePtr pAtt;
 | 
					    XvAttributePtr pAtt;
 | 
				
			||||||
    xvQueryPortAttributesReply rep;
 | 
					 | 
				
			||||||
    xvAttributeInfo Info;
 | 
					    xvAttributeInfo Info;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    REQUEST(xvQueryPortAttributesReq);
 | 
					    REQUEST(xvQueryPortAttributesReq);
 | 
				
			||||||
| 
						 | 
					@ -778,11 +761,10 @@ ProcXvQueryPortAttributes(ClientPtr client)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    VALIDATE_XV_PORT(stuff->port, pPort, DixGetAttrAccess);
 | 
					    VALIDATE_XV_PORT(stuff->port, pPort, DixGetAttrAccess);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    rep = (xvQueryPortAttributesReply) {
 | 
					    xvQueryPortAttributesReply rep = {
 | 
				
			||||||
        .type = X_Reply,
 | 
					        .type = X_Reply,
 | 
				
			||||||
        .sequenceNumber = client->sequence,
 | 
					        .sequenceNumber = client->sequence,
 | 
				
			||||||
        .num_attributes = pPort->pAdaptor->nAttributes,
 | 
					        .num_attributes = pPort->pAdaptor->nAttributes,
 | 
				
			||||||
        .text_size = 0
 | 
					 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (i = 0, pAtt = pPort->pAdaptor->pAttributes;
 | 
					    for (i = 0, pAtt = pPort->pAdaptor->pAttributes;
 | 
				
			||||||
| 
						 | 
					@ -1029,7 +1011,6 @@ ProcXvListImageFormats(ClientPtr client)
 | 
				
			||||||
    XvPortPtr pPort;
 | 
					    XvPortPtr pPort;
 | 
				
			||||||
    XvImagePtr pImage;
 | 
					    XvImagePtr pImage;
 | 
				
			||||||
    int i;
 | 
					    int i;
 | 
				
			||||||
    xvListImageFormatsReply rep;
 | 
					 | 
				
			||||||
    xvImageFormatInfo info;
 | 
					    xvImageFormatInfo info;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    REQUEST(xvListImageFormatsReq);
 | 
					    REQUEST(xvListImageFormatsReq);
 | 
				
			||||||
| 
						 | 
					@ -1038,7 +1019,7 @@ ProcXvListImageFormats(ClientPtr client)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
 | 
					    VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    rep = (xvListImageFormatsReply) {
 | 
					    xvListImageFormatsReply rep = {
 | 
				
			||||||
        .type = X_Reply,
 | 
					        .type = X_Reply,
 | 
				
			||||||
        .sequenceNumber = client->sequence,
 | 
					        .sequenceNumber = client->sequence,
 | 
				
			||||||
        .num_formats = pPort->pAdaptor->nImages,
 | 
					        .num_formats = pPort->pAdaptor->nImages,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue