VirtualBox

source: vbox/trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_retval.py@ 77235

Last change on this file since 77235 was 74890, checked in by vboxsync, 6 years ago

3D: Memory allocations fixed, bugref:9251. Merged changes r125768, r125779, r125780, r125812.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 2.6 KB
Line 
1# Copyright (c) 2001, Stanford University
2# All rights reserved.
3#
4# See the file LICENSE.txt for information on redistributing this software.
5
6from __future__ import print_function
7import sys
8
9import apiutil
10
11
12apiutil.CopyrightC()
13
14print("""
15/* DO NOT EDIT - THIS FILE AUTOMATICALLY GENERATED BY server_retval.py SCRIPT */
16#include "chromium.h"
17#include "cr_mem.h"
18#include "cr_net.h"
19#include "server_dispatch.h"
20#include "server.h"
21
22void crServerReturnValue( const void *payload, unsigned int payload_len )
23{
24 if (!cr_server.fProcessingPendedCommands)
25 {
26 CRMessageReadback *rb;
27 int msg_len;
28
29 /* Don't reply to client if we're loading VM snapshot*/
30 if (cr_server.bIsInLoadingState)
31 return;
32
33 if (cr_server.curClient->conn->type == CR_FILE)
34 {
35 return;
36 }
37
38 if (payload_len >= INT32_MAX - sizeof( *rb ))
39 {
40 return;
41 }
42
43 msg_len = sizeof( *rb ) + payload_len;
44 rb = (CRMessageReadback *) crAlloc( msg_len );
45
46 rb->header.type = CR_MESSAGE_READBACK;
47 CRDBGPTR_PRINTRB(cr_server.curClient->conn->u32ClientID, &cr_server.writeback_ptr);
48 CRDBGPTR_CHECKNZ(&cr_server.writeback_ptr);
49 CRDBGPTR_CHECKNZ(&cr_server.return_ptr);
50 crMemcpy( &(rb->writeback_ptr), &(cr_server.writeback_ptr), sizeof( rb->writeback_ptr ) );
51 crMemcpy( &(rb->readback_ptr), &(cr_server.return_ptr), sizeof( rb->readback_ptr ) );
52 crMemcpy( rb+1, payload, payload_len );
53 crNetSend( cr_server.curClient->conn, NULL, rb, msg_len );
54 CRDBGPTR_SETZ(&cr_server.writeback_ptr);
55 CRDBGPTR_SETZ(&cr_server.return_ptr);
56 crFree( rb );
57 return;
58 }
59#ifdef DEBUG_misha
60 WARN(("Pending command returns value"));
61#endif
62 CRDBGPTR_SETZ(&cr_server.writeback_ptr);
63 CRDBGPTR_SETZ(&cr_server.return_ptr);
64}
65""")
66
67keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt")
68
69for func_name in keys:
70 params = apiutil.Parameters(func_name)
71 return_type = apiutil.ReturnType(func_name)
72 if apiutil.FindSpecial( "server", func_name ):
73 continue
74 if "VBox" == apiutil.Category(func_name):
75 continue
76 if return_type != 'void':
77 print('%s SERVER_DISPATCH_APIENTRY crServerDispatch%s(%s)' % ( return_type, func_name, apiutil.MakeDeclarationString(params)))
78 print('{')
79 print('\t%s retval;' % return_type)
80 print('\tretval = cr_server.head_spu->dispatch_table.%s(%s);' % (func_name, apiutil.MakeCallString(params) ))
81 print('\tcrServerReturnValue( &retval, sizeof(retval) );')
82 print('\treturn retval; /* WILL PROBABLY BE IGNORED */')
83 print('}')
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette