Changeset 103562 in vbox
- Timestamp:
- Feb 26, 2024 10:01:30 AM (9 months ago)
- Location:
- trunk/src/libs/xpcom18a4
- Files:
-
- 1 added
- 2 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/xpcom18a4/Makefile.kmk
r103533 r103562 292 292 IPCD-HEADERS_SOURCES = \ 293 293 ipc/ipcd/client/public/ipcCID.h \ 294 ipc/ipcd/util/public/ipcMessageReader.h \295 294 ipc/ipcd/util/public/ipcMessageWriter.h \ 296 295 ipc/ipcd/client/public/ipcdclient.h … … 815 814 ipc/ipcd/extensions/dconnect/src/ipcDConnectService.cpp \ 816 815 \ 817 ipc/ipcd/util/src/ipcMessageReader.cpp \818 816 ipc/ipcd/util/src/ipcMessageWriter.cpp \ 819 817 \ -
trunk/src/libs/xpcom18a4/ipc/ipcd/extensions/dconnect/src/ipcDConnectService.cpp
r103536 r103562 39 39 #include "ipcDConnectService.h" 40 40 #include "ipcMessageWriter.h" 41 #include "ipcM essageReader.h"41 #include "ipcMsgReader.h" 42 42 43 43 #include "nsIServiceManagerUtils.h" … … 452 452 453 453 static nsresult 454 DeserializeParam( ipcMessageReader &reader, const nsXPTType &t, nsXPTCVariant &v)454 DeserializeParam(PIPCMSGREADER pMsgReader, const nsXPTType &t, nsXPTCVariant &v) 455 455 { 456 456 // defaults … … 463 463 case nsXPTType::T_I8: 464 464 case nsXPTType::T_U8: 465 v.val.u8 = reader.GetInt8();465 v.val.u8 = IPCMsgReaderGetU8(pMsgReader); 466 466 break; 467 467 468 468 case nsXPTType::T_I16: 469 469 case nsXPTType::T_U16: 470 v.val.u16 = reader.GetInt16();470 v.val.u16 = IPCMsgReaderGetU16(pMsgReader); 471 471 break; 472 472 473 473 case nsXPTType::T_I32: 474 474 case nsXPTType::T_U32: 475 v.val.u32 = reader.GetInt32();475 v.val.u32 = IPCMsgReaderGetU32(pMsgReader); 476 476 break; 477 477 478 478 case nsXPTType::T_I64: 479 479 case nsXPTType::T_U64: 480 reader.GetBytes(&v.val.u64, sizeof(v.val.u64));480 v.val.u64 = IPCMsgReaderGetU64(pMsgReader); 481 481 break; 482 482 483 483 case nsXPTType::T_FLOAT: 484 reader.GetBytes(&v.val.f, sizeof(v.val.f));484 IPCMsgReaderReadBytes(pMsgReader, &v.val.f, sizeof(v.val.f)); 485 485 break; 486 486 487 487 case nsXPTType::T_DOUBLE: 488 reader.GetBytes(&v.val.d, sizeof(v.val.d));488 IPCMsgReaderReadBytes(pMsgReader, &v.val.d, sizeof(v.val.d)); 489 489 break; 490 490 491 491 case nsXPTType::T_BOOL: 492 reader.GetBytes(&v.val.b, sizeof(v.val.b));492 IPCMsgReaderReadBytes(pMsgReader, &v.val.b, sizeof(v.val.b)); 493 493 break; 494 494 495 495 case nsXPTType::T_CHAR: 496 reader.GetBytes(&v.val.c, sizeof(v.val.c));496 IPCMsgReaderReadBytes(pMsgReader, &v.val.c, sizeof(v.val.c)); 497 497 break; 498 498 499 499 case nsXPTType::T_WCHAR: 500 reader.GetBytes(&v.val.wc, sizeof(v.val.wc));500 IPCMsgReaderReadBytes(pMsgReader, &v.val.wc, sizeof(v.val.wc)); 501 501 break; 502 502 … … 504 504 { 505 505 nsID *buf = (nsID *) nsMemory::Alloc(sizeof(nsID)); 506 reader.GetBytes(buf, sizeof(nsID));506 IPCMsgReaderReadBytes(pMsgReader, buf, sizeof(nsID)); 507 507 v.val.p = buf; 508 508 v.SetValIsAllocated(); … … 512 512 case nsXPTType::T_CHAR_STR: 513 513 { 514 PRUint32 len = reader.GetInt32();514 PRUint32 len = IPCMsgReaderGetU32(pMsgReader); 515 515 if (len == (PRUint32) -1) 516 516 { … … 521 521 { 522 522 char *buf = (char *) nsMemory::Alloc(len + 1); 523 reader.GetBytes(buf, len);523 IPCMsgReaderReadBytes(pMsgReader, buf, len); 524 524 buf[len] = char(0); 525 525 … … 532 532 case nsXPTType::T_WCHAR_STR: 533 533 { 534 PRUint32 len = reader.GetInt32();534 PRUint32 len = IPCMsgReaderGetU32(pMsgReader); 535 535 if (len == (PRUint32) -1) 536 536 { … … 541 541 { 542 542 PRUnichar *buf = (PRUnichar *) nsMemory::Alloc(len + 2); 543 reader.GetBytes(buf, len);543 IPCMsgReaderReadBytes(pMsgReader, buf, len); 544 544 buf[len / 2] = PRUnichar(0); 545 545 … … 553 553 case nsXPTType::T_INTERFACE_IS: 554 554 { 555 reader.GetBytes(&v.val.u64, sizeof(DConAddr));555 IPCMsgReaderReadBytes(pMsgReader, &v.val.u64, sizeof(DConAddr)); 556 556 // stub creation will be handled outside this routine. we only 557 557 // deserialize the DConAddr into v.val.u64 temporarily. … … 562 562 case nsXPTType::T_DOMSTRING: 563 563 { 564 PRUint32 len = reader.GetInt32();564 PRUint32 len = IPCMsgReaderGetU32(pMsgReader); 565 565 566 566 nsString *str = new nsString(); 567 567 str->SetLength(len / 2); 568 568 PRUnichar *buf = str->BeginWriting(); 569 reader.GetBytes(buf, len);569 IPCMsgReaderReadBytes(pMsgReader, buf, len); 570 570 571 571 v.val.p = str; … … 577 577 case nsXPTType::T_CSTRING: 578 578 { 579 PRUint32 len = reader.GetInt32();579 PRUint32 len = IPCMsgReaderGetU32(pMsgReader); 580 580 581 581 nsCString *str = new nsCString(); 582 582 str->SetLength(len); 583 583 char *buf = str->BeginWriting(); 584 reader.GetBytes(buf, len);584 IPCMsgReaderReadBytes(pMsgReader, buf, len); 585 585 586 586 v.val.p = str; … … 696 696 697 697 static nsresult 698 DeserializeResult( ipcMessageReader &reader, const nsXPTType &t, nsXPTCMiniVariant &v)698 DeserializeResult(PIPCMSGREADER pMsgReader, const nsXPTType &t, nsXPTCMiniVariant &v) 699 699 { 700 700 if (v.val.p == nsnull) … … 705 705 case nsXPTType::T_I8: 706 706 case nsXPTType::T_U8: 707 *((PRUint8 *) v.val.p) = reader.GetInt8();707 *((PRUint8 *) v.val.p) = IPCMsgReaderGetU8(pMsgReader); 708 708 break; 709 709 710 710 case nsXPTType::T_I16: 711 711 case nsXPTType::T_U16: 712 *((PRUint16 *) v.val.p) = reader.GetInt16();712 *((PRUint16 *) v.val.p) = IPCMsgReaderGetU16(pMsgReader); 713 713 break; 714 714 715 715 case nsXPTType::T_I32: 716 716 case nsXPTType::T_U32: 717 *((PRUint32 *) v.val.p) = reader.GetInt32();717 *((PRUint32 *) v.val.p) = IPCMsgReaderGetU32(pMsgReader); 718 718 break; 719 719 720 720 case nsXPTType::T_I64: 721 721 case nsXPTType::T_U64: 722 reader.GetBytes(v.val.p, sizeof(PRUint64));722 *((PRUint64 *) v.val.p) = IPCMsgReaderGetU64(pMsgReader); 723 723 break; 724 724 725 725 case nsXPTType::T_FLOAT: 726 reader.GetBytes(v.val.p, sizeof(float));726 IPCMsgReaderReadBytes(pMsgReader, v.val.p, sizeof(float)); 727 727 break; 728 728 729 729 case nsXPTType::T_DOUBLE: 730 reader.GetBytes(v.val.p, sizeof(double));730 IPCMsgReaderReadBytes(pMsgReader, v.val.p, sizeof(double)); 731 731 break; 732 732 733 733 case nsXPTType::T_BOOL: 734 reader.GetBytes(v.val.p, sizeof(PRBool));734 IPCMsgReaderReadBytes(pMsgReader, v.val.p, sizeof(PRBool)); 735 735 break; 736 736 737 737 case nsXPTType::T_CHAR: 738 reader.GetBytes(v.val.p, sizeof(char));738 IPCMsgReaderReadBytes(pMsgReader, v.val.p, sizeof(char)); 739 739 break; 740 740 741 741 case nsXPTType::T_WCHAR: 742 reader.GetBytes(v.val.p, sizeof(PRUnichar));742 IPCMsgReaderReadBytes(pMsgReader, v.val.p, sizeof(PRUnichar)); 743 743 break; 744 744 … … 746 746 { 747 747 nsID *buf = (nsID *) nsMemory::Alloc(sizeof(nsID)); 748 reader.GetBytes(buf, sizeof(nsID));748 IPCMsgReaderReadBytes(pMsgReader, buf, sizeof(nsID)); 749 749 *((nsID **) v.val.p) = buf; 750 750 } … … 753 753 case nsXPTType::T_CHAR_STR: 754 754 { 755 PRUint32 len = reader.GetInt32();755 PRUint32 len = IPCMsgReaderGetU32(pMsgReader); 756 756 if (len == (PRUint32) -1) 757 757 { … … 766 766 { 767 767 char *buf = (char *) nsMemory::Alloc(len + 1); 768 reader.GetBytes(buf, len);768 IPCMsgReaderReadBytes(pMsgReader, buf, len); 769 769 buf[len] = char(0); 770 770 … … 776 776 case nsXPTType::T_WCHAR_STR: 777 777 { 778 PRUint32 len = reader.GetInt32();778 PRUint32 len = IPCMsgReaderGetU32(pMsgReader); 779 779 if (len == (PRUint32) -1) 780 780 { … … 789 789 { 790 790 PRUnichar *buf = (PRUnichar *) nsMemory::Alloc(len + 2); 791 reader.GetBytes(buf, len);791 IPCMsgReaderReadBytes(pMsgReader, buf, len); 792 792 buf[len / 2] = PRUnichar(0); 793 793 … … 804 804 // into v.val.p temporarily. needs temporary memory alloc. 805 805 DConAddrPlusPtr *buf = (DConAddrPlusPtr *) nsMemory::Alloc(sizeof(DConAddrPlusPtr)); 806 reader.GetBytes(&buf->addr, sizeof(DConAddr));806 IPCMsgReaderReadBytes(pMsgReader, &buf->addr, sizeof(DConAddr)); 807 807 buf->p = v.val.p; 808 808 v.val.p = buf; … … 813 813 case nsXPTType::T_DOMSTRING: 814 814 { 815 PRUint32 len = reader.GetInt32();815 PRUint32 len = IPCMsgReaderGetU32(pMsgReader); 816 816 817 817 nsAString *str = (nsAString *) v.val.p; … … 821 821 str->BeginWriting(begin); 822 822 823 reader.GetBytes(begin.get(), len);823 IPCMsgReaderReadBytes(pMsgReader, begin.get(), len); 824 824 } 825 825 break; … … 828 828 case nsXPTType::T_CSTRING: 829 829 { 830 PRUint32 len = reader.GetInt32();830 PRUint32 len = IPCMsgReaderGetU32(pMsgReader); 831 831 832 832 nsACString *str = (nsACString *) v.val.p; … … 836 836 str->BeginWriting(begin); 837 837 838 reader.GetBytes(begin.get(), len);838 IPCMsgReaderReadBytes(pMsgReader, begin.get(), len); 839 839 } 840 840 break; … … 1067 1067 static nsresult 1068 1068 DeserializeArrayParam(ipcDConnectService *dConnect, 1069 ipcMessageReader &reader, PRUint32 peerID,1069 PIPCMSGREADER pMsgReader, PRUint32 peerID, 1070 1070 nsIInterfaceInfo *iinfo, uint16 methodIndex, 1071 1071 const nsXPTMethodInfo &methodInfo, … … 1084 1084 return rv; 1085 1085 1086 PRUint8 prefix = reader.GetInt8();1086 PRUint8 prefix = IPCMsgReaderGetU8(pMsgReader); 1087 1087 if (prefix == 0) 1088 1088 { … … 1119 1119 { 1120 1120 // this is a simple arithmetic type, read the whole array at once 1121 reader.GetBytes(arr, length * elemSize);1121 IPCMsgReaderReadBytes(pMsgReader, arr, length * elemSize); 1122 1122 1123 1123 array = arr; … … 1130 1130 for (PRUint32 i = 0; i < length; ++i) 1131 1131 { 1132 rv = DeserializeParam( reader, elemType, v);1132 rv = DeserializeParam(pMsgReader, elemType, v); 1133 1133 1134 1134 if (NS_SUCCEEDED(rv) && elemType.IsInterfacePointer()) … … 2114 2114 2115 2115 nsresult 2116 ipcDConnectService::DeserializeException( ipcMessageReader &reader,2116 ipcDConnectService::DeserializeException(PIPCMSGREADER pMsgReader, 2117 2117 PRUint32 peer, 2118 2118 nsIException **xcpt) … … 2126 2126 2127 2127 PtrBits bits = 0; 2128 reader.GetBytes(&bits, sizeof(DConAddr));2129 if ( reader.HasError())2128 IPCMsgReaderReadBytes(pMsgReader, &bits, sizeof(DConAddr)); 2129 if (IPCMsgReaderHasError(pMsgReader)) 2130 2130 return NS_ERROR_INVALID_ARG; 2131 2131 … … 2136 2136 2137 2137 nsCAutoString message; 2138 len = reader.GetInt32();2138 len = IPCMsgReaderGetU32(pMsgReader); 2139 2139 if (len) 2140 2140 { 2141 2141 message.SetLength(len); 2142 2142 char *buf = message.BeginWriting(); 2143 reader.GetBytes(buf, len);2144 } 2145 2146 nsresult result = reader.GetInt32();2143 IPCMsgReaderReadBytes(pMsgReader, buf, len); 2144 } 2145 2146 nsresult result = IPCMsgReaderGetU32(pMsgReader); 2147 2147 2148 2148 nsCAutoString name; 2149 len = reader.GetInt32();2149 len = IPCMsgReaderGetU32(pMsgReader); 2150 2150 if (len) 2151 2151 { 2152 2152 name.SetLength(len); 2153 2153 char *buf = name.BeginWriting(); 2154 reader.GetBytes(buf, len);2154 IPCMsgReaderReadBytes(pMsgReader, buf, len); 2155 2155 } 2156 2156 2157 2157 nsCAutoString filename; 2158 len = reader.GetInt32();2158 len = IPCMsgReaderGetU32(pMsgReader); 2159 2159 if (len) 2160 2160 { 2161 2161 filename.SetLength(len); 2162 2162 char *buf = filename.BeginWriting(); 2163 reader.GetBytes(buf, len);2164 } 2165 2166 PRUint32 lineNumber = reader.GetInt32();2167 PRUint32 columnNumber = reader.GetInt32();2168 2169 if ( reader.HasError())2163 IPCMsgReaderReadBytes(pMsgReader, buf, len); 2164 } 2165 2166 PRUint32 lineNumber = IPCMsgReaderGetU32(pMsgReader); 2167 PRUint32 columnNumber = IPCMsgReaderGetU32(pMsgReader); 2168 2169 if (IPCMsgReaderHasError(pMsgReader)) 2170 2170 rv = NS_ERROR_INVALID_ARG; 2171 2171 else … … 2645 2645 while (completion.IsPending()); 2646 2646 2647 ipcMessageReader reader(completion.Params(), completion.ParamsLen()); 2647 IPCMSGREADER MsgReader; 2648 IPCMsgReaderInit(&MsgReader, completion.Params(), completion.ParamsLen()); 2648 2649 2649 2650 rv = completion.GetResult(); … … 2658 2659 2659 2660 if (paramInfo.IsOut() || paramInfo.IsRetval()) 2660 DeserializeResult( reader, paramInfo.GetType(), aParams[i]);2661 DeserializeResult(&MsgReader, paramInfo.GetType(), aParams[i]); 2661 2662 } 2662 2663 … … 2696 2697 { 2697 2698 void *array = nsnull; 2698 rv = DeserializeArrayParam(dConnect, reader, mPeerID, mIInfo,2699 rv = DeserializeArrayParam(dConnect, &MsgReader, mPeerID, mIInfo, 2699 2700 aMethodIndex, *aInfo, aParams, PR_FALSE, 2700 2701 paramInfo, PR_TRUE, array); … … 2711 2712 2712 2713 nsIException *xcpt = nsnull; 2713 rv = dConnect->DeserializeException ( reader, mPeerID, &xcpt);2714 rv = dConnect->DeserializeException (&MsgReader, mPeerID, &xcpt); 2714 2715 if (NS_SUCCEEDED(rv)) 2715 2716 { … … 2775 2776 const PRUint32 paramsLen = opLen - sizeof (DConnectSetupReply); 2776 2777 2777 ipcMessageReader reader(params, paramsLen); 2778 IPCMSGREADER MsgReader; 2779 IPCMsgReaderInit(&MsgReader, params, paramsLen); 2778 2780 2779 2781 Log(("got nsIException instance, will create a stub\n")); … … 2793 2795 { 2794 2796 nsIException *xcpt = nsnull; 2795 rv = dConnect->DeserializeException ( reader, sender, &xcpt);2797 rv = dConnect->DeserializeException (&MsgReader, sender, &xcpt); 2796 2798 if (NS_SUCCEEDED(rv)) 2797 2799 { … … 3661 3663 DConnectInstance *wrapper = (DConnectInstance *)invoke->instance; 3662 3664 3663 ipcMessageReader reader((const PRUint8 *) (invoke + 1), opLen - sizeof(*invoke)); 3665 IPCMSGREADER MsgReader; 3666 IPCMsgReaderInit(&MsgReader, (const PRUint8 *) (invoke + 1), opLen - sizeof(*invoke)); 3664 3667 3665 3668 const nsXPTMethodInfo *methodInfo; … … 3712 3715 3713 3716 if (paramInfo.IsIn() && !paramInfo.IsDipper()) 3714 rv = DeserializeParam( reader, paramInfo.GetType(), params[i]);3717 rv = DeserializeParam(&MsgReader, paramInfo.GetType(), params[i]); 3715 3718 else 3716 3719 rv = SetupParam(paramInfo, params[i]); … … 3760 3763 { 3761 3764 void *array = nsnull; 3762 rv = DeserializeArrayParam(this, reader, peer, iinfo,3765 rv = DeserializeArrayParam(this, &MsgReader, peer, iinfo, 3763 3766 invoke->method_index, *methodInfo, params, 3764 3767 PR_TRUE, paramInfo, PR_FALSE, array); -
trunk/src/libs/xpcom18a4/ipc/ipcd/extensions/dconnect/src/ipcDConnectService.h
r103488 r103562 39 39 #include "ipcdclient.h" 40 40 41 #include "ipcMsgReader.h" 42 41 43 #include "nsIInterfaceInfo.h" 42 44 #include "nsIInterfaceInfoManager.h" … … 55 57 56 58 class nsIException; 57 class ipcMessageReader;58 59 class ipcMessageWriter; 59 60 … … 204 205 PRUint32 peer, nsIException *xcpt, 205 206 nsVoidArray &wrappers); 206 NS_HIDDEN_(nsresult) DeserializeException( ipcMessageReader &reader,207 NS_HIDDEN_(nsresult) DeserializeException(PIPCMSGREADER pMsgReader, 207 208 PRUint32 peer, nsIException **xcpt); 208 209
Note:
See TracChangeset
for help on using the changeset viewer.