- Timestamp:
- Aug 2, 2001, 10:36:35 PM (24 years ago)
- Location:
- trunk/src/helpers
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/helpers/apps.c
r78 r91 210 210 { 211 211 PSZ *ppszThis = pEnv->papszVars; 212 PSZ pszThis;212 // PSZ pszThis; 213 213 ULONG ul = 0; 214 214 ULONG ulVarNameLen = 0; … … 233 233 ul++) 234 234 { 235 pszThis = *ppszThis;236 237 235 if (strnicmp(*ppszThis, pszSearch, ulVarNameLen) == 0) 238 236 { -
trunk/src/helpers/cctl_chart.c
r68 r91 423 423 { 424 424 HRGN hrgnThis; 425 SHORT sSweepAngle,426 sStartAngle; 425 /* SHORT sSweepAngle, 426 sStartAngle; */ 427 427 428 428 GpiSetCurrentPosition(hpsMem, &ptlLowerLeft); … … 1457 1457 LONG ly) 1458 1458 { 1459 LONG lRegionFound = -1; // none1459 // LONG lRegionFound = -1; // none 1460 1460 1461 1461 POINTL ptlMouse = {lx, ly}; -
trunk/src/helpers/cctl_tooltip.c
r82 r91 1224 1224 1225 1225 POINTL ptlPointer; 1226 HPS hps;1226 // HPS hps; 1227 1227 1228 1228 // free old text -
trunk/src/helpers/comctl.c
r81 r91 310 310 *@@added V0.9.0 [umoeller] 311 311 *@@changed V0.9.2 (2000-02-28) [umoeller]: menu was displayed even if button was disabled; fixed 312 *@@changed V0.9.14 (2001-07-31) [umoeller]: fixed WM_MENUEND submenu quirk 312 313 */ 313 314 … … 486 487 case WM_MENUEND: 487 488 { 488 BOOL fUnHilite = TRUE; 489 // _Pmpf(("WM_MENUEND")); 490 // At this point, the menu has been 491 // destroyed already. 492 // Since WM_BUTTON1UP handles the 493 // default case that the user presses 494 // the menu button a second time while 495 // the menu is open, we only need 496 // to handle the case that the user 497 // c) presses some key on the menu (ESC, menu selection) or 498 // a) selects a menu item (which 499 // dismisses the menu) or 500 // b) clicks anywhere else. 501 502 // Case a) if mouse button 1 is not currently down 503 if ((WinGetKeyState(HWND_DESKTOP, VK_BUTTON1) & 0x8000) == 0) 504 // button 1 _not_ down: 505 // must be keyboard 506 fUnHilite = TRUE; 507 else 508 // button 1 _is_ down: 509 // query window under mouse pointer 510 ; 511 512 if (fUnHilite) 489 if ((HWND)mp2 == pmbd->hwndMenu) // V0.9.14 (2001-07-31) [umoeller] 513 490 { 514 // _Pmpf((" Unsinking menu WM_MENUEND")); 515 pmbd->fButtonSunk = FALSE; 516 WinSendMsg(hwndButton, 517 BM_SETHILITE, 518 (MPARAM)FALSE, 519 (MPARAM)0); 520 } 521 pmbd->hwndMenu = NULLHANDLE; 491 BOOL fUnHilite = TRUE; 492 // _Pmpf(("WM_MENUEND")); 493 // At this point, the menu has been 494 // destroyed already. 495 // Since WM_BUTTON1UP handles the 496 // default case that the user presses 497 // the menu button a second time while 498 // the menu is open, we only need 499 // to handle the case that the user 500 // c) presses some key on the menu (ESC, menu selection) or 501 // a) selects a menu item (which 502 // dismisses the menu) or 503 // b) clicks anywhere else. 504 505 // Case a) if mouse button 1 is not currently down 506 if ((WinGetKeyState(HWND_DESKTOP, VK_BUTTON1) & 0x8000) == 0) 507 // button 1 _not_ down: 508 // must be keyboard 509 fUnHilite = TRUE; 510 else 511 // button 1 _is_ down: 512 // query window under mouse pointer 513 ; 514 515 if (fUnHilite) 516 { 517 // _Pmpf((" Unsinking menu WM_MENUEND")); 518 pmbd->fButtonSunk = FALSE; 519 WinSendMsg(hwndButton, 520 BM_SETHILITE, 521 (MPARAM)FALSE, 522 (MPARAM)0); 523 } 524 pmbd->hwndMenu = NULLHANDLE; 525 } // end if ((HWND)mp1 == pmbd->pmbd->hwndMenu) // V0.9.14 (2001-07-31) [umoeller] 522 526 break; } 523 527 -
trunk/src/helpers/configsys.c
r71 r91 378 378 { 379 379 // key found in file: 380 ULONG ulOfs;380 // ULONG ulOfs; 381 381 382 382 // replace existing parameter -
trunk/src/helpers/dialog.c
r89 r91 110 110 const char *pcszControlsFont; // from dlghCreateDlg 111 111 112 // V0.9.14 (2001-08-01) [umoeller] 112 113 HPS hps; 113 /* const char *pcszFontLast; 114 LONG lcidLast; */ 114 const char *pcszFontLast; 115 LONG lcidLast; 116 FONTMETRICS fmLast; 117 115 118 } DLGPRIVATE, *PDLGPRIVATE; 116 119 … … 148 151 BOOL fIsNestedTable; // if TRUE, pvDefinition points to a nested TABLEDEF; 149 152 // if FALSE, pvDefinition points to a CONTROLDEF as 150 // specified by the user153 // specified by the caller 151 154 152 155 PVOID pvDefinition; // either a PTABLEDEF or a PCONTROLDEF … … 225 228 *@@changed V0.9.12 (2001-05-31) [umoeller]: fixed various things with statics 226 229 *@@changed V0.9.12 (2001-05-31) [umoeller]: fixed broken fonts 230 *@@changed V0.9.14 (2001-08-01) [umoeller]: now caching fonts, which is significantly faster 227 231 */ 228 232 … … 232 236 PDLGPRIVATE pDlgData) 233 237 { 234 BOOL fFind = FALSE;235 RECTL rclText;236 LONG lcid = 0;237 238 238 const char *pcszFontThis = pControlDef->pcszFont; 239 239 // can be NULL, … … 248 248 if (pcszFontThis) 249 249 { 250 FONTMETRICS fm;251 250 LONG lPointSize = 0; 252 251 253 // create new font 254 lcid = gpihFindPresFont(NULLHANDLE, // no window yet 255 FALSE, 256 pDlgData->hps, 257 pcszFontThis, 258 &fm, 259 &lPointSize); 260 GpiSetCharSet(pDlgData->hps, lcid); 261 if (fm.fsDefn & FM_DEFN_OUTLINE) 262 gpihSetPointSize(pDlgData->hps, lPointSize); 263 264 pszlAuto->cy = fm.lMaxBaselineExt + fm.lExternalLeading; 252 // check if we can reuse font data from last time 253 // V0.9.14 (2001-08-01) [umoeller] 254 if (strhcmp(pcszFontThis, 255 pDlgData->pcszFontLast)) 256 { 257 // different font than last time: 258 259 // delete old font? 260 if (pDlgData->lcidLast) 261 { 262 GpiSetCharSet(pDlgData->hps, LCID_DEFAULT); 263 GpiDeleteSetId(pDlgData->hps, pDlgData->lcidLast); 264 } 265 266 // create new font 267 pDlgData->lcidLast = gpihFindPresFont(NULLHANDLE, // no window yet 268 FALSE, 269 pDlgData->hps, 270 pcszFontThis, 271 &pDlgData->fmLast, 272 &lPointSize); 273 274 GpiSetCharSet(pDlgData->hps, pDlgData->lcidLast); 275 if (pDlgData->fmLast.fsDefn & FM_DEFN_OUTLINE) 276 gpihSetPointSize(pDlgData->hps, lPointSize); 277 278 pDlgData->pcszFontLast = pcszFontThis; 279 } 280 281 pszlAuto->cy = pDlgData->fmLast.lMaxBaselineExt 282 + pDlgData->fmLast.lExternalLeading; 265 283 } 266 284 … … 300 318 } 301 319 } 302 303 /* if (lcid)304 {305 GpiSetCharSet(pDlgData->hps, LCID_DEFAULT);306 GpiDeleteSetId(pDlgData->hps, lcid);307 } */308 309 320 } 310 321 … … 336 347 | BS_CHECKBOX 337 348 | BS_RADIOBUTTON)) 349 { 350 // give a little extra width for the box bitmap 338 351 pszlAuto->cx += 20; // @@todo 352 // and height 353 pszlAuto->cy += 2; 354 } 339 355 else if (pControlDef->flStyle & BS_BITMAP) 340 356 ; … … 722 738 PDLGPRIVATE pDlgData) 723 739 { 724 ULONG ul;740 // ULONG ul; 725 741 LONG lX; 726 742 PLISTNODE pNode; … … 791 807 PDLGPRIVATE pDlgData) 792 808 { 793 ULONG ul;809 // ULONG ul; 794 810 LONG lY; 795 811 PLISTNODE pNode; … … 864 880 PROCESSMODE ProcessMode) 865 881 { 866 ULONG ul;882 // ULONG ul; 867 883 PLISTNODE pNode; 868 884 CONTROLPOS cpTable; … … 943 959 944 960 return (arc); 961 } 962 963 /* 964 *@@ FreeTable: 965 * frees the specified table and recurses 966 * into nested tables, if necessary. 967 * 968 * This was added with V0.9.14 to fix the 969 * bad memory leaks with nested tables. 970 * 971 *@@added V0.9.14 (2001-08-01) [umoeller] 972 */ 973 974 VOID FreeTable(PTABLEDEF pTable) 975 { 976 // for each table, clean up the rows 977 PLISTNODE pRowNode; 978 FOR_ALL_NODES(&pTable->llRows, pRowNode) 979 { 980 PROWDEF pRow = (PROWDEF)pRowNode->pItemData; 981 982 // for each row, clean up the columns 983 PLISTNODE pColumnNode; 984 FOR_ALL_NODES(&pRow->llColumns, pColumnNode) 985 { 986 PCOLUMNDEF pColumn = (PCOLUMNDEF)pColumnNode->pItemData; 987 988 if (pColumn->fIsNestedTable) 989 { 990 // nested table: recurse! 991 PTABLEDEF pNestedTable = (PTABLEDEF)pColumn->pvDefinition; 992 FreeTable(pNestedTable); 993 } 994 995 free(pColumn); 996 } 997 lstClear(&pRow->llColumns); 998 999 free(pRow); 1000 } 1001 lstClear(&pTable->llRows); 1002 1003 free(pTable); 945 1004 } 946 1005 … … 1181 1240 * 1182 1241 *@@changed V0.9.14 (2001-07-07) [umoeller]: fixed disabled mouse with hwndOwner == HWND_DESKTOP 1242 *@@changed V0.9.14 (2001-08-01) [umoeller]: fixed major memory leaks with nested tables 1183 1243 */ 1184 1244 … … 1270 1330 // create "table" column for this 1271 1331 PCOLUMNDEF pColumnDef; 1272 arc = CreateColumn(pCurrentRow,1273 TRUE, // nested table1274 pCurrentTable,1275 &pColumnDef);1276 if (!arc)1277 lstAppendItem(&pCurrentRow->llColumns,pColumnDef);1332 if (!(arc = CreateColumn(pCurrentRow, 1333 TRUE, // nested table 1334 pCurrentTable, 1335 &pColumnDef))) 1336 lstAppendItem(&pCurrentRow->llColumns, 1337 pColumnDef); 1278 1338 } 1279 1339 } … … 1319 1379 { 1320 1380 PCOLUMNDEF pColumnDef; 1321 arc = CreateColumn(pCurrentRow,1322 FALSE, // no nested table1323 (PVOID)pItemThis->ulData,1324 &pColumnDef);1325 if (!arc)1326 lstAppendItem(&pCurrentRow->llColumns,pColumnDef);1381 if (!(arc = CreateColumn(pCurrentRow, 1382 FALSE, // no nested table 1383 (PVOID)pItemThis->ulData, 1384 &pColumnDef))) 1385 lstAppendItem(&pCurrentRow->llColumns, 1386 pColumnDef); 1327 1387 break; } 1328 1388 … … 1416 1476 PROCESS_CALC_SIZES); 1417 1477 1478 if (pDlgData->lcidLast) 1479 { 1480 GpiSetCharSet(pDlgData->hps, LCID_DEFAULT); 1481 GpiDeleteSetId(pDlgData->hps, pDlgData->lcidLast); 1482 } 1418 1483 if (pDlgData->hps) 1419 1484 WinReleasePS(pDlgData->hps); … … 1506 1571 PTABLEDEF pTable = (PTABLEDEF)pTableNode->pItemData; 1507 1572 1508 // for each table, clean up the rows 1509 PLISTNODE pRowNode; 1510 FOR_ALL_NODES(&pTable->llRows, pRowNode) 1511 { 1512 PROWDEF pRow = (PROWDEF)pRowNode->pItemData; 1513 1514 // for each row, clean up the columns 1515 PLISTNODE pColumnNode; 1516 FOR_ALL_NODES(&pRow->llColumns, pColumnNode) 1517 { 1518 PCOLUMNDEF pColumn = (PCOLUMNDEF)pColumnNode->pItemData; 1519 free(pColumn); 1520 } 1521 lstClear(&pRow->llColumns); 1522 1523 free(pRow); 1524 } 1525 lstClear(&pTable->llRows); 1526 1527 free(pTable); 1573 FreeTable(pTable); 1574 // this may recurse for nested tables 1528 1575 } 1529 1576 … … 1532 1579 1533 1580 free(pDlgData); 1581 } 1582 1583 if (arc) 1584 { 1585 CHAR szErr[300]; 1586 sprintf(szErr, "Error %d occured in dlghCreateDlg.", arc); 1587 winhDebugBox(hwndOwner, 1588 "Error in Dialog Manager", 1589 szErr); 1534 1590 } 1535 1591 -
trunk/src/helpers/dosh.c
r86 r91 375 375 */ 376 376 377 APIRET doshIsFixedDisk(ULONG 378 PBOOL 377 APIRET doshIsFixedDisk(ULONG ulLogicalDrive, // in: 1 for A:, 2 for B:, 3 for C:, ... 378 PBOOL pfFixed) // out: TRUE for fixed disks 379 379 { 380 380 APIRET arc = ERROR_INVALID_DRIVE; … … 505 505 && (pdp->usSectorsPerTrack == (USHORT)-1) 506 506 ); 507 } 508 509 /* 510 *@@ doshHasAudioCD: 511 * sets *pfAudio to whether ulLogicalDrive 512 * currently has an audio CD inserted. 513 * 514 * Better call this only if you're sure that 515 * ulLogicalDrive is a CD-ROM drive. Use 516 * doshIsCDROM to check. 517 * 518 *@@added V0.9.14 (2001-08-01) [umoeller] 519 */ 520 521 APIRET doshHasAudioCD(ULONG ulLogicalDrive, 522 BOOL fMixedModeCD, 523 PBOOL pfAudio) 524 { 525 APIRET arc = NO_ERROR; 526 527 HFILE hfDrive = 0; 528 ULONG ulTemp = 0; 529 530 CHAR szDrive[3] = "C:"; 531 szDrive[0] = 'A' + ulLogicalDrive - 1; 532 533 *pfAudio = FALSE; 534 535 arc = DosOpen(szDrive, // "C:", "D:", ... 536 &hfDrive, 537 &ulTemp, 538 0, 539 FILE_NORMAL, 540 OPEN_ACTION_FAIL_IF_NEW 541 | OPEN_ACTION_OPEN_IF_EXISTS, 542 OPEN_FLAGS_DASD 543 | OPEN_FLAGS_FAIL_ON_ERROR 544 | OPEN_FLAGS_NOINHERIT // V0.9.6 (2000-11-25) [pr] 545 // | OPEN_ACCESS_READONLY // V0.9.13 (2001-06-14) [umoeller] 546 | OPEN_SHARE_DENYNONE, 547 NULL); 548 549 // _Pmpf((" DosOpen(OPEN_FLAGS_DASD) returned %d", arc)); 550 551 // this still returns NO_ERROR for audio CDs in a 552 // CD-ROM drive... 553 // however, the WPS then attempts to read in the 554 // root directory for audio CDs, which produces 555 // a "sector not found" error box... 556 557 if (!arc && hfDrive) // determined above 558 { 559 ULONG ulAudioTracks = 0, 560 ulDataTracks = 0; 561 562 CHAR cds1[4] = { 'C', 'D', '0', '1' }; 563 CHAR cds2[4]; 564 // check for proper driver signature 565 if (!(arc = doshDevIOCtl(hfDrive, 566 IOCTL_CDROMDISK, 567 CDROMDISK_GETDRIVER, 568 &cds1, sizeof(cds1), 569 &cds2, sizeof(cds2)))) 570 { 571 if (memcmp(&cds1, &cds2, 4)) 572 // this is not a CD-ROM then: 573 arc = NO_ERROR; 574 else 575 { 576 struct { 577 UCHAR ucFirstTrack, 578 ucLastTrack; 579 ULONG ulLeadOut; 580 } cdat; 581 582 // get track count 583 if (!(arc = doshDevIOCtl(hfDrive, 584 IOCTL_CDROMAUDIO, 585 CDROMAUDIO_GETAUDIODISK, 586 &cds1, sizeof(cds1), 587 &cdat, sizeof(cdat)))) 588 { 589 // still no error: build the audio TOC 590 ULONG i; 591 for (i = cdat.ucFirstTrack; 592 i <= cdat.ucLastTrack; 593 i++) 594 { 595 BYTE cdtp[5] = 596 { 'C', 'D', '0', '1', (UCHAR)i }; 597 598 struct { 599 ULONG ulTrackAddress; 600 BYTE bFlags; 601 } trackdata; 602 603 if (!(arc = doshDevIOCtl(hfDrive, 604 IOCTL_CDROMAUDIO, 605 CDROMAUDIO_GETAUDIOTRACK, 606 &cdtp, sizeof(cdtp), 607 &trackdata, sizeof(trackdata)))) 608 { 609 if (trackdata.bFlags & 64) 610 ulDataTracks++; 611 else 612 { 613 ulAudioTracks++; 614 615 if (!fMixedModeCD) 616 { 617 // caller doesn't want mixed mode: 618 // stop here 619 ulDataTracks = 0; 620 break; 621 } 622 } 623 } 624 } 625 626 // _Pmpf((" got %d audio, %d data tracks", 627 // ulAudioTracks, ulDataTracks)); 628 629 if (!ulDataTracks) 630 *pfAudio = TRUE; 631 } 632 else 633 { 634 // not audio disk: 635 // go on then 636 // _Pmpf((" CDROMAUDIO_GETAUDIODISK returned %d", arc)); 637 arc = NO_ERROR; 638 } 639 } 640 } 641 else 642 { 643 // not CD-ROM: go on then 644 // _Pmpf((" CDROMDISK_GETDRIVER returned %d", arc)); 645 arc = NO_ERROR; 646 } 647 } 648 649 if (hfDrive) 650 DosClose(hfDrive); 651 652 return (arc); 507 653 } 508 654 … … 679 825 ULONG fl) // in: ASSERTFL_* flags 680 826 { 681 HFILE hfDrive = 0;682 ULONG ulTemp = 0;683 827 APIRET arc = NO_ERROR; 684 828 BOOL fFixed = FALSE, … … 713 857 } 714 858 715 if (!arc) 716 { 717 CHAR szDrive[3] = "C:"; 718 szDrive[0] = 'A' + ulLogicalDrive - 1; 719 arc = DosOpen(szDrive, // "C:", "D:", ... 720 &hfDrive, 721 &ulTemp, 722 0, 723 FILE_NORMAL, 724 OPEN_ACTION_FAIL_IF_NEW 725 | OPEN_ACTION_OPEN_IF_EXISTS, 726 OPEN_FLAGS_DASD 727 | OPEN_FLAGS_FAIL_ON_ERROR 728 | OPEN_FLAGS_NOINHERIT // V0.9.6 (2000-11-25) [pr] 729 // | OPEN_ACCESS_READONLY // V0.9.13 (2001-06-14) [umoeller] 730 | OPEN_SHARE_DENYNONE, 731 NULL); 732 733 // _Pmpf((" DosOpen(OPEN_FLAGS_DASD) returned %d", arc)); 734 735 // this still returns NO_ERROR for audio CDs in a 736 // CD-ROM drive... 737 // however, the WPS then attempts to read in the 738 // root directory for audio CDs, which produces 739 // a "sector not found" error box... 740 741 if (!arc && hfDrive && fCDROM) // determined above 742 { 743 ULONG ulAudioTracks = 0, 744 ulDataTracks = 0; 745 746 CHAR cds1[4] = { 'C', 'D', '0', '1' }; 747 CHAR cds2[4]; 748 // check for proper driver signature 749 if (!(arc = doshDevIOCtl(hfDrive, 750 IOCTL_CDROMDISK, 751 CDROMDISK_GETDRIVER, 752 &cds1, sizeof(cds1), 753 &cds2, sizeof(cds2)))) 754 { 755 if (memcmp(&cds1, &cds2, 4)) 756 // this is not a CD-ROM then: 757 arc = NO_ERROR; 758 else 759 { 760 struct { 761 UCHAR ucFirstTrack, 762 ucLastTrack; 763 ULONG ulLeadOut; 764 } cdat; 765 766 // get track count 767 if (!(arc = doshDevIOCtl(hfDrive, 768 IOCTL_CDROMAUDIO, 769 CDROMAUDIO_GETAUDIODISK, 770 &cds1, sizeof(cds1), 771 &cdat, sizeof(cdat)))) 772 { 773 // still no error: build the audio TOC 774 ULONG i; 775 for (i = cdat.ucFirstTrack; 776 i <= cdat.ucLastTrack; 777 i++) 778 { 779 BYTE cdtp[5] = 780 { 'C', 'D', '0', '1', (UCHAR)i }; 781 782 struct { 783 ULONG ulTrackAddress; 784 BYTE bFlags; 785 } trackdata; 786 787 if (!(arc = doshDevIOCtl(hfDrive, 788 IOCTL_CDROMAUDIO, 789 CDROMAUDIO_GETAUDIOTRACK, 790 &cdtp, sizeof(cdtp), 791 &trackdata, sizeof(trackdata)))) 792 { 793 if (trackdata.bFlags & 64) 794 ulDataTracks++; 795 else 796 { 797 ulAudioTracks++; 798 799 if (!(fl & ASSERTFL_MIXEDMODECD)) 800 { 801 // caller doesn't want mixed mode: 802 // stop here 803 ulDataTracks = 0; 804 break; 805 } 806 } 807 } 808 } 809 810 // _Pmpf((" got %d audio, %d data tracks", 811 // ulAudioTracks, ulDataTracks)); 812 813 if (!ulDataTracks) 814 arc = ERROR_AUDIO_CD_ROM; // special private error code (10000) 815 } 816 else 817 { 818 // not audio disk: 819 // go on then 820 // _Pmpf((" CDROMAUDIO_GETAUDIODISK returned %d", arc)); 821 arc = NO_ERROR; 822 } 823 } 824 } 825 else 826 { 827 // not CD-ROM: go on then 828 // _Pmpf((" CDROMDISK_GETDRIVER returned %d", arc)); 829 arc = NO_ERROR; 830 } 831 } 859 if ((!arc) && (fCDROM)) 860 { 861 BOOL fAudio; 862 if ( (!(arc = doshHasAudioCD(ulLogicalDrive, 863 ((fl & ASSERTFL_MIXEDMODECD) != 0), 864 &fAudio))) 865 && (fAudio) 866 ) 867 arc = ERROR_AUDIO_CD_ROM; // special private error code (10000) 832 868 } 833 869 … … 867 903 } 868 904 869 if (hfDrive)870 DosClose(hfDrive);871 872 905 return (arc); 873 906 } … … 887 920 CHAR name[3] = "?:"; 888 921 ULONG fd = 0, 889 action = 0 ,890 paramsize = 0, 891 datasize = 0;922 action = 0; 923 // paramsize = 0; 924 // datasize = 0; 892 925 APIRET rc = NO_ERROR; 893 926 USHORT data, … … 913 946 param = 0; 914 947 data = (USHORT)ulLogicalDrive; 915 paramsize = sizeof(param);916 datasize = sizeof(data);948 // paramsize = sizeof(param); 949 // datasize = sizeof(data); 917 950 rc = doshDevIOCtl(fd, 918 951 IOCTL_DISK, DSK_SETLOGICALMAP, … … 941 974 APIRET arc = NO_ERROR; 942 975 FSALLOCATE fsa; 943 double dbl = -1;976 // double dbl = -1; 944 977 945 978 if (!(arc = DosQueryFSInfo(ulLogicalDrive, FSIL_ALLOC, &fsa, sizeof(fsa)))) … … 967 1000 APIRET arc = NO_ERROR; 968 1001 FSALLOCATE fsa; 969 double dbl = -1;1002 // double dbl = -1; 970 1003 971 1004 if (!(arc = DosQueryFSInfo(ulLogicalDrive, FSIL_ALLOC, &fsa, sizeof(fsa)))) … … 983 1016 * 984 1017 *@@changed V0.9.1 (99-12-12) [umoeller]: added cbBuf to prototype 1018 *@@changed V0.9.14 (2001-08-01) [umoeller]: fixed, this never respected cbBuf 985 1019 */ 986 1020 … … 1015 1049 // Each data field following fsqBuffer.szName begins 1016 1050 // immediately after the previous item. 1017 strcpy(pszBuf, 1018 (CHAR*)(&pfsqBuffer->szName) + pfsqBuffer->cbName + 1); 1051 strncpy(pszBuf, 1052 (CHAR*)(&pfsqBuffer->szName) + pfsqBuffer->cbName + 1, 1053 cbBuf); // V0.9.14 (2001-08-01) [umoeller] 1054 *(pszBuf + cbBuf) = '\0'; 1019 1055 } 1020 1056 } … … 2462 2498 ********************************************************************/ 2463 2499 2464 static PVOID G_pvGlobalInfoSeg = NULL,2500 static PVOID // G_pvGlobalInfoSeg = NULL, 2465 2501 G_pvLocalInfoSeg = NULL; 2466 2502 … … 2482 2518 &LocalInfoSegSelector); 2483 2519 // thunk 2484 G_pvGlobalInfoSeg = (PVOID)( (GlobalInfoSegSelector << 0x000D)2485 & 0x01fff0000); 2520 /* G_pvGlobalInfoSeg = (PVOID)( (GlobalInfoSegSelector << 0x000D) 2521 & 0x01fff0000); */ 2486 2522 G_pvLocalInfoSeg = (PVOID)( (LocalInfoSegSelector << 0x000D) 2487 2523 & 0x01fff0000); -
trunk/src/helpers/dosh2.c
r76 r91 753 753 VOID ParseBldLevel(PEXECUTABLE pExec) 754 754 { 755 const char *pStartOfAuthor = 0,755 const char // *pStartOfAuthor = 0, 756 756 *pStartOfVendor = 0; 757 757 … … 1601 1601 BYTE bLen; 1602 1602 CHAR achName[256]; 1603 int i;1603 // int i; 1604 1604 1605 1605 ENSURE(DosRead(pExec->hfExe, &bLen, 1, &ulDummy)); … … 1747 1747 if (cFunctions) 1748 1748 { 1749 USHORT usOrdinal = 1,1750 usCurrent = 0;1749 // USHORT usOrdinal = 1; 1750 // usCurrent = 0; 1751 1751 1752 1752 paFunctions = (PFSYSFUNCTION)malloc(sizeof(FSYSFUNCTION) * cFunctions); … … 3707 3707 ADDRESS hDrive = pDriveControlRecord->Drive_Handle; 3708 3708 3709 Drive_Information_Record pDriveInfoRecord3709 /* Drive_Information_Record pDriveInfoRecord 3710 3710 = pLVMInfo->Get_Drive_Status(hDrive, 3711 3711 &Error); … … 3713 3713 _Pmpf((" drive %d Get_Drive_Status Error: %d", ulDisk, Error)); 3714 3714 3715 if (!Error) 3715 if (!Error) */ 3716 3716 { 3717 3717 Partition_Information_Array PIA … … 3770 3770 } 3771 3771 } 3772 else3772 /* else 3773 3773 // error: 3774 break; 3774 break; */ 3775 3775 } 3776 3776 -
trunk/src/helpers/gpih.c
r81 r91 603 603 * 604 604 * gpihFindFont uses this mutex. If you call GpiCreateLogFont 605 * yourself somewhere, do this after you called this function. 605 * yourself somewhere, you should do this under the protection 606 * of this function. 606 607 * 607 608 * Call gpihUnlockLCIDs to unlock. … … 612 613 BOOL gpihLockLCIDs(VOID) 613 614 { 614 BOOL brc = FALSE; 615 616 if (G_hmtxLCIDs == NULLHANDLE) 615 if (!G_hmtxLCIDs) 617 616 // first call: create 618 brc = !DosCreateMutexSem(NULL, 619 &G_hmtxLCIDs, 620 0, 621 TRUE); // request! 622 else 623 // subsequent calls: request 624 brc = !WinRequestMutexSem(G_hmtxLCIDs, SEM_INDEFINITE_WAIT); 625 626 return (brc); 617 return (!DosCreateMutexSem(NULL, 618 &G_hmtxLCIDs, 619 0, 620 TRUE)); // request! 621 622 // subsequent calls: request 623 return (!WinRequestMutexSem(G_hmtxLCIDs, SEM_INDEFINITE_WAIT)); 627 624 } 628 625 … … 741 738 if (allcids) 742 739 free(allcids); 743 744 /*745 PLONG pBase;746 APIRET arc;747 748 // _Pmpf(("gpihQueryNextFontID: calling DosAllocMem"));749 750 arc = DosAllocMem((PPVOID)(&pBase),751 GQNCL_BLOCK_SIZE,752 // space is needed for an array of lCount longs.753 PAG_READ |754 PAG_WRITE);755 if (arc == NO_ERROR)756 {757 arc = DosSubSetMem(pBase,758 DOSSUB_INIT | DOSSUB_SPARSE_OBJ,759 GQNCL_BLOCK_SIZE);760 if (arc == NO_ERROR)761 {762 PLONG alTypes; // object types763 PSTR8 aNames; // font names764 PLONG allcids; // local identifiers765 766 arc = DosSubAllocMem((PVOID)pBase,767 (PPVOID)(&aNames),768 (ULONG)(lCount*(ULONG)sizeof(STR8)));769 // space is needed for an array of770 // lCount longs771 if (arc == NO_ERROR)772 {773 arc = DosSubAllocMem((PVOID)pBase,774 (PPVOID)(&allcids),775 (ULONG)lCount*sizeof(LONG));776 // space is needed for an array of777 // lCount longs.778 if (arc == NO_ERROR)779 {780 arc = DosSubAllocMem((PVOID)pBase,781 (PPVOID)(&alTypes),782 (ULONG)lCount*sizeof(LONG));783 // space is needed for an array of784 // lCount longs.785 if (arc == NO_ERROR)786 {787 if (GpiQuerySetIds(hps,788 lCount,789 alTypes,790 aNames,791 allcids))792 {793 // FINALLY we have all the lcids in use.794 BOOL fContinue = TRUE;795 lcidNext = 1;796 797 // now, check if this lcid is in use already:798 while (fContinue)799 {800 BOOL fFound = FALSE;801 ULONG ul;802 fContinue = FALSE;803 for (ul = 0;804 ul < lCount;805 ul++)806 {807 if (allcids[ul] == lcidNext)808 {809 fFound = TRUE;810 break;811 }812 }813 814 if (fFound)815 {816 // lcid found:817 // try next higher one818 lcidNext++;819 fContinue = TRUE;820 }821 // else: return that one822 }823 }824 }825 }826 }827 }828 829 arc = DosFreeMem(pBase);830 }831 */832 740 } 833 741 … … 1006 914 *@@changed V0.9.4 (2000-08-08) [umoeller]: added fFamily 1007 915 *@@changed V0.9.9 (2001-04-01) [umoeller]: made this thread-safe, finally 916 *@@changed V0.9.14 (2001-08-01) [umoeller]: some optimizations 1008 917 */ 1009 918 … … 1012 921 BOOL fFamily, // in: if TRUE, pszName specifies font family; 1013 922 // if FALSE, pszName specifies font face 1014 PSZ pszName,// in: font family or face name (without point size)923 const char *pcszName, // in: font family or face name (without point size) 1015 924 USHORT usFormat, // in: none, one or several of: 1016 925 // -- FATTR_SEL_ITALIC … … 1034 943 sizeof(FONTMETRICS), 1035 944 NULL); 1036 PFONTMETRICS pfm = (PFONTMETRICS)malloc(cFonts * sizeof(FONTMETRICS)), 1037 pfm2 = pfm, 1038 pfmFound = NULL; 945 PFONTMETRICS pfm = (PFONTMETRICS)malloc(cFonts * sizeof(FONTMETRICS)), 946 pfm2 = pfm, 947 pfmFound = NULL; 948 949 BOOL fQueriedDevice = FALSE; // V0.9.14 (2001-08-01) [umoeller] 950 LONG alDevRes[2]; // device resolution 1039 951 1040 952 // _Pmpf(("gpihFindFont: enumerating for %s, %d points", pszFaceName, lSize)); … … 1047 959 // -- _not_ total buffer size! 1048 960 pfm); 961 1049 962 // now we have an array of FONTMETRICS 1050 963 // for EVERY font that is installed on the system... … … 1066 979 FontAttrs.fsSelection = usFormat; // changed later if better font is found 1067 980 FontAttrs.lMatch = 0L; // closest match 1068 strcpy(FontAttrs.szFacename, p szName);981 strcpy(FontAttrs.szFacename, pcszName); 1069 982 FontAttrs.idRegistry = 0; // default registry 1070 983 FontAttrs.usCodePage = 0; // default codepage … … 1095 1008 pfm2->lAveCharWidth)); */ 1096 1009 1097 PSZ pszCompare = (fFamily)1098 ? pfm2->szFamilyname1099 : pfm2->szFacename;1100 1101 if ( strcmp(pszCompare, pszName) == 0)1010 const char *pcszCompare = (fFamily) 1011 ? pfm2->szFamilyname 1012 : pfm2->szFacename; 1013 1014 if (!strcmp(pcszCompare, pcszName)) 1102 1015 { 1103 1016 /* _Pmpf((" Found font %s; slope %d, usWeightClass %d", … … 1117 1030 // for bitmap fonts, there are always two versions: 1118 1031 // one for low resolutions, one for high resolutions 1119 LONG alDevRes[2]; 1120 DevQueryCaps(GpiQueryDevice(hps), 1121 CAPS_HORIZONTAL_FONT_RES, 1122 2L, 1123 alDevRes); 1032 if (!fQueriedDevice) 1033 { 1034 DevQueryCaps(GpiQueryDevice(hps), 1035 CAPS_HORIZONTAL_FONT_RES, 1036 2L, 1037 alDevRes); 1038 fQueriedDevice = TRUE; 1039 } 1040 1124 1041 if ( (pfm2->sXDeviceRes == alDevRes[0]) 1125 1042 && (pfm2->sYDeviceRes == alDevRes[1]) … … 1151 1068 && (pfm2->usWeightClass == 7) // bold 1152 1069 ) 1153 || ( ( (usFormat & FATTR_SEL_BOLD) == 0)1070 || ( (!(usFormat & FATTR_SEL_BOLD)) 1154 1071 && (pfm2->usWeightClass == 5) // regular 1155 1072 ) … … 1158 1075 && (pfm2->sCharSlope != 0) // italics 1159 1076 ) 1160 || ( ( (usFormat & FATTR_SEL_ITALIC) == 0)1077 || ( (!(usFormat & FATTR_SEL_ITALIC)) 1161 1078 && (pfm2->sCharSlope == 0) // regular 1162 1079 ) … … 2075 1992 * You can then use any GPI function on the memory 2076 1993 * PS to draw into the bitmap. Use the fields from 2077 * _XBITMAP for that.1994 * XBITMAP for that. 2078 1995 * 2079 1996 * The bitmap is created in RGB mode. … … 2144 2061 * 2145 2062 * To be on the safe side, this sets the 2146 * bitmappointer to NULL as well.2063 * given XBITMAP pointer to NULL as well. 2147 2064 * 2148 2065 *@@added V0.9.12 (2001-05-20) [umoeller] -
trunk/src/helpers/helpers_pre.in
r86 r91 52 52 53 53 CPOBJS = $(PLAINCOBJS) $(XMLOBJS) \ 54 $(OUTPUTDIR)\apmh.obj \ 54 55 $(OUTPUTDIR)\datetime.obj \ 55 56 $(OUTPUTDIR)\debug.obj \ -
trunk/src/helpers/linklist.c
r86 r91 85 85 #include "setup.h" // code generation and debugging options 86 86 87 #define DONT_REPLACE_LIST_MALLOC 87 88 #include "helpers\linklist.h" 88 89 … … 263 264 } 264 265 265 #else // __DEBUG_MALLOC_ENABLED__ 266 #endif 267 268 // #else // __DEBUG_MALLOC_ENABLED__ 266 269 267 270 /* … … 295 298 } 296 299 297 #endif // __DEBUG_MALLOC_ENABLED__300 // #endif // __DEBUG_MALLOC_ENABLED__ 298 301 299 302 /* … … 616 619 } 617 620 618 #else // __DEBUG_MALLOC_ENABLED__ 621 #endif 622 623 // #else // __DEBUG_MALLOC_ENABLED__ 619 624 620 625 /* … … 670 675 } 671 676 672 #endif // __DEBUG_MALLOC_ENABLED__677 // #endif // __DEBUG_MALLOC_ENABLED__ 673 678 674 679 /* … … 790 795 */ 791 796 792 BOOL lstRemoveNode(PLINKLIST pList, PLISTNODE pRemoveNode) 797 BOOL lstRemoveNode(PLINKLIST pList, 798 PLISTNODE pRemoveNode) 793 799 { 794 800 BOOL fFound = FALSE; -
trunk/src/helpers/memdebug.c
r71 r91 382 382 { 383 383 if (pHeapItem->pAfterMagic == p) 384 { 384 385 // the same address may be allocated and freed 385 386 // several times, so if this address has been … … 429 430 break; 430 431 } // if (!pHeapItem->fFreed) 432 } 431 433 432 434 pHeapItem = pHeapItem->pNext; … … 702 704 { 703 705 int i = 0; 706 i++; 704 707 } 705 708 #endif -
trunk/src/helpers/memdebug_win.c
r71 r91 104 104 105 105 ULONG ulLine; 106 107 ULONG ulAddress; // has pAfterMagic, invisible, only 108 // for sorting V0.9.14 (2001-08-01) [umoeller] 106 109 107 110 PSZ pszAddress; // points to szAddress … … 235 238 } 236 239 237 sprintf(pMemRecordThis->szAddress, "0x%lX", pMemRecordThis->pObject); 238 strcpy(pMemRecordThis->szSource, 240 pMemRecordThis->ulAddress = (ULONG)pMemRecordThis->pObject; 241 242 sprintf(pMemRecordThis->szAddress, 243 "0x%lX", 244 pMemRecordThis->pObject); 245 strhcpy(pMemRecordThis->szSource, 239 246 (pMemRecordThis->filename) 240 247 ? pMemRecordThis->filename … … 332 339 pMemRecordThis->ulTID = pHeapItem->ulTID; 333 340 334 str cpy(pMemRecordThis->szSource, pHeapItem->pcszSourceFile);341 strhcpy(pMemRecordThis->szSource, pHeapItem->pcszSourceFile); 335 342 pMemRecordThis->pszSource = pMemRecordThis->szSource; 336 343 337 344 pMemRecordThis->ulLine = pHeapItem->ulLine; 338 345 339 str cpy(pMemRecordThis->szFunction, pHeapItem->pcszFunction);346 strhcpy(pMemRecordThis->szFunction, pHeapItem->pcszFunction); 340 347 pMemRecordThis->pszFunction = pMemRecordThis->szFunction; 341 348 342 sprintf(pMemRecordThis->szAddress, "0x%lX", pHeapItem->pAfterMagic); 349 pMemRecordThis->ulAddress = (ULONG)pHeapItem->pAfterMagic; 350 351 sprintf(pMemRecordThis->szAddress, 352 "0x%lX", 353 pHeapItem->pAfterMagic); 343 354 pMemRecordThis->pszAddress = pMemRecordThis->szAddress; 344 355 … … 361 372 362 373 sprintf(pMemRecordThis->szAddress, "0x%lX", pMemRecordThis->pObject); 363 str cpy(pMemRecordThis->szSource,374 strhcpy(pMemRecordThis->szSource, 364 375 (pMemRecordThis->filename) 365 376 ? pMemRecordThis->filename … … 391 402 SHORT EXPENTRY mnu_fnCompareIndex(PMEMRECORD pmrc1, PMEMRECORD pmrc2, PVOID pStorage) 392 403 { 393 // HAB habDesktop = WinQueryAnchorBlock(HWND_DESKTOP);394 404 pStorage = pStorage; // to keep the compiler happy 395 405 if ((pmrc1) && (pmrc2)) … … 434 444 *@@ mnu_fnCompareSourceFile: 435 445 * 436 * V0.9.6 (2000-11-12) [umoeller]446 *@@added V0.9.6 (2000-11-12) [umoeller] 437 447 */ 438 448 439 449 SHORT EXPENTRY mnu_fnCompareSize(PMEMRECORD pmrc1, PMEMRECORD pmrc2, PVOID pStorage) 440 450 { 441 HAB habDesktop = WinQueryAnchorBlock(HWND_DESKTOP);442 451 pStorage = pStorage; // to keep the compiler happy 443 452 if ((pmrc1) && (pmrc2)) … … 452 461 } 453 462 463 /* 464 *@@ mnu_fnCompareAddress: 465 * 466 *@@added V0.9.14 (2001-08-01) [umoeller] 467 */ 468 469 SHORT EXPENTRY mnu_fnCompareAddress(PMEMRECORD pmrc1, PMEMRECORD pmrc2, PVOID pStorage) 470 { 471 pStorage = pStorage; // to keep the compiler happy 472 if ((pmrc1) && (pmrc2)) 473 { 474 if (pmrc1->ulAddress > pmrc2->ulAddress) 475 return (1); 476 else if (pmrc1->ulAddress < pmrc2->ulAddress) 477 return (-1); 478 } 479 480 return (0); 481 } 482 454 483 #define ID_MEMCNR 1000 455 484 … … 469 498 * 470 499 *@@added V0.9.1 (99-12-04) [umoeller] 500 *@@changed V0.9.14 (2001-08-01) [umoeller]: added sort by address 471 501 */ 472 502 … … 648 678 "Sort by object size", 649 679 MIS_TEXT, 0); 680 winhInsertMenuItem(G_hwndMemDebugMenu, 681 MIT_END, 682 1004, 683 "Sort by address", 684 MIS_TEXT, 0); 650 685 651 686 WinSetFocus(HWND_DESKTOP, hwndCnr); … … 715 750 CM_SORTRECORD, 716 751 (MPARAM)mnu_fnCompareSize, 752 0); 753 break; 754 755 case 1004: // sort by address V0.9.14 (2001-08-01) [umoeller] 756 WinSendMsg(WinWindowFromID(hwndClient, ID_MEMCNR), 757 CM_SORTRECORD, 758 (MPARAM)mnu_fnCompareAddress, 717 759 0); 718 760 break; … … 788 830 { 789 831 int i = 0; 832 i++; 790 833 } 791 834 #endif -
trunk/src/helpers/stringh.c
r81 r91 52 52 #include "setup.h" // code generation and debugging options 53 53 54 #define DONT_REPLACE_STRINGH_MALLOC 54 55 #include "helpers\stringh.h" 55 56 #include "helpers\xstring.h" // extended string helpers … … 68 69 69 70 /* 71 *@@ strcpy: 72 * like strdup, but this one doesn't crash if string2 is NULL, 73 * but sets the first byte in string1 to \0 instead. 74 * 75 *@@added V0.9.14 (2001-08-01) [umoeller] 76 */ 77 78 PSZ strhcpy(PSZ string1, const char *string2) 79 { 80 if (string2) 81 return (strcpy(string1, string2)); 82 83 *string1 = '\0'; 84 return (string1); 85 } 86 87 #ifdef __DEBUG_MALLOC_ENABLED__ 88 89 /* 70 90 *@@ strhdup: 71 * like strdup, but this one 72 * doesn't crash if pszSource is NULL, 91 * memory debug version of strhdup. 92 * 93 *@@added V0.9.0 [umoeller] 94 */ 95 96 PSZ strhdupDebug(const char *pszSource, 97 const char *pcszSourceFile, 98 unsigned long ulLine, 99 const char *pcszFunction) 100 { 101 if (pszSource) 102 { 103 PSZ p = (PSZ)memdMalloc(strlen(pszSource) + 1, 104 pcszSourceFile, 105 ulLine, 106 pcszFunction); 107 strcpy(p, pszSource); 108 return (p); 109 } 110 else 111 return (0); 112 } 113 114 #endif // __DEBUG_MALLOC_ENABLED__ 115 116 /* 117 *@@ strhdup: 118 * like strdup, but this one doesn't crash if pszSource is NULL, 73 119 * but returns NULL also. 74 120 * … … 248 294 } 249 295 296 #ifdef __DEBUG_MALLOC_ENABLED__ 297 298 /* 299 *@@ strhSubstrDebug: 300 * memory debug version of strhSubstr. 301 * 302 *@@added V0.9.14 (2001-08-01) [umoeller] 303 */ 304 305 PSZ strhSubstrDebug(const char *pBegin, // in: first char 306 const char *pEnd, // in: last char (not included) 307 const char *pcszSourceFile, 308 unsigned long ulLine, 309 const char *pcszFunction) 310 { 311 PSZ pszSubstr = NULL; 312 313 if (pEnd > pBegin) // V0.9.9 (2001-04-04) [umoeller] 314 { 315 ULONG cbSubstr = (pEnd - pBegin); 316 if (pszSubstr = (PSZ)memdMalloc(cbSubstr + 1, 317 pcszSourceFile, 318 ulLine, 319 pcszFunction)) 320 { 321 // strhncpy0(pszSubstr, pBegin, cbSubstr); 322 memcpy(pszSubstr, pBegin, cbSubstr); // V0.9.9 (2001-04-04) [umoeller] 323 *(pszSubstr + cbSubstr) = '\0'; 324 } 325 } 326 327 return (pszSubstr); 328 } 329 330 #endif // __DEBUG_MALLOC_ENABLED__ 331 250 332 /* 251 333 *@@ strhSubstr: … … 274 356 { 275 357 ULONG cbSubstr = (pEnd - pBegin); 276 pszSubstr = (PSZ)malloc(cbSubstr + 1); 277 if (pszSubstr) 358 if (pszSubstr = (PSZ)malloc(cbSubstr + 1)) 278 359 { 279 // strhncpy0(pszSubstr, pBegin, cbSubstr);280 360 memcpy(pszSubstr, pBegin, cbSubstr); // V0.9.9 (2001-04-04) [umoeller] 281 361 *(pszSubstr + cbSubstr) = '\0'; -
trunk/src/helpers/textv_html.c
r82 r91 1341 1341 // end of tag found: 1342 1342 ULONG cbTag; 1343 PSZ pStartOfAttrs = 0;1343 // PSZ pStartOfAttrs = 0; 1344 1344 1345 1345 if ((pNextSpace) && (pNextSpace < pNextClose)) … … 1347 1347 // we have attributes: 1348 1348 cbTag = pNextSpace - (pStartOfTag + 1); 1349 pStartOfAttrs = pNextSpace;1349 // pStartOfAttrs = pNextSpace; 1350 1350 } 1351 1351 else -
trunk/src/helpers/textview.c
r85 r91 625 625 pWordEnd = NULL; 626 626 PSZ pCheck = *ppStartOfWord; 627 ULONG cChars = 0 ,628 cCheck = 0;627 ULONG cChars = 0; 628 // cCheck = 0; 629 629 630 630 pWord = (PTXVWORD)malloc(sizeof(TXVWORD)); … … 656 656 // cChars is != 0 if strhGetWord succeeded AND the 657 657 // line is not empty, so go on 658 cCheck = cChars;658 // cCheck = cChars; 659 659 660 660 // advance input pointer … … 3048 3048 if (ptxvd->cdata.flStyle & XTXF_VSCROLL) 3049 3049 { 3050 BOOL fEnabled =winhUpdateScrollBar(ptxvd->hwndVScroll,3050 /* BOOL fEnabled = */ winhUpdateScrollBar(ptxvd->hwndVScroll, 3051 3051 ulWinCY, 3052 3052 ptxvd->xfd.ulViewportCY, … … 3219 3219 NULL); // reserved 3220 3220 3221 if ( cbNeeded)3221 if (!rc && cbNeeded) 3222 3222 { 3223 3223 pprq3 = (PRQINFO3*)malloc(cbNeeded); -
trunk/src/helpers/timer.c
r86 r91 110 110 #include "helpers\linklist.h" 111 111 #include "helpers\math.h" 112 #include "helpers\standards.h" 112 113 #include "helpers\threads.h" 113 114 #include "helpers\timer.h" … … 248 249 { 249 250 PLINKLIST pllXTimers = (PLINKLIST)pSet->pvllXTimers; 250 PLISTNODE pNode = lstQueryFirstNode(pllXTimers);251 if (! pNode)251 ULONG cTimers = lstCountItems(pllXTimers); 252 if (!cTimers) 252 253 { 253 254 // no XTimers running: … … 268 269 // we have timers: 269 270 270 ULONG ulOldPMTimeout = pSet->ulPMTimeout; 271 272 if (!pNode->pNext) 271 ULONG ulOldPMTimeout = pSet->ulPMTimeout; 272 273 PLISTNODE pNode = lstQueryFirstNode(pllXTimers); 274 PXTIMER pTimer1 = (PXTIMER)pNode->pItemData; 275 276 if (cTimers == 1) 273 277 { 274 278 // only one timer: 275 279 // that's easy 276 PXTIMER pTimer = (PXTIMER)pNode->pItemData; 277 pSet->ulPMTimeout = pTimer->ulTimeout; 278 } 279 else if (!pNode->pNext->pNext) 280 pSet->ulPMTimeout = pTimer1->ulTimeout; 281 } 282 else if (cTimers == 2) 280 283 { 281 284 // exactly two timers: 282 285 // find the greatest common denominator 283 PXTIMER pTimer1 = (PXTIMER)pNode->pItemData, 284 pTimer2 = (PXTIMER)pNode->pNext->pItemData; 286 PXTIMER pTimer2 = (PXTIMER)pNode->pNext->pItemData; 285 287 286 288 pSet->ulPMTimeout = mathGCD(pTimer1->ulTimeout, … … 289 291 else 290 292 { 291 // severaltimers:293 // more than two timers: 292 294 // run through all timers and find the greatest 293 295 // common denominator of all frequencies... 294 295 ULONG cTimers = lstCountItems(pllXTimers);296 296 int *paInts = (int*)_alloca(sizeof(int) * cTimers), 297 297 i = 0; 298 298 299 _Pmpf(("Recalculating, got %d timers %d", cTimers));299 // _Pmpf(("Recalculating, got %d timers", cTimers)); 300 300 301 301 // fill an array of integers with the … … 303 303 while (pNode) 304 304 { 305 PXTIMER pTimer= (PXTIMER)pNode->pItemData;306 307 _Pmpf((" timeout %d is %d", i, pTimer->ulTimeout));308 309 paInts[i++] = pTimer ->ulTimeout;305 pTimer1 = (PXTIMER)pNode->pItemData; 306 307 // _Pmpf((" timeout %d is %d", i, pTimer1->ulTimeout)); 308 309 paInts[i++] = pTimer1->ulTimeout; 310 310 311 311 pNode = pNode->pNext; … … 314 314 pSet->ulPMTimeout = mathGCDMulti(paInts, 315 315 cTimers); 316 _Pmpf(("--> GCD is %d", pSet->ulPMTimeout));317 } 318 319 if ( ( pSet->idPMTimerRunning == 0) // timer not running?316 // _Pmpf(("--> GCD is %d", pSet->ulPMTimeout)); 317 } 318 319 if ( (!pSet->idPMTimerRunning) // timer not running? 320 320 || (pSet->ulPMTimeout != ulOldPMTimeout) // timeout changed? 321 321 ) … … 355 355 USHORT usPMTimerID) 356 356 { 357 PXTIMERSET pSet = NULL; 358 359 pSet = (PXTIMERSET)malloc(sizeof(*pSet)); 357 PXTIMERSET pSet = NEW(XTIMERSET); 360 358 if (pSet) 361 359 { … … 434 432 *@@added V0.9.9 (2001-02-28) [umoeller] 435 433 *@@changed V0.9.12 (2001-05-12) [umoeller]: added mutex protection 436 *@@changed V0.9.12 (2001-05-24) [umoeller]: fixed crash if timer was deleted during winproc's WM_TIMER processing 434 *@@changed V0.9.12 (2001-05-24) [umoeller]: fixed crash if this got called during tmrTimerTick 435 *@@changed V0.9.14 (2001-08-01) [umoeller]: fixed mem overwrite which might have caused crashes if this got called during tmrTimerTick 437 436 */ 438 437 … … 498 497 PFNWP pfnwp = (PFNWP)WinQueryWindowPtr(pTimer->hwndTarget, 499 498 QWP_PFNWP); 499 500 // moved this up V0.9.14 (2001-08-01) [umoeller] 501 pTimer->ulNextFire = ulTimeNow + pTimer->ulTimeout; 502 500 503 // call the window proc DIRECTLY 501 504 pfnwp(pTimer->hwndTarget, … … 511 514 // the list, so we'll see it in this loop 512 515 513 pTimer->ulNextFire = ulTimeNow + pTimer->ulTimeout; 516 // V0.9.14 (2001-08-01) [umoeller] 517 518 // DO NOT REFERENCE pTimer AFTER THIS CODE; 519 // tmrTimerTick might have removed the timer, 520 // and since the list is auto-free, pTimer 521 // might have been freed!! 514 522 } 515 523 else … … 598 606 599 607 // fix the timeout... we allow only multiples of 600 // 2 0, and it must be at least 20(otherwise our608 // 25, and it must be at least 25 (otherwise our 601 609 // internal master timer calculations will fail) 602 610 // V0.9.14 (2001-07-07) [umoeller] … … 607 615 608 616 // check if this timer exists already 609 pTimer = FindTimer(pSet, 610 hwnd, 611 usTimerID); 612 if (pTimer) 617 if (pTimer = FindTimer(pSet, 618 hwnd, 619 usTimerID)) 613 620 { 614 621 // exists already: reset only … … 617 624 &ulTimeNow, sizeof(ulTimeNow)); 618 625 pTimer->ulNextFire = ulTimeNow + ulTimeout; 619 usrc = pTimer->usTimerID;626 usrc = usTimerID; 620 627 } 621 628 else 622 629 { 623 630 // new timer needed: 624 pTimer = (PXTIMER)malloc(sizeof(XTIMER)); 625 if (pTimer) 631 if (pTimer = NEW(XTIMER)) 626 632 { 627 633 ULONG ulTimeNow; … … 635 641 lstAppendItem(pllXTimers, 636 642 pTimer); 637 usrc = pTimer->usTimerID;643 usrc = usTimerID; 638 644 } 639 645 } … … 673 679 if (pSet && pSet->pvllXTimers) 674 680 { 675 PLINKLIST pllXTimers = (PLINKLIST)pSet->pvllXTimers; 676 BOOL fLocked = FALSE; 681 // PLINKLIST pllXTimers = (PLINKLIST)pSet->pvllXTimers; 677 682 678 683 PXTIMER pTimer = FindTimer(pSet, -
trunk/src/helpers/winh.c
r85 r91 601 601 i++) 602 602 { 603 CHAR szItemText[100];603 // CHAR szItemText[100]; 604 604 SHORT id = SHORT1FROMMR(WinSendMsg(mi.hwndSubMenu, 605 605 MM_ITEMIDFROMPOSITION, … … 689 689 MENUITEM mi = {0}; 690 690 SHORT src = 0; 691 SHORT s = 0;691 // SHORT s = 0; 692 692 mi.iPosition = MIT_END; 693 693 mi.afStyle = MIS_TEXT | MIS_SUBMENU; … … 744 744 * to free the return value. 745 745 * 746 * This uses MM_QUERYITEMTEXT internally. 747 * PMREF doesn't say anything about this, 748 * but from my testing this always recurses 749 * into submenus. 750 * 746 751 * Use the WinSetMenuItemText macro to 747 752 * set the menu item text. … … 753 758 PSZ prc = NULL; 754 759 755 SHORT sLength = SHORT1FROMMR(WinSendMsg(hwndMenu, MM_QUERYITEMTEXTLENGTH, 756 (MPARAM)(ULONG)usItemID, 757 (MPARAM)NULL)); 760 SHORT sLength = SHORT1FROMMR(WinSendMsg(hwndMenu, 761 MM_QUERYITEMTEXTLENGTH, 762 (MPARAM)(ULONG)usItemID, 763 (MPARAM)NULL)); 758 764 if (sLength) 759 765 { … … 4063 4069 { 4064 4070 SWBLOCK swblock; 4065 HWND hwndTasklist = winhQueryTasklistWindow();4071 // HWND hwndTasklist = winhQueryTasklistWindow(); 4066 4072 // the tasklist has entry #0 in the SWBLOCK 4067 4073 WinQuerySwitchList(NULLHANDLE, &swblock, sizeof(SWBLOCK)); -
trunk/src/helpers/xml.c
r83 r91 455 455 case ATTRIBUTE_DECLARATION: 456 456 { 457 PCMATTRIBUTEDECL pDecl = (PCMATTRIBUTEDECL)pNode;457 // PCMATTRIBUTEDECL pDecl = (PCMATTRIBUTEDECL)pNode; 458 458 break; } 459 459 … … 1524 1524 if (!pDom->arcDOM) 1525 1525 { 1526 ULONG i;1526 // ULONG i; 1527 1527 1528 1528 if (len) … … 1533 1533 if (!pDom->arcDOM) 1534 1534 { 1535 PDOMNODE pParent = pSI->pDomNode ,1536 pNew = NULL;1535 PDOMNODE pParent = pSI->pDomNode; 1536 // pNew = NULL; 1537 1537 1538 1538 // shall we validate? … … 2588 2588 const char *pcszName) 2589 2589 { 2590 APIRET arc = NO_ERROR;2590 // APIRET arc = NO_ERROR; 2591 2591 2592 2592 PLINKLIST pll = lstCreate(FALSE); // no free -
trunk/src/helpers/xprf.c
r65 r91 434 434 pKey->lenKeyData); 435 435 436 if (!p Key)436 if (!pIniKey) 437 437 { 438 438 brc = FALSE; -
trunk/src/helpers/xstring.c
r86 r91 112 112 113 113 #include "helpers\stringh.h" 114 #define DONT_REPLACE_XSTR_MALLOC 114 115 #include "helpers\xstring.h" // extended string helpers 115 116 … … 118 119 * See xstring.c. 119 120 */ 121 122 #ifdef __DEBUG_MALLOC_ENABLED__ 123 124 /* 125 *@@ xstrInitDebug: 126 * 127 *@@added V0.9.14 (2001-08-01) [umoeller] 128 */ 129 130 void XWPENTRY xstrInitDebug(PXSTRING pxstr, 131 ULONG ulPreAllocate, 132 const char *file, 133 unsigned long line, 134 const char *function) 135 { 136 memset(pxstr, 0, sizeof(XSTRING)); 137 if (ulPreAllocate) 138 { 139 pxstr->psz = (PSZ)memdMalloc(ulPreAllocate, 140 file, 141 line, 142 function); 143 pxstr->cbAllocated = ulPreAllocate; 144 // ulLength is still zero 145 *(pxstr->psz) = 0; 146 147 pxstr->ulDelta = ulPreAllocate * 10 / 100; 148 } 149 150 // else: pxstr->ulDelta is still 0 151 pxstr->file = file; 152 pxstr->line = line; 153 pxstr->function = function; 154 } 155 156 #endif // __DEBUG_MALLOC_ENABLED__ 120 157 121 158 /* … … 319 356 // this gives the C runtime a chance to expand the 320 357 // existing block 321 if (pxstr->psz = (PSZ)realloc(pxstr->psz, cbAllocate)) 358 #ifdef __DEBUG_MALLOC_ENABLED__ 359 if (pxstr->psz = (PSZ)memdRealloc(pxstr->psz, 360 cbAllocate, 361 pxstr->file, 362 pxstr->line, 363 pxstr->function)) 364 #else 365 if (pxstr->psz = (PSZ)realloc(pxstr->psz, 366 cbAllocate)) 367 #endif 322 368 // if pxstr->psz is NULL, realloc behaves like malloc 323 369 pxstr->cbAllocated = cbAllocate;
Note:
See TracChangeset
for help on using the changeset viewer.