vbox的更動 63272 路徑 trunk/src/VBox/NetworkServices
- 時間撮記:
- 2016-8-10 下午02:03:34 (8 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/NetworkServices/NetLib/VBoxNetPortForwardString.cpp
r63267 r63272 93 93 94 94 95 /** 96 * Parses a port something. 97 * 98 * @returns Offset relative to @a pszRaw of the end of the port field. 99 * -1 on failure. 100 * @param pszRaw The zero terminated string to parse. Points a field 101 * separator. 102 * @param cbRaw Number of valid bytes in the buffer @a pszRaw points 103 * at. (Ignored since pszRaw is terminated.) 104 * @param pu16Port Where to store the port number on success. 105 */ 95 106 static int netPfStrPortParse(char *pszRaw, int cbRaw, uint16_t *pu16Port) 96 107 { 108 #if 1 109 AssertPtrReturn(pszRaw, -1); 110 AssertPtrReturn(pu16Port, -1); 111 AssertReturn(pszRaw[0] == PF_FIELD_SEPARATOR, -1); 112 113 char *pszNext = NULL; 114 int rc = RTStrToUInt16Ex(&pszRaw[1], &pszNext, 0, pu16Port); 115 if (rc == VWRN_TRAILING_CHARS) 116 AssertReturn(*pszNext == PF_FIELD_SEPARATOR, -1); 117 else if (rc == VINF_SUCCESS) 118 Assert(*pszNext == '\0'); 119 else 120 AssertMsgFailedReturn(("rc=%Rrc\n", rc), -1); 121 if (*pu16Port == 0) 122 return -1; 123 Assert((uinpttr_t)pszNext <= (uintptr_t)&pszRaw[cbRaw]); NOREF(cbRaw); 124 return (int)(pszNext - pszRaw); 125 126 #else /* The same code, just a little more verbose: */ 97 127 char *pszEndOfPort = NULL; 98 128 uint16_t u16Port = 0; … … 105 135 AssertReturn(pszRaw[0] == PF_FIELD_SEPARATOR, -1); 106 136 107 pszRaw++; /* skip lineseparator */137 pszRaw++; /* skip field separator */ 108 138 cbRaw --; 109 139 110 pszEndOfPort = RTStrStr(pszRaw, ":");140 char *pszEndOfPort = RTStrStr(pszRaw, ":"); 111 141 if (!pszEndOfPort) 112 142 { … … 146 176 147 177 return idxRaw; 178 #endif 148 179 } 149 180
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器