Changeset 403


Ignore:
Timestamp:
Jul 29, 2006, 10:00:53 PM (19 years ago)
Author:
root
Message:

Avoid shutdown hang - pre3 typo
Use xfgets_bstripcr

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/collect.c

    r377 r403  
    2323  10 Nov 05 SHL CollectorCnrWndProc: correct missing button window updates
    2424  14 Jul 06 SHL Use Runtime_Error
     25  27 Jul 06 SHL Avoid shutdown hang - pre3 typo
     26  29 Jul 06 SHL Use xfgets_bstripcr
    2527
    2628***********************************************************************/
     
    6870
    6971  static BOOL emphasized = FALSE;
    70   static HWND hwndButtonPopup = (HWND) 0;
     72  static HWND hwndButtonPopup = (HWND)0;
    7173  static ULONG timestamp = ULONG_MAX;
    7274  static USHORT lastid = 0;
     
    197199
    198200  case WM_MENUEND:
    199     if (hwndButtonPopup == (HWND) mp2)
    200     {
    201       lastid = WinQueryWindowUShort((HWND) mp2, QWS_ID);
     201    if (hwndButtonPopup == (HWND)mp2)
     202    {
     203      lastid = WinQueryWindowUShort((HWND)mp2, QWS_ID);
    202204      WinDestroyWindow(hwndButtonPopup);
    203       hwndButtonPopup = (HWND) 0;
     205      hwndButtonPopup = (HWND)0;
    204206      DosQuerySysInfo(QSV_MS_COUNT,
    205207                      QSV_MS_COUNT,
     
    642644                         MPFROMLONG(EXTRA_RECORD_BYTES),
    643645                         MPFROMLONG(ulMaxFiles));
    644         if (pci) {
     646        if (!pci) {
    645647          Runtime_Error(pszSrcFile, __LINE__, "CM_ALLOCRECORD %u failed", ulMaxFiles);
    646648          break;
     
    732734  case UM_COLLECTFROMFILE:
    733735    dcd = WinQueryWindowPtr(hwnd, QWL_USER);
    734     if (dcd && mp1)
    735     {
     736    if (dcd && mp1) {
    736737      FILESTATUS4 fs4;
    737738      PCNRITEM pci;
     
    742743
    743744      fp = _fsopen((CHAR *) mp1, "r", SH_DENYNO);
    744       if (fp)
    745       {
    746         while (!feof(fp))
    747         {
    748           if (!fgets(fullname, 1024, fp))
     745      if (fp) {
     746        while (!feof(fp)) {
     747          if (!xfgets_bstripcr(fullname, sizeof(fullname), fp,pszSrcFile, __LINE__))
    749748            break;
    750           fullname[1023] = 0;
    751           bstripcr(fullname);
    752           if (*fullname == '\"')
    753           {
     749          if (*fullname == '\"') {
    754750            memmove(fullname, fullname + 1, strlen(fullname) + 1);
    755751            lstrip(fullname);
     
    759755            rstrip(fullname);
    760756          }
    761           else
    762           {
     757          else {
    763758            p = strchr(fullname, ' ');
    764759            if (p)
     
    822817      }
    823818    }
    824     if (mp1)
    825       free(mp1);
     819    xfree(mp1);
    826820    return 0;
    827821
     
    10091003    }
    10101004    DosPostEventSem(CompactSem);
    1011     if (!PostMsg(HWND_DESKTOP, WM_QUIT, MPVOID, MPVOID))
    1012       WinSendMsg(HWND_DESKTOP, WM_QUIT, MPVOID, MPVOID);
     1005    if (!PostMsg((HWND)0, WM_QUIT, MPVOID, MPVOID))
     1006      WinSendMsg((HWND)0, WM_QUIT, MPVOID, MPVOID);
    10131007    break;
    10141008  }
     
    14951489    if (dcd)
    14961490    {
    1497       HWND hwndMenu = (HWND) mp2;
     1491      HWND hwndMenu = (HWND)mp2;
    14981492
    14991493      if (hwndMenu == CollectorCnrMenu || hwndMenu == CollectorFileMenu ||
     
    15421536
    15431537          wmsg = (SHORT1FROMMP(mp1) == 0) ? UM_FILESMENU : UM_VIEWSMENU;
    1544           PortholeInit((HWND) WinSendMsg(dcd -> hwndClient, wmsg, MPVOID,
     1538          PortholeInit((HWND)WinSendMsg(dcd -> hwndClient, wmsg, MPVOID,
    15451539                                         MPVOID), mp1, mp2);
    15461540        }
     
    15571551      {
    15581552      case IDM_VIEWSMENU:
    1559         SetViewMenu((HWND) mp2, dcd -> flWindowAttr);
    1560         WinEnableMenuItem((HWND) mp2, IDM_RESELECT,
     1553        SetViewMenu((HWND)mp2, dcd -> flWindowAttr);
     1554        WinEnableMenuItem((HWND)mp2, IDM_RESELECT,
    15611555                          (dcd -> lastselection != NULL));
    15621556        break;
    15631557
    15641558      case IDM_DETAILSSETUP:
    1565         SetDetailsSwitches((HWND) mp2, dcd);
     1559        SetDetailsSwitches((HWND)mp2, dcd);
    15661560        break;
    15671561
    15681562      case IDM_COMMANDSMENU:
    1569         SetupCommandMenu((HWND) mp2, hwnd);
     1563        SetupCommandMenu((HWND)mp2, hwnd);
    15701564        break;
    15711565
    15721566      case IDM_SORTSUBMENU:
    1573         SetSortChecks((HWND) mp2, CollectorsortFlags);
    1574         break;
    1575       }
    1576       dcd -> hwndLastMenu = (HWND) mp2;
     1567        SetSortChecks((HWND)mp2, CollectorsortFlags);
     1568        break;
     1569      }
     1570      dcd -> hwndLastMenu = (HWND)mp2;
    15771571    }
    15781572    if (msg == WM_INITMENU)
     
    23062300    {
    23072301      PCNRITEM pci;
    2308       HWND menuHwnd = (HWND) 0;
     2302      HWND menuHwnd = (HWND)0;
    23092303
    23102304      pci = (PCNRITEM) CurrentRecord(hwnd);
     
    29152909
    29162910  case UM_FOLDUP:
    2917     if (!PostMsg(HWND_DESKTOP, WM_QUIT, MPVOID, MPVOID))
     2911    if (!PostMsg((HWND)0, WM_QUIT, MPVOID, MPVOID))
    29182912      DosExit(EXIT_PROCESS, 1);
    29192913    return 0;
     
    29502944    if (CollectorCnrMenu)
    29512945      WinDestroyWindow(CollectorCnrMenu);
    2952     CollectorCnrMenu = CollectorFileMenu = CollectorDirMenu = (HWND) 0;
    2953     Collector = (HWND) 0;
     2946    CollectorCnrMenu = CollectorFileMenu = CollectorDirMenu = (HWND)0;
     2947    Collector = (HWND)0;
    29542948    EmptyCnr(hwnd);
    29552949    break;
     
    29612955HWND StartCollector(HWND hwndParent, INT flags)
    29622956{
    2963   HWND hwndFrame = (HWND) 0;
     2957  HWND hwndFrame = (HWND)0;
    29642958  HWND hwndClient;
    29652959  ULONG FrameFlags = FCF_TITLEBAR | FCF_SYSMENU |
     
    30063000      Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
    30073001      PostMsg(hwndClient,WM_CLOSE,MPVOID,MPVOID);
    3008       hwndFrame = (HWND) 0;
     3002      hwndFrame = (HWND)0;
    30093003    }
    30103004    else {
     
    30453039        PostMsg(hwndClient,WM_CLOSE,MPVOID,MPVOID);
    30463040        free(dcd);
    3047         hwndFrame = (HWND) 0;
     3041        hwndFrame = (HWND)0;
    30483042      }
    30493043      else {
Note: See TracChangeset for help on using the changeset viewer.