Changeset 40707 in vbox for trunk/src/VBox
- Timestamp:
- Mar 29, 2012 1:56:12 PM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 77166
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Parallel/DrvHostParallel.cpp
r40666 r40707 349 349 { 350 350 u32Size = 0; 351 cmRet = CM_Get_Res_Des_Data_Size((PULONG)(&u32Size), nextLogConf, 0L); /** @todo r=bird: (PULONG)(&u32Size) - generally a bad idea, but not really a problem here though... Why don't you use ULONG for the size variable? Like 'ULONG cbBuf;'? */351 cmRet = CM_Get_Res_Des_Data_Size((PULONG)(&u32Size), nextLogConf, 0L); 352 352 if (cmRet != CR_SUCCESS) 353 353 { … … 365 365 { 366 366 CM_Free_Res_Des_Handle(nextLogConf); 367 RTMemFree(pBuf); /** @todo r=bird: LocalFree(pBuf) was the wrong free function! */367 RTMemFree(pBuf); 368 368 break; 369 369 } … … 433 433 char *pCh = NULL; 434 434 char* pTmpCh = NULL; 435 if ( strstr((char*)pBuf, "LPT")) /** @todo Use IPRT equivalent? */435 if (RTStrStr((char*)pBuf, "LPT")) 436 436 { 437 437 u32ParportAddr = drvHostWinFindIORangeResource(DeviceInfoData.DevInst); … … 439 439 { 440 440 /* Find parallel port name and update the shared data struncture */ 441 pCh = strstr((char*)pBuf, "(");442 pTmpCh = strstr((char *)pBuf, ")");441 pCh = RTStrStr((char*)pBuf, "("); 442 pTmpCh = RTStrStr((char *)pBuf, ")"); 443 443 /* check for the confirmation for the availability of parallel port */ 444 444 if (!(pCh && pTmpCh)) 445 445 { 446 LogFlowFunc(("Parallel port Not Found \n"));446 LogFlowFunc(("Parallel port Not Found. \n")); 447 447 return VERR_NOT_FOUND; 448 448 449 } 450 if (((pTmpCh - (char *)pBuf) - (pCh - (char *)pBuf)) < 0) { 451 LogFlowFunc(("Parallel port string not properly formatted. \n")); 452 return VERR_NOT_FOUND; 449 453 } 450 454 /* check for the confirmation for the availability of parallel port */ 451 if ( !strncpy((char *)(pThis->u8ParportName), pCh+1, ((pTmpCh - (char *)pBuf) -452 (pCh - (char *)pBuf)) - 1))455 if (RTStrCopyEx((char *)(pThis->u8ParportName), sizeof(pThis->u8ParportName), 456 pCh+1, ((pTmpCh - (char *)pBuf) - (pCh - (char *)pBuf)) - 1)) 453 457 { 454 LogFlowFunc(("Parallel Port Not Found \n"));458 LogFlowFunc(("Parallel Port Not Found. \n")); 455 459 return VERR_NOT_FOUND; 456 460 } 457 461 *((char *)pThis->u8ParportName + (pTmpCh - (char *)pBuf) - (pCh - (char *)pBuf) + 1 ) = '\0'; 462 458 463 /* checking again to make sure that we have got a valid name and in valid format too. */ 459 if (!strstr((char *)pThis->u8ParportName, "LPT") || 464 if (RTStrNCmp((char *)pThis->u8ParportName, "LPT", 3)) { 465 LogFlowFunc(("Parallel Port name \"LPT\" Not Found. \n")); 466 return VERR_NOT_FOUND; 467 } 468 469 if (!RTStrStr((char *)pThis->u8ParportName, "LPT") || 460 470 !(pThis->u8ParportName[3] >= '0' && pThis->u8ParportName[3] <= '9')) { 461 pThis->u8ParportName[0] = '\0';462 LogFlowFunc(("Printer Port Name Not Found \n"));471 RT_BZERO(pThis->u8ParportName, sizeof(pThis->u8ParportName)); 472 LogFlowFunc(("Printer Port Name Not Found. \n")); 463 473 return VERR_NOT_FOUND; 464 474 } … … 980 990 981 991 /* If we have the char port availabe use it , else I am not getting exclusive access to parallel port. 982 Read and write will be done only if addresses are availab el992 Read and write will be done only if addresses are available 983 993 */ 984 994 if (pThis->u8ParportName) {
Note:
See TracChangeset
for help on using the changeset viewer.