儲存庫 vbox 的更動 16487
- 時間撮記:
- 2009-2-3 下午01:39:37 (16 年 以前)
- 位置:
- trunk/src/VBox/Main/cbinding
- 檔案:
-
- 修改 4 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Main/cbinding/cbinding.h
-
屬性 svn:keywords
由
Id
變更至Author Date Id Revision
r16483 r16487 1 /* $Revision$ */ 1 2 /** @file cbinding.h 2 *3 3 * C binding for XPCOM. 4 *5 * $Id$6 4 */ 7 5 8 #ifndef __ cbinding_h__9 #define __ cbinding_h__6 #ifndef ___cbinding_h 7 #define ___cbinding_h 10 8 11 9 /* … … 58 56 #endif 59 57 60 #endif /* __cbinding_h__ */ 58 #endif /* !___cbinding_h */ 59 -
屬性 svn:keywords
由
-
trunk/src/VBox/Main/cbinding/libXPCOMtoC.cpp
-
屬性 svn:keywords
由
Id
變更至Author Date Id Revision
r16483 r16487 1 /* $Id$ */ 1 2 /** @file libXPCOMtoC.cpp 2 *3 3 * Utility functions to use with the C binding for XPCOM. 4 *5 * $Id$6 4 */ 7 5 … … 84 82 void VBoxComUnallocStr(PRUnichar *str_dealloc) 85 83 { 86 if (str_dealloc) { 84 if (str_dealloc) 85 { 87 86 nsMemory::Free(str_dealloc); 88 87 } … … 91 90 void VBoxComUnallocIID(nsIID *iid) 92 91 { 93 if (iid) { 92 if (iid) 93 { 94 94 nsMemory::Free(iid); 95 95 } … … 105 105 Session = *session; 106 106 Ivirtualbox = *virtualBox; 107 108 /** @todo r=bird: Why is cout/cerr used unconditionally here? 109 * It would be preferred to use RTPrintf/RTStrmPrintf(g_pStdErr,..). If this is 110 * going to be used in real life, the cout(/RTPrintf) bits should be optional, 111 * add a flag argument and define VBOXCOMINIT_FLAG_VERBOSE for the purpose. */ 107 112 108 113 // All numbers on stderr in hex prefixed with 0X. -
屬性 svn:keywords
由
-
trunk/src/VBox/Main/cbinding/makefile.tstLinuxC
-
屬性 svn:keywords
設為
Author Date Id Revision
r16483 r16487 1 # $Id: Makefile 42209 2009-01-29 12:22:10Z jens $ 1 # $Revision$ 2 ## @file makefile.tstLinuxC 3 # Makefile for sample program illustrating use of C binding for XPCOM. 2 4 # 3 ## @file makefile.tstLinuxC4 #5 # Makefile for sample program illustrating use of C binding for XPCOM.6 5 7 6 # … … 50 49 echo "env VBOX_XPCOM_HOME=$(PATH_BIN) LD_LIBRARY_PATH=$(PATH_BIN) ./tstLinuxC" > $@ 51 50 chmod a+x $@ 51 -
屬性 svn:keywords
設為
-
trunk/src/VBox/Main/cbinding/tstLinuxC.c
-
屬性 svn:keywords
由
Id
變更至Author Date Id Revision
r16483 r16487 1 /* $Revsion: $ */ 1 2 /** @file tstLinuxC.c 2 *3 3 * Demonstrator program to illustrate use of C bindings of Main API. 4 * 4 5 * Linux only at the moment due to shared library magic in the Makefile. 5 *6 * $Id$7 6 */ 8 7 … … 26 25 #include <string.h> 27 26 #include <stdlib.h> 28 #include <iconv.h>29 27 #include "cbinding.h" 30 28 … … 77 75 if (NS_FAILED(rc)) 78 76 { 79 fprintf 77 fprintf(stderr, "could not get list of machines, rc=%08x\n", 80 78 (unsigned)rc); 81 79 return; … … 95 93 printf("\tMachine #%u\n", (unsigned)i); 96 94 97 if (!machine) { 95 if (!machine) 96 { 98 97 printf("\t(skipped, NULL)\n"); 99 98 continue; 100 99 } 101 100 102 machine->vtbl->GetAccessible 101 machine->vtbl->GetAccessible(machine, &isAccessible); 103 102 104 103 if (isAccessible) … … 118 117 119 118 { 120 nsID *iid = nsnull;119 nsID *iid = NULL; 121 120 char *uuidString; 122 121 … … 153 152 PRUnichar *typeId; 154 153 PRUnichar *osName; 155 IGuestOSType *osType = nsnull;154 IGuestOSType *osType = NULL; 156 155 157 156 machine->vtbl->GetOSTypeId(machine, &typeId); … … 171 170 */ 172 171 173 printf 172 printf("Type Machine# to start (0 - %u) or 'quit' to do nothing: ", 174 173 (unsigned)(machineCnt - 1)); 175 fflush (stdout); 176 177 if (scanf ("%u", &start_id) == 1 && start_id < machineCnt) { 174 fflush(stdout); 175 176 if (scanf("%u", &start_id) == 1 && start_id < machineCnt) 177 { 178 178 IMachine *machine = machines[start_id]; 179 179 180 if (machine) { 181 nsID *iid = nsnull; 180 if (machine) 181 { 182 nsID *iid = NULL; 182 183 183 184 machine->vtbl->GetId(machine, &iid); … … 192 193 */ 193 194 194 for (i = 0; i < machineCnt; ++i) { 195 for (i = 0; i < machineCnt; ++i) 196 { 195 197 IMachine *machine = machines[i]; 196 198 197 if (machine) { 199 if (machine) 200 { 198 201 machine->vtbl->nsisupports.Release((void *)machine); 199 202 } … … 220 223 if (NS_FAILED(rc) || !machine) 221 224 { 222 fprintf 225 fprintf(stderr, "Error: Couldn't get the machine handle.\n"); 223 226 return; 224 227 } … … 237 240 VBoxUtf16Free(sessionType); 238 241 239 if (NS_FAILED 240 { 241 fprintf 242 if (NS_FAILED(rc)) 243 { 244 fprintf(stderr, "Error: OpenRemoteSession failed.\n"); 242 245 } 243 246 else … … 250 253 251 254 rc = progress->vtbl->GetCompleted(progress, &completed); 252 if (NS_FAILED 255 if (NS_FAILED(rc)) 253 256 { 254 257 fprintf (stderr, "Error: GetCompleted status failed.\n"); … … 263 266 progress->vtbl->GetErrorInfo(progress, &errorInfo); 264 267 errorInfo->vtbl->GetText(errorInfo, &text); 265 printf 268 printf("[!] Text = %s\n", VBoxConvertPRUnichartoAscii (text)); 266 269 } 267 270 else 268 271 { 269 fprintf 272 fprintf(stderr, "Remote session has been successfully opened.\n"); 270 273 } 271 274 progress->vtbl->nsisupports.Release((void *)progress); … … 288 291 289 292 printf("Starting Main\n"); 293 290 294 /* 291 295 * VBoxComInitialize does all the necessary startup action and … … 294 298 * when done. 295 299 */ 300 296 301 VBoxComInitialize(&vbox, &session); 297 302 298 if (vbox == NULL) { 299 fprintf (stderr, "%s: FATAL: could not get vbox handle\n", argv[0]); 300 exit (EXIT_FAILURE); 301 } 302 if (session == NULL) { 303 if (vbox == NULL) 304 { 305 fprintf(stderr, "%s: FATAL: could not get vbox handle\n", argv[0]); 306 return EXIT_FAILURE; 307 } 308 if (session == NULL) 309 { 303 310 fprintf (stderr, "%s: FATAL: could not get session handle\n", argv[0]); 304 exit (EXIT_FAILURE);311 return EXIT_FAILURE; 305 312 } 306 313 … … 310 317 * remains easy to see how we access C++'s vtable. 311 318 */ 319 312 320 printf("----------------------------------------------------\n"); 313 321 … … 361 369 * Do as mom told us: always clean up after yourself. 362 370 */ 371 363 372 VBoxComUninitialize(); 364 373 printf("Finished Main\n"); … … 367 376 } 368 377 /* vim: set ts=4 sw=4 et: */ 378 -
屬性 svn:keywords
由
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器