Changeset 62363 in vbox
- Timestamp:
- Jul 20, 2016 3:45:58 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 20 edited
-
include/VBox/shflsvc.h (modified) (2 diffs)
-
src/VBox/Main/Makefile.kmk (modified) (1 diff)
-
src/VBox/Main/src-all/DisplayResampleImage.cpp (modified) (3 diffs)
-
src/VBox/Main/src-all/DisplayUtils.cpp (modified) (1 diff)
-
src/VBox/Main/src-all/ProgressImpl.cpp (modified) (1 diff)
-
src/VBox/Main/src-server/ApplianceImplImport.cpp (modified) (2 diffs)
-
src/VBox/Main/src-server/ClientWatcher.cpp (modified) (1 diff)
-
src/VBox/Main/src-server/HostUSBDeviceImpl.cpp (modified) (3 diffs)
-
src/VBox/Main/src-server/MediumImpl.cpp (modified) (1 diff)
-
src/VBox/Main/src-server/NetworkAdapterImpl.cpp (modified) (2 diffs)
-
src/VBox/Main/src-server/NetworkServiceRunner.cpp (modified) (1 diff)
-
src/VBox/Main/src-server/VFSExplorerImpl.cpp (modified) (3 diffs)
-
src/VBox/Main/src-server/generic/NetIf-generic.cpp (modified) (1 diff)
-
src/VBox/Main/src-server/generic/USBProxyBackendUsbIp.cpp (modified) (2 diffs)
-
src/VBox/Main/src-server/linux/NetIf-linux.cpp (modified) (2 diffs)
-
src/VBox/Main/src-server/linux/PerformanceLinux.cpp (modified) (7 diffs)
-
src/VBox/Main/src-server/linux/USBGetDevices.cpp (modified) (3 diffs)
-
src/VBox/Main/src-server/linux/USBProxyBackendLinux.cpp (modified) (1 diff)
-
src/VBox/Main/src-server/xpcom/server.cpp (modified) (1 diff)
-
src/VBox/Main/xml/Settings.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/shflsvc.h
r59204 r62363 181 181 DECLINLINE(uint32_t) ShflStringSizeOfBuffer(PCSHFLSTRING pString) 182 182 { 183 return pString ? sizeof(SHFLSTRING) - sizeof(pString->String) + pString->u16Size: 0;183 return pString ? (uint32_t)(sizeof(SHFLSTRING) - sizeof(pString->String) + pString->u16Size) : 0; 184 184 } 185 185 … … 201 201 { 202 202 pString = (PSHFLSTRING)pvBuffer; 203 pString->u16Size = u32Size - u32HeaderSize;203 pString->u16Size = (uint16_t)(u32Size - u32HeaderSize); 204 204 pString->u16Length = 0; 205 205 if (pString->u16Size >= sizeof(pString->String.ucs2[0])) -
trunk/src/VBox/Main/Makefile.kmk
r62349 r62363 306 306 307 307 ifneq ($(KBUILD_TARGET),win) 308 VBoxSVC_CXXFLAGS = -Wunused 308 VBoxSVC_CXXFLAGS = -Wunused -Wconversion 309 309 endif 310 310 -
trunk/src/VBox/Main/src-all/DisplayResampleImage.cpp
r55401 r62363 50 50 51 51 /* 2.0.10: cast instead of floor() yields 35% performance improvement. 52 Thanks to John Buckman. */52 Thanks to John Buckman. */ 53 53 54 54 #define floor2(exp) ((long) exp) … … 78 78 #define gdTrueColorGetBlue(c) ((c) & 0x0000FF) 79 79 #define gdTrueColorAlpha(r, g, b, a) (((a) << 24) + \ 80 ((r) << 16) + \81 ((g) << 8) + \82 (b))80 ((r) << 16) + \ 81 ((g) << 8) + \ 82 (b)) 83 83 84 84 void gdImageCopyResampled (uint8_t *dst, 85 uint8_t *src,86 int dstX, int dstY,87 int srcX, int srcY,88 int dstW, int dstH, int srcW, int srcH)85 uint8_t *src, 86 int dstX, int dstY, 87 int srcX, int srcY, 88 int dstW, int dstH, int srcW, int srcH) 89 89 { 90 90 int x, y; … … 94 94 sy1 = ((double) y - (double) dstY) * (double) srcH / (double) dstH; 95 95 sy2 = ((double) (y + 1) - (double) dstY) * (double) srcH / 96 (double) dstH;96 (double) dstH; 97 97 for (x = dstX; (x < dstX + dstW); x++) 98 {99 double sx, sy;100 double spixels = 0;101 double red = 0.0, green = 0.0, blue = 0.0, alpha = 0.0;102 sx1 = ((double) x - (double) dstX) * (double) srcW / dstW;103 sx2 = ((double) (x + 1) - (double) dstX) * (double) srcW / dstW;104 sy = sy1;105 do106 {107 double yportion;108 if (floor2 (sy) == floor2 (sy1))109 {110 yportion = 1.0 - (sy -floor2 (sy));111 if (yportion > sy2 - sy1)112 {113 yportion = sy2 - sy1;114 }115 sy =floor2 (sy);116 }117 else if (sy == floor2 (sy2))118 {119 yportion = sy2 -floor2 (sy2);120 }121 else122 {123 yportion = 1.0;124 }125 sx = sx1;126 do127 {128 double xportion;129 double pcontribution;130 int p;131 if (floor2 (sx) == floor2 (sx1))132 {133 xportion = 1.0 - (sx -floor2 (sx));134 if (xportion > sx2 - sx1)135 {136 xportion = sx2 - sx1;137 }138 sx =floor2 (sx);139 }140 else if (sx == floor2 (sx2))141 {142 xportion = sx2 -floor2 (sx2);143 }144 else145 {146 xportion = 1.0;147 }148 pcontribution = xportion * yportion;149 /* 2.08: previously srcX and srcY were ignored.150 Andrew Pattison */151 p = gdImageGetTrueColorPixel (src,152 (int) sx + srcX,153 (int) sy + srcY, srcW);154 red += gdTrueColorGetRed (p) * pcontribution;155 green += gdTrueColorGetGreen (p) * pcontribution;156 blue += gdTrueColorGetBlue (p) * pcontribution;157 alpha += gdTrueColorGetAlpha (p) * pcontribution;158 spixels += xportion * yportion;159 sx += 1.0;160 }161 while (sx < sx2);162 sy += 1.0;163 }164 while (sy < sy2);165 if (spixels != 0.0)166 {167 red /= spixels;168 green /= spixels;169 blue /= spixels;170 alpha /= spixels;171 }172 /* Clamping to allow for rounding errors above */173 if (red > 255.0)174 {175 red = 255.0;176 }177 if (green > 255.0)178 {179 green = 255.0;180 }181 if (blue > 255.0)182 {183 blue = 255.0;184 }185 if (alpha > gdAlphaMax)186 {187 alpha = gdAlphaMax;188 }189 gdImageSetPixel (dst,190 x, y,191 gdTrueColorAlpha ((int) red,192 (int) green,193 (int) blue, (int) alpha), dstW);194 }98 { 99 double sx, sy; 100 double spixels = 0; 101 double red = 0.0, green = 0.0, blue = 0.0, alpha = 0.0; 102 sx1 = ((double) x - (double) dstX) * (double) srcW / dstW; 103 sx2 = ((double) (x + 1) - (double) dstX) * (double) srcW / dstW; 104 sy = sy1; 105 do 106 { 107 double yportion; 108 if (floor2 (sy) == floor2 (sy1)) 109 { 110 yportion = 1.0 - (sy - (double)floor2 (sy)); 111 if (yportion > sy2 - sy1) 112 { 113 yportion = sy2 - sy1; 114 } 115 sy = (double)floor2 (sy); 116 } 117 else if (sy == floor2 (sy2)) 118 { 119 yportion = sy2 - (double)floor2 (sy2); 120 } 121 else 122 { 123 yportion = 1.0; 124 } 125 sx = sx1; 126 do 127 { 128 double xportion; 129 double pcontribution; 130 int p; 131 if (floor2 (sx) == floor2 (sx1)) 132 { 133 xportion = 1.0 - (sx - (double)floor2 (sx)); 134 if (xportion > sx2 - sx1) 135 { 136 xportion = sx2 - sx1; 137 } 138 sx = (double)floor2 (sx); 139 } 140 else if (sx == floor2 (sx2)) 141 { 142 xportion = sx2 - (double)floor2 (sx2); 143 } 144 else 145 { 146 xportion = 1.0; 147 } 148 pcontribution = xportion * yportion; 149 /* 2.08: previously srcX and srcY were ignored. 150 Andrew Pattison */ 151 p = gdImageGetTrueColorPixel (src, 152 (int) sx + srcX, 153 (int) sy + srcY, srcW); 154 red += gdTrueColorGetRed (p) * pcontribution; 155 green += gdTrueColorGetGreen (p) * pcontribution; 156 blue += gdTrueColorGetBlue (p) * pcontribution; 157 alpha += gdTrueColorGetAlpha (p) * pcontribution; 158 spixels += xportion * yportion; 159 sx += 1.0; 160 } 161 while (sx < sx2); 162 sy += 1.0; 163 } 164 while (sy < sy2); 165 if (spixels != 0.0) 166 { 167 red /= spixels; 168 green /= spixels; 169 blue /= spixels; 170 alpha /= spixels; 171 } 172 /* Clamping to allow for rounding errors above */ 173 if (red > 255.0) 174 { 175 red = 255.0; 176 } 177 if (green > 255.0) 178 { 179 green = 255.0; 180 } 181 if (blue > 255.0) 182 { 183 blue = 255.0; 184 } 185 if (alpha > gdAlphaMax) 186 { 187 alpha = gdAlphaMax; 188 } 189 gdImageSetPixel (dst, 190 x, y, 191 gdTrueColorAlpha ((int) red, 192 (int) green, 193 (int) blue, (int) alpha), dstW); 194 } 195 195 } 196 196 } -
trunk/src/VBox/Main/src-all/DisplayUtils.cpp
r54792 r62363 70 70 if (cbBlock > 2 * sizeof(uint32_t)) 71 71 { 72 cbData = cbBlock - 2 * sizeof(uint32_t);72 cbData = (uint32_t)(cbBlock - 2 * sizeof(uint32_t)); 73 73 pu8Data = (uint8_t *)RTMemAlloc(cbData); 74 74 if (pu8Data == NULL) -
trunk/src/VBox/Main/src-all/ProgressImpl.cpp
r55190 r62363 625 625 uint64_t ullTimeNow = RTTimeMilliTS(); 626 626 uint64_t ullTimeElapsed = ullTimeNow - m_ullTimestamp; 627 uint64_t ullTimeTotal = (uint64_t)( ullTimeElapsed * 100 / dPercentDone);627 uint64_t ullTimeTotal = (uint64_t)((double)ullTimeElapsed * 100 / dPercentDone); 628 628 uint64_t ullTimeRemaining = ullTimeTotal - ullTimeElapsed; 629 629 -
trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp
r62221 r62363 1299 1299 */ 1300 1300 char *pszOvfNameBase = NULL; 1301 size_t cchOvfNameBase = 0; 1301 size_t cchOvfNameBase = 0; NOREF(cchOvfNameBase); 1302 1302 unsigned cLeftToFind = 3; 1303 1303 HRESULT hrc = S_OK; … … 1447 1447 int vrc = RTVfsIoStrmReadAll(hVfsIosOvf, &pvBufferedOvf, &cbBufferedOvf); 1448 1448 uint32_t cRefs = RTVfsIoStrmRelease(hVfsIosOvf); /* consumes stream handle. */ 1449 NOREF(cRefs); 1449 1450 Assert(cRefs == 0); 1450 1451 if (RT_FAILURE(vrc)) -
trunk/src/VBox/Main/src-server/ClientWatcher.cpp
r60066 r62363 966 966 { 967 967 uOld = ASMAtomicUoReadU8(&that->mUpdateAdaptCtr); 968 uNew = uOld ? uOld - 1: uOld;968 uNew = uOld ? (uint8_t)(uOld - 1) : uOld; 969 969 } while (!ASMAtomicCmpXchgU8(&that->mUpdateAdaptCtr, uNew, uOld)); 970 970 Assert(uOld <= RT_ELEMENTS(s_aUpdateTimeoutSteps) - 1); -
trunk/src/VBox/Main/src-server/HostUSBDeviceImpl.cpp
r61667 r62363 216 216 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 217 217 218 *aVersion = mUsb->bcdUSB >> 8;218 *aVersion = (USHORT)(mUsb->bcdUSB >> 8); 219 219 220 220 return S_OK; … … 257 257 */ 258 258 if (mUsb->enmSpeed == USBDEVICESPEED_UNKNOWN) 259 *aPortVersion = mUsb->bcdUSB >> 8;259 *aPortVersion = (USHORT)(mUsb->bcdUSB >> 8); 260 260 else 261 261 { … … 459 459 alock.release(); 460 460 HRESULT hrc = i_attachToVM(aMachine, aCaptureFilename, aMaskedIfs); 461 return SUCCEEDED(hrc);461 return hrc; 462 462 } 463 463 -
trunk/src/VBox/Main/src-server/MediumImpl.cpp
r62047 r62363 8854 8854 const ComObjPtr<Medium> &pTarget = task.mMedium; 8855 8855 8856 uint64_t size = 0, logicalSize = 0; 8857 MediumVariant_T variant = MediumVariant_Standard; 8856 uint64_t size = 0; NOREF(size); 8857 uint64_t logicalSize = 0; NOREF(logicalSize); 8858 MediumVariant_T variant = MediumVariant_Standard; NOREF(variant); 8858 8859 8859 8860 /* -
trunk/src/VBox/Main/src-server/NetworkAdapterImpl.cpp
r61173 r62363 26 26 #include "VirtualBoxImpl.h" 27 27 28 #include <iprt/ctype.h> 28 29 #include <iprt/string.h> 29 30 #include <iprt/cpp/utils.h> … … 353 354 if (c >= 'a' && c <= 'f') 354 355 { 355 /** @todo the runtime lacks an ascii lower/upper conv */ 356 c &= 0xdf; 356 c = (char)RTLocCToUpper(c); 357 357 *macAddressStr = c; 358 358 } 359 359 /* we only accept capital letters */ 360 if ( ((c < '0') || (c > '9')) &&361 ((c < 'A') || (c > 'F')))360 if ( (c < '0' || c > '9') 361 && (c < 'A' || c > 'F')) 362 362 rc = setError(E_INVALIDARG, tr("Invalid MAC address format")); 363 363 /* the second digit must have even value for unicast addresses */ 364 if ((i == 1) && (!!(c & 1) == (c >= '0' && c <= '9'))) 364 if ( (i == 1) 365 && (!!(c & 1) == (c >= '0' && c <= '9'))) 365 366 rc = setError(E_INVALIDARG, tr("Invalid MAC address format")); 366 367 -
trunk/src/VBox/Main/src-server/NetworkServiceRunner.cpp
r59153 r62363 153 153 RTProcTerminate(m->mProcess); 154 154 int rc = RTProcWait(m->mProcess, RTPROCWAIT_FLAGS_BLOCK, NULL); 155 NOREF(rc); 155 156 } 156 157 -
trunk/src/VBox/Main/src-server/VFSExplorerImpl.cpp
r60448 r62363 173 173 { 174 174 int vrc = taskThread(NULL, this); 175 NOREF(vrc); 175 176 } 176 177 … … 352 353 HRESULT rc = S_OK; 353 354 354 float fPercentStep = 100.0f / aTask->filenames.size();355 float fPercentStep = 100.0f / (float)aTask->filenames.size(); 355 356 try 356 357 { … … 369 370 throw setError(VBOX_E_FILE_ERROR, tr("Can't delete file '%s' (%Rrc)"), szPath, vrc); 370 371 if (aTask->progress) 371 aTask->progress->SetCurrentOperationProgress((ULONG)(fPercentStep * i));372 aTask->progress->SetCurrentOperationProgress((ULONG)(fPercentStep * (float)i)); 372 373 } 373 374 } -
trunk/src/VBox/Main/src-server/generic/NetIf-generic.cpp
r56994 r62363 113 113 if (fp) 114 114 { 115 if (fgets(pszBuffer, cBufSize, fp))115 if (fgets(pszBuffer, (int)cBufSize, fp)) 116 116 { 117 117 if (!strncmp(VBOXNETADPCTL_NAME ":", pszBuffer, sizeof(VBOXNETADPCTL_NAME))) -
trunk/src/VBox/Main/src-server/generic/USBProxyBackendUsbIp.cpp
r61127 r62363 532 532 rc = VERR_INVALID_STATE; 533 533 } 534 aMillies -= (RT TimeMilliTS() - msPollStart);534 aMillies -= (RTMSINTERVAL)(RTTimeMilliTS() - msPollStart); 535 535 } 536 536 else if (rc == VERR_TIMEOUT) … … 667 667 { 668 668 int rc = RTPollSetRemove(m->hPollSet, USBIP_POLL_ID_SOCKET); 669 NOREF(rc); 669 670 Assert(RT_SUCCESS(rc) || rc == VERR_POLL_HANDLE_ID_NOT_FOUND); 670 671 -
trunk/src/VBox/Main/src-server/linux/NetIf-linux.cpp
r57358 r62363 145 145 RTUuidClear(&uuid); 146 146 memcpy(&uuid, Req.ifr_name, RT_MIN(sizeof(Req.ifr_name), sizeof(uuid))); 147 uuid.Gen.u8ClockSeqHiAndReserved = (u uid.Gen.u8ClockSeqHiAndReserved & 0x3f) | 0x80;148 uuid.Gen.u16TimeHiAndVersion = (u uid.Gen.u16TimeHiAndVersion & 0x0fff) | 0x4000;147 uuid.Gen.u8ClockSeqHiAndReserved = (uint8_t)((uuid.Gen.u8ClockSeqHiAndReserved & 0x3f) | 0x80); 148 uuid.Gen.u16TimeHiAndVersion = (uint16_t)((uuid.Gen.u16TimeHiAndVersion & 0x0fff) | 0x4000); 149 149 memcpy(uuid.Gen.au8Node, &Req.ifr_hwaddr.sa_data, sizeof(uuid.Gen.au8Node)); 150 150 pInfo->Uuid = uuid; … … 233 233 continue; 234 234 *pszEndOfName = 0; 235 int iFirstNonWS = strspn(buf, " ");236 char *pszName = buf +iFirstNonWS;235 size_t iFirstNonWS = strspn(buf, " "); 236 char *pszName = buf + iFirstNonWS; 237 237 NETIFINFO Info; 238 238 RT_ZERO(Info); -
trunk/src/VBox/Main/src-server/linux/PerformanceLinux.cpp
r60373 r62363 82 82 uint64_t mSingleUser, mSingleKernel, mSingleIdle; 83 83 uint32_t mHZ; 84 ULONG totalRAM;84 ULONG mTotalRAM; 85 85 }; 86 86 … … 101 101 } 102 102 else 103 mHZ = hz;103 mHZ = (uint32_t)hz; 104 104 LogFlowThisFunc(("mHZ=%u\n", mHZ)); 105 105 … … 107 107 int rc = RTSystemQueryTotalRam(&cb); 108 108 if (RT_FAILURE(rc)) 109 totalRAM = 0;109 mTotalRAM = 0; 110 110 else 111 totalRAM = (ULONG)(cb / 1024);111 mTotalRAM = (ULONG)(cb / 1024); 112 112 } 113 113 … … 212 212 int CollectorLinux::getHostMemoryUsage(ULONG *total, ULONG *used, ULONG *available) 213 213 { 214 AssertReturn( totalRAM, VERR_INTERNAL_ERROR);214 AssertReturn(mTotalRAM, VERR_INTERNAL_ERROR); 215 215 uint64_t cb; 216 216 int rc = RTSystemQueryAvailableRam(&cb); 217 217 if (RT_SUCCESS(rc)) 218 218 { 219 *total = totalRAM;220 *available = cb / 1024;219 *total = mTotalRAM; 220 *available = (ULONG)(cb / 1024); 221 221 *used = *total - *available; 222 222 } … … 413 413 char *CollectorLinux::trimNewline(char *pszName) 414 414 { 415 unsignedcbName = strlen(pszName);415 size_t cbName = strlen(pszName); 416 416 if (cbName == 0) 417 417 return pszName; … … 427 427 char *CollectorLinux::trimTrailingDigits(char *pszName) 428 428 { 429 unsignedcbName = strlen(pszName);429 size_t cbName = strlen(pszName); 430 430 if (cbName == 0) 431 431 return pszName; … … 452 452 { 453 453 unsigned cbName = 0; 454 unsignedcbDevName = strlen(pszDevName);454 size_t cbDevName = strlen(pszDevName); 455 455 const char *pszEnd = pszDevName + cbDevName - 1; 456 456 if (fTrimDigits) -
trunk/src/VBox/Main/src-server/linux/USBGetDevices.cpp
r62343 r62363 376 376 * Set the value. 377 377 */ 378 *pu16 = (uint16_t) u32Int << 8 | (uint16_t)u32Dec;378 *pu16 = (uint16_t)((u32Int << 8) | (uint16_t)u32Dec); 379 379 } 380 380 return VINF_SUCCESS; … … 1179 1179 1180 1180 /* usbfs compatibility, 0-based port number. */ 1181 *pu8Port -= 1;1181 *pu8Port = (uint8_t)(*pu8Port - 1); 1182 1182 return VINF_SUCCESS; 1183 1183 } … … 1284 1284 /* Fill in the simple fields */ 1285 1285 pDev->enmState = USBDEVICESTATE_UNUSED; 1286 pDev->bBus = usbsysfsGetBusFromPath(pszSysfsPath);1286 pDev->bBus = (uint8_t)usbsysfsGetBusFromPath(pszSysfsPath); 1287 1287 pDev->bDeviceClass = usbsysfsReadDevicePropertyU8Def(16, 0, "%s/bDeviceClass", pszSysfsPath); 1288 1288 pDev->bDeviceSubClass = usbsysfsReadDevicePropertyU8Def(16, 0, "%s/bDeviceSubClass", pszSysfsPath); -
trunk/src/VBox/Main/src-server/linux/USBProxyBackendLinux.cpp
r61423 r62363 321 321 322 322 RT_ZERO(PollFds); 323 PollFds[0].fd = RTFileToNative(mhFile);323 PollFds[0].fd = (int)RTFileToNative(mhFile); 324 324 PollFds[0].events = POLLIN; 325 PollFds[1].fd = RTPipeToNative(mhWakeupPipeR);325 PollFds[1].fd = (int)RTPipeToNative(mhWakeupPipeR); 326 326 PollFds[1].events = POLLIN | POLLERR | POLLHUP; 327 327 -
trunk/src/VBox/Main/src-server/xpcom/server.cpp
r62222 r62363 838 838 { 839 839 char szBuf[80]; 840 int iSize;841 842 iSize = RTStrPrintf(szBuf, sizeof(szBuf),840 size_t cSize; 841 842 cSize = RTStrPrintf(szBuf, sizeof(szBuf), 843 843 VBOX_PRODUCT" XPCOM Server Version " 844 844 VBOX_VERSION_STRING); 845 for ( int i = iSize; i > 0; i--)845 for (size_t i = cSize; i > 0; i--) 846 846 putchar('*'); 847 847 RTPrintf("\n%s\n", szBuf); -
trunk/src/VBox/Main/xml/Settings.cpp
r62339 r62363 907 907 (*pf)->getAttributeValue("hostip", rule.strHostIP); 908 908 (*pf)->getAttributeValue("hostport", port); 909 rule.u16HostPort = port;909 rule.u16HostPort = (uint16_t)port; 910 910 (*pf)->getAttributeValue("guestip", rule.strGuestIP); 911 911 (*pf)->getAttributeValue("guestport", port); 912 rule.u16GuestPort = port;912 rule.u16GuestPort = (uint16_t)port; 913 913 mapRules.insert(std::make_pair(rule.strName, rule)); 914 914 }
Note:
See TracChangeset
for help on using the changeset viewer.

