Changeset 1673


Ignore:
Timestamp:
Dec 30, 2012, 7:51:01 PM (13 years ago)
Author:
Gregg Young
Message:

Update to Doxygen comment style Ticket 55. Also some minor code cleanup.

Location:
trunk
Files:
61 edited

Legend:

Unmodified
Added
Removed
  • trunk/av2.c

    r1404 r1673  
    5151VOID APIENTRY deinit(ULONG why)
    5252{
    53   /* cleanup before exiting */
     53  // cleanup before exiting
    5454
    5555  DosCloseMutexSem(av2Sem);
  • trunk/dll/cmdline.c

    r1546 r1673  
    467467        WinSetDlgItemText(hwnd, EXEC_WARNING2, (CHAR *) GetPString(IDS_NOTDIRECTEXETEXT));
    468468      }
    469       else if (apptype) {               /* acceptable */
     469      else if (apptype) {               // acceptable
    470470
    471471        CHAR s[257];
     
    729729      WinQueryDlgItemText(hwnd, EXEC_CL, 1000, ex->commandline);
    730730      ex->flags = CheckExecutibleFlags(hwnd, 2);
    731       /*ex->flags = 0;
    732       if (WinQueryButtonCheckstate(hwnd, EXEC_MINIMIZED))
    733         ex->flags |= MINIMIZED;
    734       if (WinQueryButtonCheckstate(hwnd, EXEC_MAXIMIZED))
    735         ex->flags |= MAXIMIZED;
    736       if (WinQueryButtonCheckstate(hwnd, EXEC_FULLSCREEN))
    737         ex->flags |= FULLSCREEN;
    738       else
    739         ex->flags |= WINDOWED;
    740       if (WinQueryButtonCheckstate(hwnd, EXEC_INVISIBLE))
    741         ex->flags |= INVISIBLE;
    742       if (WinQueryButtonCheckstate(hwnd, EXEC_KEEP))
    743         ex->flags |= SEPARATEKEEP;
    744       else
    745         ex->flags |= SEPARATE;*/
    746731      strset(ex->environment, 0);
    747732      WinQueryDlgItemText(hwnd, EXEC_ENVIRON, 1000, ex->environment);
  • trunk/dll/codepage.c

    r1498 r1673  
    219219    ULONG cps[50], len, x;
    220220
    221 /*
    222     numcps = WinQueryCpList(WinQueryAnchorBlock(hwnd),50,cps);
    223     if(numcps) {
    224       for(x = 0;x < numcps;x++) {
    225         if(cps[x] == (ULONG)cp) {
    226           hmq = WinQueryWindowULong(hwnd,QWL_HMQ);
    227           WinSetCp(hmq,cp);
    228           break;
    229         }
    230       }
    231     }
    232 */
    233221    if (cp == 1004) {
    234222      hmq = WinQueryWindowULong(hwnd, QWL_HMQ);
  • trunk/dll/collect.c

    r1671 r1673  
    228228              }
    229229
    230               /* don't have tree view in collector */
     230              // don't have tree view in collector
    231231              WinSendMsg(hwndButtonPopup,
    232232                         MM_DELETEITEM,
     
    597597      Fortify_BecomeOwner(dcd);
    598598#     endif
    599       /* set unique id */
     599      // set unique id
    600600      WinSetWindowUShort(hwnd,
    601601                         QWS_ID,
     
    696696        }
    697697        else {
    698           Win_Error(hwnd, hwnd, pszSrcFile, __LINE__,
    699                     "CM_QUERYCNRINFO" /* PCSZ_QUERYCNRINFO fixme */);
     698          Win_Error(hwnd, hwnd, pszSrcFile, __LINE__, PCSZ_QUERYCNRINFO);
    700699          ulRecsAtStart = 0;
    701700        }
     
    940939          }
    941940          if (errs > (first ? 0 : 50)) {
    942             /* prevent runaway on bad file */
     941            // prevent runaway on bad file
    943942            APIRET ret = saymsg(MB_YESNO, dcd->hwndCnr,
    944943                                GetPString(IDS_COLLECTNOLISTHDRTEXT),
     
    12451244          USHORT attrib = CRA_CURSORED;
    12461245
    1247           /* make found item current item */
     1246          // make found item current item
    12481247          if (!stricmp(pci->pszFileName, dcd->szCommonName))
    12491248            attrib |= CRA_SELECTED;
    12501249          WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPFROMP(pci),
    12511250                     MPFROM2SHORT(TRUE, attrib));
    1252           /* make sure that record shows in viewport */
     1251          // make sure that record shows in viewport
    12531252          ShowCnrRecord(hwnd, (PMINIRECORDCORE) pci);
    12541253          return (MRESULT) TRUE;
     
    13331332
    13341333  case WM_SETFOCUS:
    1335     /*
    1336      * put name of our window on status line
    1337      */
     1334    // put name of our window on status line
    13381335    if (dcd && hwndStatus && mp2) {
    13391336      PCNRITEM pci = NULL;
     
    15031500    if (dcd) {
    15041501      if (!dcd->hwndObject) {
    1505         /* first time through -- set things up */
     1502        // first time through -- set things up
    15061503
    15071504        CNRINFO cnri;
     
    15521549        AdjustCnrColsForPref(hwnd, NULL, &dcd->ds, FALSE);
    15531550
    1554         /* fix splitbar for collector container */
     1551        // fix splitbar for collector container
    15551552        cnri.xVertSplitbar = DIR_SPLITBAR_OFFSET - 32;
    15561553        size = sizeof(LONG);
     
    25462543          // fixme to know why needed
    25472544          pDInfo = ((PCNRDRAGINFO) mp2)->pDragInfo;
    2548           DrgAccessDraginfo(pDInfo);    /* Access DRAGINFO */
    2549           DrgFreeDraginfo(pDInfo);      /* Free DRAGINFO */
     2545          DrgAccessDraginfo(pDInfo);    // Access DRAGINFO
     2546          DrgFreeDraginfo(pDInfo);      // Free DRAGINFO
    25502547        }
    25512548        return 0;
     
    25542551      case CN_DRAGOVER:
    25552552        if (mp2) {
    2556           PDRAGITEM pDItem;             /* Pointer to DRAGITEM */
    2557           PDRAGINFO pDInfo;             /* Pointer to DRAGINFO */
     2553          PDRAGITEM pDItem;             // Pointer to DRAGITEM
     2554          PDRAGINFO pDInfo;             // Pointer to DRAGINFO
    25582555          PCNRITEM pci;
    25592556          USHORT uso;
     
    25662563            Win_Error(hwnd, hwnd, pszSrcFile, __LINE__,
    25672564                      PCSZ_DRGACCESSDRAGINFO);
    2568             return (MRFROM2SHORT(DOR_NODROP, 0));       /* Drop not valid */
     2565            return (MRFROM2SHORT(DOR_NODROP, 0));       // Drop not valid
    25692566          }
    25702567          if (pci) {
     
    26002597            }
    26012598          }
    2602           pDItem = DrgQueryDragitemPtr(pDInfo,  /* Access DRAGITEM */
    2603                                        0);      /* Index to DRAGITEM */
    2604           if (DrgVerifyRMF(pDItem,      /* Check valid rendering */
    2605                            (CHAR *) DRM_OS2FILE,        /* mechanisms and data */
     2599          pDItem = DrgQueryDragitemPtr(pDInfo,     // Access DRAGITEM
     2600                                       0);         // Index to DRAGITEM
     2601          if (DrgVerifyRMF(pDItem,                 // Check valid rendering
     2602                           (CHAR *) DRM_OS2FILE,   // mechanisms and data
    26062603                           NULL)) {
    2607             DrgFreeDraginfo(pDInfo);    /* Free DRAGINFO */
     2604            DrgFreeDraginfo(pDInfo);               // Free DRAGINFO
    26082605            if (pci) {
    26092606              if (driveflags[toupper(*pci->pszFileName) - 'A'] &
     
    26122609              if (toupper(*pci->pszFileName) < 'C')
    26132610                return MRFROM2SHORT(DOR_DROP, DO_COPY);
    2614               return MRFROM2SHORT(DOR_DROP,     /* Return okay to drop */
     2611              return MRFROM2SHORT(DOR_DROP,            // Return okay to drop
    26152612                                  ((fCopyDefault) ? DO_COPY : DO_MOVE));
    26162613            }
    26172614            else
    2618               return MRFROM2SHORT(DOR_DROP,     /* Return okay to drop */
     2615              return MRFROM2SHORT(DOR_DROP,            // Return okay to drop
    26192616                                  DO_COPY);
    26202617          }
    2621           DrgFreeDraginfo(pDInfo);      /* Free DRAGINFO */
    2622         }
    2623         return (MRFROM2SHORT(DOR_NODROP, 0));   /* Drop not valid */
     2618          DrgFreeDraginfo(pDInfo);                    // Free DRAGINFO
     2619        }
     2620        return (MRFROM2SHORT(DOR_NODROP, 0));         // Drop not valid
    26242621
    26252622      case CN_INITDRAG:
  • trunk/dll/command.c

    r1640 r1673  
    378378  ULONG size;
    379379
    380 
    381   /*size = sizeof(BOOL) * 300;
    382   PrfQueryProfileData(fmprof, FM3Str, "COMMANDS.UsedCommandIDs", &UsedCommandIDs,
    383                       &size);
    384   size = sizeof(BOOL) * 40;
    385   PrfQueryProfileData(fmprof, FM3Str, "COMMANDS.UsedHotKeyIDs", &UsedHotKeyIDs,
    386                       &size);*/    // No need to use profile just count them GKY 02 JUL 11
    387380  size = sizeof(BOOL);
    388381  PrfQueryProfileData(fmprof, FM3Str, "COMMANDS.LoadCommandsFromINI",
     
    404397            continue;
    405398          if (!xfgets_bstripcr(pszCmdLine, MaxComLineStrg, fp, pszSrcFile, __LINE__))
    406             break;                              /* error! */
     399            break;                              // error!
    407400          if (!xfgets_bstripcr(flags, sizeof(flags), fp, pszSrcFile, __LINE__))
    408401            break;
     
    739732    return NULL;
    740733  }
    741   if (!cmdhead)                         /* only item in list */
     734  if (!cmdhead)                         // only item in list
    742735    cmdhead = cmdtail = info;
    743736  else {
    744     /* place at tail */
     737    // place at tail
    745738    cmdtail->next = info;
    746739    info->prev = cmdtail;
  • trunk/dll/comp.c

    r1670 r1673  
    15691569        memset(&fb4, 0, sizeof(fb4));
    15701570        fp = xfopen(cmp->rightlist, moder, pszSrcFile, __LINE__, FALSE);
    1571         /*if (!fp)
    1572           Runtime_Error(pszSrcFile, __LINE__, "can not open %s (%d)",
    1573                         cmp->rightlist, errno);*/
    15741571        if (fp) {
    15751572          while (!feof(fp)) {
     
    21372134
    21382135  if (!fEnable) {
    2139     /* Disable before */
     2136    // Disable before
    21402137    WinEnableWindowUpdate(hwndLeft, fEnable);
    21412138    WinEnableWindowUpdate(hwndRight, fEnable);
     
    21442141  WinEnableWindow(hwndRight, fEnable);
    21452142  if (fEnable) {
    2146     /* Enable after */
     2143    // Enable after
    21472144    WinEnableWindowUpdate(hwndLeft, fEnable);
    21482145    WinEnableWindowUpdate(hwndRight, fEnable);
     
    21502147
    21512148  WinEnableWindow(WinWindowFromID(hwnd, DID_OK), fEnable);
    2152   // WinEnableWindow(WinWindowFromID(hwnd, DID_CANCEL), fEnable);
    21532149  WinEnableWindow(WinWindowFromID(hwnd, COMP_COLLECT), fEnable);
    21542150  WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTBOTH), fEnable);
     
    22482244
    22492245        for (x = 0; ids[x]; x++) {
    2250           //fixme to allow user to change presparams 1-10-09 GKY
    22512246          sprintf(s, "CompDir%i", ids[x]);
    22522247          RestorePresParams(WinWindowFromID(hwnd, ids[x]), s);
    2253           /*SetPresParams(WinWindowFromID(hwnd, ids[x]),
    2254                         &RGBGREY,
    2255                         &RGBBLACK, &RGBBLACK, FNT_8HELVETICA);*/
    22562248        }
    22572249      }
  • trunk/dll/datamin.c

    r1628 r1673  
    417417      break;
    418418    }
    419     /* else intentional fallthru */
     419    // else intentional fallthru
    420420  case WM_CHORD:
    421421  case WM_BUTTON3DBLCLK:
     
    10841084          pDM->qfsa_cb = sizeof(FSQBUFFER2) + 256;      // se tDataMin
    10851085          DosError(FERR_DISABLEHARDERR);
    1086           pDM->qfsa_rc = DosQueryFSAttach(szPath, 0,    /* Ordinal */
     1086          pDM->qfsa_rc = DosQueryFSAttach(szPath, 0,    // Ordinal
    10871087                                          FSAIL_QUERYNAME,
    10881088                                          &pDM->fsqb2, &pDM->qfsa_cb);
  • trunk/dll/defview.c

    r1656 r1673  
    203203                 ULONG flags, CHAR * filename)
    204204{
    205   /*
     205  /**
    206206   * bitmapped flags:
    207207   * ---------------
     
    228228  }
    229229
    230   if (flags & 1)                        /* directly view the file */
     230  if (flags & 1)                        // directly view the file
    231231    goto ViewIt;
    232232
    233   if (flags & 2) {                      /* open default WPS view of file */
     233  if (flags & 2) {                      // open default WPS view of file
    234234    OpenObject(filename, Default, hwnd);
    235235    return;
    236236  }
    237237
    238   if (flags & 4) {                      /* open WPS settings notebook for file */
     238  if (flags & 4) {                      // open WPS settings notebook for file
    239239    OpenObject(filename, Settings, hwnd);
    240240    return;
    241241  }
    242242
    243   if ((flags & 16) || !IsFile(filename)) {      /* open info for directories */
     243  if ((flags & 16) || !IsFile(filename)) {      // open info for directories
    244244
    245245    char fullname[CCHMAXPATH];
     
    267267  }
    268268
    269   if (flags & 8) {                      /* edit file */
     269  if (flags & 8) {                      // edit file
    270270
    271271    ULONG type = IDM_EDITTEXT;
     
    282282        break;
    283283      }
    284       /* else intentional fallthru */
     284      // else intentional fallthru
    285285    case IDM_EDITTEXT:
    286286      if (*editor)
  • trunk/dll/dircnrs.c

    r1664 r1673  
    225225          break;
    226226        }
    227         /* else intentional fallthru */
     227        // else intentional fallthru
    228228      case DIR_SELECTED:
    229229      case DIR_VIEW:
     
    256256                                                                   QW_PARENT),
    257257                                                    DIR_CNR), QWL_USER);
    258             if (id == DIR_SORT) {       /* don't have sort pathname in dirs */
     258            if (id == DIR_SORT) {       // don't have sort pathname in dirs
    259259              WinSendMsg(hwndButtonPopup,
    260260                         MM_DELETEITEM,
     
    514514        if (AcceptOneDrop(hwnd, mp1, mp2))
    515515          return MRFROM2SHORT(DOR_DROP, DO_MOVE);
    516         return (MRFROM2SHORT(DOR_NODROP, 0));   /* Drop not valid */
     516        return (MRFROM2SHORT(DOR_NODROP, 0));   // Drop not valid
    517517      case DM_DROPHELP:
    518518        DropHelp(mp1, mp2, hwnd, GetPString(IDS_DIRCNRFOLDERDROPHELP));
     
    754754      Fortify_ChangeScope(dcd, -1);
    755755#     endif
    756       /* set unique id */
     756      // set unique id
    757757      WinSetWindowUShort(hwnd, QWS_ID, DIROBJ_FRAME + (DIR_FRAME - dcd->id));
    758758      dcd->hwndObject = hwnd;
    759759      if (ParentIsDesktop(hwnd, dcd->hwndParent))
    760         DosSleep(100); //05 Aug 07 GKY 250
     760        DosSleep(100);
    761761    }
    762762    else
     
    835835
    836836  case UM_RESCAN:
    837     /*
    838      * populate container
    839      */
     837    // populate container
    840838    dcd = WinQueryWindowPtr(hwnd, QWL_USER);
    841839    if (dcd) {
    842       //DosEnterCritSec(); //GKY 11-29-08
    843840      DosRequestMutexSem(hmtxFM2Globals, SEM_INDEFINITE_WAIT);
    844841      if (dcd->stopflag)
     
    846843      if (dcd->stopflag) {
    847844        DosReleaseMutexSem(hmtxFM2Globals);
    848         //DosExitCritSec();
    849845        return 0;
    850846      }
    851847      DosReleaseMutexSem(hmtxFM2Globals);
    852       //DosExitCritSec();
    853848      if (mp1) {
    854849        strcpy(dcd->previous, dcd->directory);
     
    943938            WinSendMsg(dcd->hwndCnr, CM_SETRECORDEMPHASIS, MPFROMP(pci),
    944939                       MPFROM2SHORT(TRUE, CRA_CURSORED));
    945             /* make sure that record shows in viewport */
     940            // make sure that record shows in viewport
    946941            ShowCnrRecord(dcd->hwndCnr, (PMINIRECORDCORE) pci);
    947942          }
     
    13621357
    13631358  case WM_SETFOCUS:
    1364     /* put name of our window (directory name) on status line */
     1359    // put name of our window (directory name) on status line
    13651360    if (mp2) {
    13661361      // Getting focus
    13671362      if (dcd && hwndStatus) {
    1368         /* put name of our window (directory name) on status line */
     1363        // put name of our window (directory name) on status line
    13691364        PCNRITEM pci = NULL;
    13701365        if (fAutoView && hwndMain) {
     
    15501545    if (dcd) {
    15511546      if (!dcd->hwndObject) {
    1552         /*
    1553          * first time through -- set things up
    1554          */
     1547        // first time through -- set things up
    15551548
    15561549        CNRINFO cnri;
     
    18811874                pci = FindCnrRecord(hwnd, newfile, NULL, TRUE, FALSE, TRUE);
    18821875                if (pci && (INT) pci != -1)
    1883                   /* make sure that record shows in viewport */
     1876                  // make sure that record shows in viewport
    18841877                  ShowCnrRecord(hwnd, (PMINIRECORDCORE) pci);
    18851878              }
     
    28402833        break;
    28412834
    2842 /*
    2843           case CN_PICKUP:
    2844             return PickUp(hwnd,dcd->hwndObject,mp2);
    2845 */
    2846 
    28472835      case CN_CONTEXTMENU:
    28482836        {
     
    29332921        if (mp2) {
    29342922
    2935           PDRAGITEM pDItem;     /* Pointer to DRAGITEM */
    2936           PDRAGINFO pDInfo;     /* Pointer to DRAGINFO */
     2923          PDRAGITEM pDItem;     // Pointer to DRAGITEM
     2924          PDRAGINFO pDInfo;     // Pointer to DRAGINFO
    29372925          PCNRITEM pci;
    29382926          USHORT uso;
     
    29492937              DRIVE_NOTWRITEABLE)) {
    29502938            DrgFreeDraginfo(pDInfo);
    2951             return MRFROM2SHORT(DOR_DROP,       /* Return okay to link */
    2952                                 DO_LINK);       /* (compare) only */
     2939            return MRFROM2SHORT(DOR_DROP,       // Return okay to link
     2940                                DO_LINK);       // (compare) only
    29532941          }
    29542942          if (pci) {
     
    29862974          }
    29872975
    2988           /* Access DRAGITEM index to DRAGITEM
     2976          /**
     2977           * Access DRAGITEM index to DRAGITEM
    29892978           * Check valid rendering mechanisms and data
    29902979           */
     
    29992988            if (toupper(*dcd->directory) < 'C')
    30002989              return MRFROM2SHORT(DOR_DROP, DO_COPY);
    3001             return MRFROM2SHORT(DOR_DROP,       /* Return okay to drop */
     2990            return MRFROM2SHORT(DOR_DROP,       // Return okay to drop
    30022991                                ((fCopyDefault) ? DO_COPY : DO_MOVE));
    30032992          }
    3004           DrgFreeDraginfo(pDInfo);      /* Free DRAGINFO */
    3005         }
    3006         return MRFROM2SHORT(DOR_NODROP, 0);     /* Drop not valid */
     2993          DrgFreeDraginfo(pDInfo);      // Free DRAGINFO
     2994        }
     2995        return MRFROM2SHORT(DOR_NODROP, 0);     // Drop not valid
    30072996
    30082997      case CN_INITDRAG:
     
    36343623                     MPFROMLONG(CMA_FIRST));
    36353624    if (pci && (INT) pci != -1) {
    3636       /* Got match make found item current item */
     3625      // Got match make found item current item
    36373626      USHORT attrib = CRA_CURSORED;
    36383627      // 29 Mar 09 SHL fixme to clear other object select if not extended select
     
    36413630      WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPFROMP(pci),
    36423631                 MPFROM2SHORT(TRUE, attrib));
    3643       /* make sure that record shows in viewport */
     3632      // make sure that record shows in viewport
    36443633      ShowCnrRecord(hwnd, (PMINIRECORDCORE) pci);
    36453634      return (MRESULT)TRUE;
     
    36753664                 ULONG flags)
    36763665{
    3677   /* bitmapped flags:
     3666  /**
     3667   * bitmapped flags:
    36783668   * 0x00000001 = don't close app when window closes
    36793669   * 0x00000002 = no frame controls
  • trunk/dll/dirs.c

    r1607 r1673  
    5353  *curdir = 0;
    5454  ret = DosQCurDisk(&curdrive, &drivemap);
    55   curdirlen = CCHMAXPATH - 4;           /* NOTE!!!!!!!!! */
     55  curdirlen = CCHMAXPATH - 4;           // NOTE!!!!!!!!!
    5656  ret += DosQCurDir(curdrive, (PBYTE)&curdir[3], &curdirlen);
    5757  *curdir = (CHAR) ('@' + (INT) curdrive);
  • trunk/dll/dirsize.c

    r1570 r1673  
    182182    DosFindClose(hdir);
    183183
    184   /*
     184  /**
    185185   * the "|| strlen(pszFileName) < 4 below works around an OS/2 bug
    186186   * that prevents FAT root directories from being found when
  • trunk/dll/droplist.c

    r1498 r1673  
    5252BOOL CheckPmDrgLimit(PDRAGINFO pDInfo)
    5353{
    54     /*
     54    /**
    5555     * Checks for FM2 source window then checks window words
    5656     * for ulItemsToUnHilite and if it is not zero displays a
     
    7979                 char *buffer2, ULONG buflen2)
    8080{
    81   /*
     81  /**
    8282   * Gets archive name from directory field, file name from file field
    8383   * Returns FALSE on error, TRUE on success.
     
    8787  BOOL ret = FALSE;
    8888
    89   if (pDItem && buffer2 && buflen2) {   /* else error calling function */
    90     if (buffer1 && buflen1)             /* zero buffers */
     89  if (pDItem && buffer2 && buflen2) {   // else error calling function
     90    if (buffer1 && buflen1)             // zero buffers
    9191      *buffer1 = 0;
    9292    *buffer2 = 0;
     
    9595      len = DrgQueryStrName(pDItem->hstrContainerName, buflen1, buffer1);
    9696      buffer1[len] = 0;
    97       if (len) {                        /* be sure we get full pathname of arc file */
     97      if (len) {                        // be sure we get full pathname of arc file
    9898
    9999        char szTemp[CCHMAXPATH + 2];
     
    105105        }
    106106      }
    107       {                                 /* be sure that file/directory is accessible */
     107      {                                 // be sure that file/directory is accessible
    108108        FILESTATUS3 fsa3;
    109109
     
    130130BOOL FullDrgName(PDRAGITEM pDItem, CHAR * buffer, ULONG buflen)
    131131{
    132   /*
     132  /**
    133133   * Gets full name of file from a dragged item.
    134134   * Returns FALSE on error, TRUE on success.
     
    140140  FILESTATUS3 fsa3;
    141141
    142   if (pDItem && buffer && buflen) {     /* else error calling function */
    143     *buffer = 0;                        /* zero buffer */
     142  if (pDItem && buffer && buflen) {     // else error calling function
     143    *buffer = 0;                        // zero buffer
    144144
    145145    blen = DrgQueryStrName(pDItem->hstrContainerName, buflen, buffer);
     
    157157                          buflen - blen, buffer + blen);
    158158    buffer[blen + len] = 0;
    159     {                                   /* be sure we get full pathname of file/directory */
     159    {                                   // be sure we get full pathname of file/directory
    160160      char szTemp[CCHMAXPATH + 2];
    161161      rc = DosQueryPathInfo(buffer,
     
    184184BOOL GetOneDrop(HWND hwnd, MPARAM mp1, MPARAM mp2, char *buffer, ULONG buflen)
    185185{
    186   PDRAGITEM pDItem;                     /* DRAGITEM struct ptr */
    187   PDRAGINFO pDInfo;                     /* DRAGINFO struct ptr */
     186  PDRAGITEM pDItem;                     // DRAGITEM struct ptr
     187  PDRAGINFO pDInfo;                     // DRAGINFO struct ptr
    188188  ULONG numitems;
    189189  register ULONG curitem;
     
    191191
    192192  if (buffer && buflen)
    193     *buffer = 0;                        /* zero buffer field */
    194 
    195   pDInfo = (PDRAGINFO) mp1;             /* Get DRAGINFO pointer */
     193    *buffer = 0;                        // zero buffer field
     194
     195  pDInfo = (PDRAGINFO) mp1;             // Get DRAGINFO pointer
    196196  if (pDInfo) {
    197197    if (!DrgAccessDraginfo(pDInfo)) {
     
    203203      pDItem = DrgQueryDragitemPtr(pDInfo,0);
    204204      if (buflen && buffer) {
    205         if (DrgVerifyRMF(pDItem,        /* Check valid rendering */
    206                          (CHAR *) DRM_OS2FILE,  /* mechanisms and data */
     205        if (DrgVerifyRMF(pDItem,                // Check valid rendering
     206                         (CHAR *) DRM_OS2FILE,  // mechanisms and data
    207207                         NULL) && !(pDItem->fsControl & DC_PREPARE))
    208208          ret = FullDrgName(pDItem, buffer, buflen);
     
    224224BOOL AcceptOneDrop(HWND hwnd, MPARAM mp1, MPARAM mp2)
    225225{
    226   PDRAGITEM pDItem;                     /* Pointer to DRAGITEM */
    227   PDRAGINFO pDInfo;                     /* Pointer to DRAGINFO */
     226  PDRAGITEM pDItem;                     // Pointer to DRAGITEM
     227  PDRAGINFO pDInfo;                     // Pointer to DRAGINFO
    228228  BOOL ret = FALSE;
    229229
    230   pDInfo = (PDRAGINFO) mp1;             /* Get DRAGINFO pointer */
     230  pDInfo = (PDRAGINFO) mp1;             // Get DRAGINFO pointer
    231231  if (pDInfo) {
    232232    if (!DrgAccessDraginfo(pDInfo)) {
     
    237237      pDItem = DrgQueryDragitemPtr(pDInfo, 0);
    238238
    239       /* Check valid rendering mechanisms and data formats */
     239      // Check valid rendering mechanisms and data formats
    240240      if (DrgVerifyRMF(pDItem, (CHAR *) DRM_OS2FILE, NULL))
    241241        ret = TRUE;
     
    279279                     MPARAM mp1, MPARAM mp2)
    280280{
    281   /* builds a list from the dropped files */
     281  // builds a list from the dropped files
    282282
    283283  BOOL isArc = FALSE, arctest = FALSE;
     
    335335    }
    336336
    337     /* ambiguous drop request -- see what's allowed */
     337    // ambiguous drop request -- see what's allowed
    338338    if (Operation == DO_DEFAULT || Operation >= DO_UNKNOWN) {
    339339      if (pDItem->fsSupportedOps & DO_COPYABLE)
     
    345345    }
    346346    else {
    347       /* ignore object if selected command not allowed for it */
     347      // ignore object if selected command not allowed for it
    348348      BOOL ok;
    349349      switch (Operation) {
  • trunk/dll/eas.c

    r1628 r1673  
    8787HOLDFEA *CheckEA(HOLDFEA * head, CHAR * eaname)
    8888{
    89   /* return pointer to ea named eaname if found in linked list */
     89  // return pointer to ea named eaname if found in linked list
    9090
    9191  register HOLDFEA *info = NULL;
     
    196196            }
    197197          }
    198           /* if we get here, create dummy ea */
     198          // if we get here, create dummy ea
    199199          {
    200200            PFEA2LIST pfealist = NULL;
     
    215215              eaval += sizeof(USHORT);
    216216              if (type == EAT_MVST || type == EAT_MVMT) {
    217                 *(USHORT *) eaval = (USHORT) 0; /* codepage */
     217                *(USHORT *) eaval = (USHORT) 0; // codepage
    218218                eaval += sizeof(USHORT);
    219                 *(USHORT *) eaval = (USHORT) 1; /* number */
     219                *(USHORT *) eaval = (USHORT) 1; // number
    220220                eaval += sizeof(USHORT);
    221                 *(USHORT *) eaval = (USHORT) EAT_ASCII; /* type */
     221                *(USHORT *) eaval = (USHORT) EAT_ASCII; // type
    222222                eaval += sizeof(USHORT);
    223223              }
     
    263263VOID HexDump(HWND hwnd, CHAR * value, ULONG cbValue)
    264264{
    265   /* display a hexdump of a binary 'string' in listbox hwnd */
     265  // display a hexdump of a binary 'string' in listbox hwnd
    266266
    267267  CHAR s[132];
     
    10591059             BOOL silentfail)
    10601060{
    1061   /* save an ea to disk */
     1061  // save an ea to disk
    10621062
    10631063  PFEA2LIST pfealist = NULL;
     
    11541154      }
    11551155      break;
    1156 /*
    1157    cbList      nextoffset fea cb cbval name.......
    1158    000000  3C 00 00 00 00 00 00 00 6F 0B 24 00 2E 4B 45 59  <       o
     1156/**
     1157 * cbList      nextoffset fea cb cbval name.......
     1158 * 000000  3C 00 00 00 00 00 00 00 6F 0B 24 00 2E 4B 45 59  <       o
    11591159$ .KEY
    1160    ....................    eat   code  num   eat
    1161    000010  50 48 52 41 53 45 53 00 DF FF 00 00 02 00 FD FF  PHRASES ßÿ  ýÿ
    1162    len.. phrase1............................ eat
    1163    000020  0C 00 4B 65 79 20 70 68 72 61 73 65 20 31 FD FF 
     1160 * ....................    eat   code  num   eat
     1161 * 000010  50 48 52 41 53 45 53 00 DF FF 00 00 02 00 FD FF  PHRASES ßÿ  ýÿ
     1162 * len.. phrase1............................ eat
     1163 * 000020  0C 00 4B 65 79 20 70 68 72 61 73 65 20 31 FD FF 
    11641164 Key phrase 1ýÿ
    1165    len.. phrase2......................
    1166    000030  0A 00 4B 65 79 20 70 68 72 61 73 65               Key phrase
     1165 * len.. phrase2......................
     1166 * 000030  0A 00 4B 65 79 20 70 68 72 61 73 65               Key phrase
    11671167 */
    11681168    case EAT_MVMT:
     
    12011201      break;
    12021202    }
    1203     pfealist->list[0].cbValue = /*(ULONG)*/ (eaval -
    1204                                          (pfealist->list[0].szName +
    1205                                           pfealist->list[0].cbName + 1));
     1203    pfealist->list[0].cbValue = eaval - (pfealist->list[0].szName + pfealist->list[0].cbName + 1);
    12061204    eaop.fpGEA2List = (PGEA2LIST) 0;
    12071205    eaop.fpFEA2List = pfealist;
     
    12391237HOLDFEA *GetFileEAs(CHAR * filename, BOOL ishandle, BOOL silentfail)
    12401238{
    1241   /* load eas from disk into HOLDFEA linked list */
     1239  // load eas from disk into HOLDFEA linked list
    12421240
    12431241  HOLDFEA *head = NULL, *info, *last = NULL;
     
    13421340  }
    13431341  else {
    1344     /* try it without opening it */
     1342    // try it without opening it
    13451343    if (!DosQueryPathInfo(filename, FIL_QUERYEASIZE, (PVOID) & fsa4,
    13461344                          (ULONG) sizeof(fsa4)) &&
     
    14411439VOID Free_FEAList(HOLDFEA * pFEA)
    14421440{
    1443   /* free a linked list of HOLDFEAs */
     1441  // free a linked list of HOLDFEAs
    14441442
    14451443  register HOLDFEA *next;
    14461444
    14471445  while (pFEA) {
    1448     /* Free linked list */
     1446    // Free linked list
    14491447    next = pFEA->next;
    14501448    xfree(pFEA->pfea, pszSrcFile, __LINE__);
  • trunk/dll/errutil.c

    r1558 r1673  
    216216                           PCSZ pszFmt, va_list pva)
    217217{
    218   PERRINFO pErrInfoBlk;         /* Pointer to ERRINFO structure filled
    219                                    by WinGetErrorInfo */
    220   PSZ pszOffset;                /* Pointer to current error message returned
    221                                    by WinGetErrorInfo */
     218  PERRINFO pErrInfoBlk;     // Pointer to ERRINFO structure filled by WinGetErrorInfo
     219  PSZ pszOffset;            // Pointer to current error message returned by WinGetErrorInfo
    222220  PSZ psz;
    223221  HAB hab;
     
    256254    if (!hwndOwner)
    257255      hwndOwner = HWND_DESKTOP;
    258     /* Find message offset in array of message offsets
    259        Assume 1 message - fixme?
    260      */
     256    // Find message offset in array of message offsets Assume 1 message - fixme?
    261257    pszOffset = ((PSZ) pErrInfoBlk) + pErrInfoBlk->offaoffszMsg;
    262     /* Address error message in array of messages and
    263        append error message to source code linenumber
    264      */
     258    // Address error message in array of messages and append error message to source code linenumber
    265259    psz = pszBuf + strlen(pszBuf);
    266260    sprintf(psz, " #0x%04x \"", ERRORIDERROR(pErrInfoBlk->idError));
  • trunk/dll/excputil.c

    r1544 r1673  
    1 
    2 /* excputil.c - exception handlers
    3    $Id$
     1/***********************************************************
     2
     3  $Id$
     4
     5  exception handlers
    46
    57  Copyright (c) 2008 Steven H. Levine
     
    1012  06 Dec 08 SHL Baseline (Ticket #26)
    1113
    12 */
     14************************************************************/
    1315
    1416#include <stdio.h>                      // fprintf
  • trunk/dll/filldir.c

    r1672 r1673  
    531531  pci->hwndCnr = hwndCnr;
    532532
    533   /* note that we cheat below, and accept the full pathname in pszDirectory
    534      if !*pffb->achName.  This speeds up and simplifies processing elsewhere
    535      (like in update.c)
     533  /**
     534   * note that we cheat below, and accept the full pathname in pszDirectory
     535   * if !*pffb->achName.  This speeds up and simplifies processing elsewhere
     536   * (like in update.c)
    536537   */
     538
    537539  if (!*pffb->achName) {
    538540    pci->pszFileName = xstrdup(pszDirectory, pszSrcFile, __LINE__);
     
    878880                      PULONGLONG pullTotalBytes)        // Optional
    879881{
    880   /* put all the directories (and files if filestoo is TRUE) from a
     882  /**
     883   * put all the directories (and files if filestoo is TRUE) from a
    881884   * directory into the container.  recurse through subdirectories if
    882885   * recurse is TRUE.
     
    947950      InitITimer(&itdSleep, 500);
    948951      do {
    949         /*
     952        /**
    950953         * remove . and .. from list if present
    951954         * also counter file system bugs that sometimes
     
    10511054              }
    10521055              cAffbTotal += ulSelCnt;
    1053               // 15 Sep 09 SHL allow timed updates to see
    1054               /*if (dcd) {
    1055                 dcd->totalfiles += ulSelCnt;
    1056                 dcd->ullTotalBytes += ullTotalBytes;
    1057               } */  //30 May 11 GKY caused counter to increment twice
    10581056            }
    10591057            else {
  • trunk/dll/findrec.c

    r1550 r1673  
    5656  srch.fsPrefix = FALSE;
    5757  srch.fsCaseSensitive = FALSE;
    58   srch.usView = CV_TREE;                /* | CV_EXACTMATCH; */
     58  srch.usView = CV_TREE;               
    5959  if (!pciParent)
    6060    pciParent = (PCNRITEM) CMA_FIRST;
     
    6363  while (pci && (INT) pci != -1) {
    6464    if (!noenv || (pci->flags & (RECFLAGS_ENV | RECFLAGS_UNDERENV)) == 0) {
    65       if (!partmatch) {                 /* full name must match full name */
     65      if (!partmatch) {                 // full name must match full name
    6666        if (!stricmp(pci->pszFileName, filename))
    67           return pci;                   /* success */
     67          return pci;                   // success
    6868      }
    69       else {                            /* only root name must match */
     69      else {                            // only root name must match
    7070        if (strlen(pci->pszFileName) > 3) {
    7171          p = strrchr(pci->pszFileName, '\\');
     
    8383          p = pci->pszFileName;
    8484        if (!stricmp(p, file))
    85           return pci;                   /* success */
     85          return pci;                   // success
    8686      }
    8787    }
     
    8989  }
    9090
    91   return NULL;                          /* failure */
     91  return NULL;                          // failure
    9292}
    9393
  • trunk/dll/fonts.c

    r1626 r1673  
    3434
    3535
    36 /*
     36/**
    3737 *   Convert vector font size using point size and fAttrs structure and
    3838 *   return it in that structure.
     
    4848  SIZEF sizef;
    4949
    50   hps = WinGetScreenPS(HWND_DESKTOP);   /* Screen presentation space */
    51 
    52   /*
     50  hps = WinGetScreenPS(HWND_DESKTOP);   // Screen presentation space
     51
     52  /**
    5353   *   Query device context for the screen and then query
    5454   *   the resolution of the device for the device context.
     
    5959  DevQueryCaps(hDC, CAPS_VERTICAL_FONT_RES, (LONG) 1, &lyFontResolution);
    6060
    61   /*
     61  /**
    6262   *   Calculate the size of the character box, based on the
    6363   *   point size selected and the resolution of the device.
     
    7373  WinReleasePS(hps);
    7474
    75 }                                       /* end ConvertVectorPointSize() */
     75}                                       // end ConvertVectorPointSize()
    7676
    7777VOID SetPresParamFromFattrs(HWND hwnd, FATTRS * fattrs,
     
    120120  HPS hps;
    121121  FONTMETRICS fm;
    122   CHAR szFamily[CCHMAXPATH],
    123     *szTitle = GetPString(IDS_SETFONTTITLETEXT), *szPreview;
    124 
    125   //DosEnterCritSec(); //GKY 11-30-08
     122  CHAR szFamily[CCHMAXPATH], *szTitle = GetPString(IDS_SETFONTTITLETEXT), *szPreview;
     123
    126124  DosRequestMutexSem(hmtxFM2Globals, SEM_INDEFINITE_WAIT);
    127125  szPreview = GetPString(IDS_BLURB1TEXT + counter++);
     
    131129  }
    132130  DosReleaseMutexSem(hmtxFM2Globals);
    133   //DosExitCritSec();
    134   memset(&fontdlg, 0, sizeof(fontdlg)); /* initialize all fields */
     131  memset(&fontdlg, 0, sizeof(fontdlg)); // initialize all fields
    135132  hps = WinGetPS(hwnd);
    136133  GpiQueryFontMetrics(hps, sizeof(FONTMETRICS), &fm);
     
    168165{
    169166
    170   /* Flags:
     167  /**
     168   * Flags:
    171169   *
    172170   * 1 = Don't assume MLE (no MLM_* messages, use fattrs only
     
    183181  CHAR szFamily[CCHMAXPATH];
    184182  PCSZ pcszPreview;
    185   static FIXED fxPointSize = 0; /* keep track of this for vector fonts */
     183  static FIXED fxPointSize = 0; // keep track of this for vector fonts
    186184
    187185  if ((flags & 1) && !fattrs)
    188186    return fattrs;
    189   //DosEnterCritSec(); //GKY 11-30-08
    190187  DosRequestMutexSem(hmtxFM2Globals, SEM_INDEFINITE_WAIT);
    191188  // 12 Jan 09 SHL fixme to do multiple previews or rename to IDS_BLURBTEXT
    192189  pcszPreview = GetPString(IDS_BLURB1TEXT);
    193190  DosReleaseMutexSem(hmtxFM2Globals);
    194   memset(&fontDlg, 0, sizeof(fontDlg)); /* initialize all fields */
    195   /*
    196    * Get the current font attributes
    197    */
     191  memset(&fontDlg, 0, sizeof(fontDlg)); // initialize all fields
     192  // Get the current font attributes
    198193  hps = WinGetPS(hwndMLE);
    199194  if (!(flags & 1))
     
    203198    memcpy(&fontDlg.fAttrs, fattrs, sizeof(FATTRS));
    204199
    205   /* create system default font */
    206 
     200  // create system default font
    207201  GpiCreateLogFont(hps, (PSTR8) fontDlg.fAttrs.szFacename, 1,
    208202                   &(fontDlg.fAttrs));
     
    213207  WinReleasePS(hps);
    214208
    215   /*
    216    * Initialize the FONTDLG structure with the current font
    217    */
    218   fontDlg.cbSize = sizeof(FONTDLG);     /* sizeof(FONTDLG) */
    219   fontDlg.hpsScreen = WinGetScreenPS(HWND_DESKTOP);     /* Screen presentation space */
    220   fontDlg.hpsPrinter = NULLHANDLE;      /* Printer presentation space */
     209  // Initialize the FONTDLG structure with the current font
     210  fontDlg.cbSize = sizeof(FONTDLG);
     211  fontDlg.hpsScreen = WinGetScreenPS(HWND_DESKTOP);     // Screen presentation space
     212  fontDlg.hpsPrinter = NULLHANDLE;                      // Printer presentation space
    221213
    222214  fontDlg.pszTitle = (PSZ)GetPString(IDS_SETVIEWERFONTTITLETEXT);
    223215  fontDlg.pszPreview = (PSZ)pcszPreview;
    224   fontDlg.pszPtSizeList = NULL;         /* Application provided size list  */
    225   fontDlg.pfnDlgProc = NULL;            /* Dialog subclass procedure       */
    226   strcpy(szFamily, fontMetrics.szFamilyname);   /* Family name of font        */
    227   fontDlg.pszFamilyname = szFamily;     /* point to Family name of font    */
    228   fontDlg.fxPointSize = fxPointSize;    /* Point size the user selected    */
    229   fontDlg.fl = FNTS_CENTER |            /* FNTS_* flags - dialog styles    */
     216  fontDlg.pszPtSizeList = NULL;                         // Application provided size list
     217  fontDlg.pfnDlgProc = NULL;                            // Dialog subclass procedure
     218  strcpy(szFamily, fontMetrics.szFamilyname);           // Family name of font       
     219  fontDlg.pszFamilyname = szFamily;                     // point to Family name of font
     220  fontDlg.fxPointSize = fxPointSize;                    // Point size the user selected
     221  fontDlg.fl = FNTS_CENTER |                            // FNTS_* flags - dialog styles
    230222    FNTS_INITFROMFATTRS;
    231223  if (flags & 2)
     
    237229  else if (flags & 16)
    238230    fontDlg.fl |= FNTS_VECTORONLY;
    239   fontDlg.flFlags = 0;                  /* FNTF_* state flags              */
    240   /* Font type option bits           */
     231  fontDlg.flFlags = 0;                  // FNTF_* state flags
     232  // Font type option bits
    241233  fontDlg.flType = (LONG) fontMetrics.fsType;
    242   fontDlg.flTypeMask = 0;               /* Mask of which font types to use */
    243   fontDlg.flStyle = 0;                  /* The selected style bits         */
    244   fontDlg.flStyleMask = 0;              /* Mask of which style bits to use */
    245   fontDlg.clrFore = CLR_NEUTRAL;        /* Selected foreground color       */
    246   fontDlg.clrBack = CLR_BACKGROUND;     /* Selected background color       */
    247   fontDlg.ulUser = 0;                   /* Blank field for application     */
    248   fontDlg.lReturn = 0;                  /* Return Value of the Dialog      */
    249   fontDlg.lEmHeight = 0;                /* Em height of the current font   */
    250   fontDlg.lXHeight = 0;                 /* X height of the current font    */
    251   fontDlg.lExternalLeading = 0;         /* External Leading of font        */
    252   /* Nominal Point Size of font      */
     234  fontDlg.flTypeMask = 0;               // Mask of which font types to use
     235  fontDlg.flStyle = 0;                  // The selected style bits         
     236  fontDlg.flStyleMask = 0;              // Mask of which style bits to use
     237  fontDlg.clrFore = CLR_NEUTRAL;        // Selected foreground color       
     238  fontDlg.clrBack = CLR_BACKGROUND;     // Selected background color       
     239  fontDlg.ulUser = 0;                   // Blank field for application     
     240  fontDlg.lReturn = 0;                  // Return Value of the Dialog     
     241  fontDlg.lEmHeight = 0;                // Em height of the current font   
     242  fontDlg.lXHeight = 0;                 // X height of the current font   
     243  fontDlg.lExternalLeading = 0;         // External Leading of font       
     244  // Nominal Point Size of font
    253245  fontDlg.sNominalPointSize = fontMetrics.sNominalPointSize;
    254   fontDlg.usWeight = fontMetrics.usWeightClass; /* The boldness of the font */
    255   fontDlg.usWidth = fontMetrics.usWidthClass;   /* The width of the font     */
    256   fontDlg.x = 0;                        /* X coordinate of the dialog      */
    257   fontDlg.y = 0;                        /* Y coordinate of the dialog      */
    258 //   fontDlg.usDlgId      = IDD_FONT;       /* ID of a custom dialog template  */
    259   fontDlg.usFamilyBufLen = sizeof(szFamily);    /*Length of family name buffer */
    260 
    261   /*
    262    *   Bring up the standard Font Dialog
    263    */
     246  fontDlg.usWeight = fontMetrics.usWeightClass; // The boldness of the font
     247  fontDlg.usWidth = fontMetrics.usWidthClass;   // The width of the font
     248  fontDlg.x = 0;                                // X coordinate of the dialog
     249  fontDlg.y = 0;                                // Y coordinate of the dialog
     250  fontDlg.usFamilyBufLen = sizeof(szFamily);    // Length of family name buffer
     251
     252  // Bring up the standard Font Dialog
    264253
    265254  if (!WinFontDlg(HWND_DESKTOP, hwndMLE, &fontDlg)
     
    268257    return NULL;
    269258  }
    270   fxPointSize = fontDlg.fxPointSize;    /* save point size for next dialog */
    271 
    272   /*
     259  fxPointSize = fontDlg.fxPointSize;    // save point size for next dialog
     260
     261  /**
    273262   *   If outline font, calculate the maxbaselineext and
    274263   *   avecharwidth for the point size selected
     
    285274  return fattrs;
    286275
    287 }                                       /* End of SetMLEFont() */
     276}                                       // End of SetMLEFont()
    288277
    289278#pragma alloc_text(FONTS,ConvertVectorFontSize,SetFont,SetMLEFont)
  • trunk/dll/fortify.c

    r1544 r1673  
    1 
    2 /* $Id$ */
    3 /* fortify.cxx - A fortified memory allocation shell - V2.2 */
    4  /* vim: tabs 4 */
    5 
    6 /*
    7  *     This  software  is  not public domain.  All material in
    8  * this  archive  is (C) Copyright 1995 Simon P.  Bullen.  The
    9  * software  is  freely distributable, with the condition that
    10  * no   more   than  a  nominal  fee  is  charged  for  media.
    11  * Everything  in  this distribution must be kept together, in
    12  * original, unmodified form.
    13  *     The software may be modified for your own personal use,
    14  * but modified files may not be distributed.
    15  *     The  material  is  provided "as is" without warranty of
    16  * any  kind.  The author accepts no responsibility for damage
    17  * caused by this software.
    18  *     This  software  may not be used in any way by Microsoft
    19  * Corporation  or  its  subsidiaries, or current employees of
    20  * Microsoft Corporation or its subsidiaries.
    21  *     This  software  may  not  be used for the construction,
    22  * development,  production,  or  testing of weapon systems of
    23  * any kind.
    24  *     This  software  may  not  be used for the construction,
    25  * development,  production,  or  use  of plants/installations
    26  * which  include  the  processing  of radioactive/fissionable
    27  * material.
    28  */
    29 
    30 /*
    31  *     If  you use this software at all, I'd love to hear from
    32  * you.   All  questions,  criticisms, suggestions, praise and
    33  * postcards are most welcome.
    34  *
    35  *            email:    sbullen@cybergraphic.com.au
    36  *
    37  *            snail:    Simon P. Bullen
    38  *                      PO BOX 12138
    39  *                      A'Beckett St.
    40  *                      Melbourne 3000
    41  *                      Australia
    42  */
    43 
    44  /* 06 May 08 SHL Rework scope logic to be MT capable
     1/****************************************************************
     2
     3  $Id$
     4
     5  fortify.cxx - A fortified memory allocation shell - V2.2
     6  vim: tabs 4
     7
     8
     9  This  software  is  not public domain.  All material in
     10  this  archive  is (C) Copyright 1995 Simon P.  Bullen.  The
     11  software  is  freely distributable, with the condition that
     12  no   more   than  a  nominal  fee  is  charged  for  media.
     13  Everything  in  this distribution must be kept together, in
     14  original, unmodified form.
     15  The software may be modified for your own personal use,
     16  but modified files may not be distributed.
     17  The  material  is  provided "as is" without warranty of
     18  any  kind.  The author accepts no responsibility for damage
     19  caused by this software.
     20  This  software  may not be used in any way by Microsoft
     21  Corporation  or  its  subsidiaries, or current employees of
     22  Microsoft Corporation or its subsidiaries.
     23  This  software  may  not  be used for the construction,
     24  development,  production,  or  testing of weapon systems of
     25  any kind.
     26  This  software  may  not  be used for the construction,
     27  development,  production,  or  use  of plants/installations
     28  which  include  the  processing  of radioactive/fissionable
     29  material.
     30
     31
     32
     33  If  you use this software at all, I'd love to hear from
     34  you.   All  questions,  criticisms, suggestions, praise and
     35  postcards are most welcome.
     36
     37           email:    sbullen@cybergraphic.com.au
     38
     39           snail:    Simon P. Bullen
     40                     PO BOX 12138
     41                     A'Beckett St.
     42                     Melbourne 3000
     43                     Australia
     44
     45
     46        06 May 08 SHL Rework scope logic to be MT capable
    4547        26 May 08 SHL Show TID for leaking scope
    4648        17 Jul 08 SHL Add Fortify_PresetOwner Fortify_BecomeOwner Fortify_ChangeScope
     
    4951        18 Jul 08 SHL Rename Fortify_ChangeOwner to Fortify_BecomeOwner
    5052        18 Jul 08 SHL Add reworked Fortify_SetOwner
    51  */
     53
     54***************************************************************************************/
    5255
    5356#ifdef FORTIFY
     
    6265
    6366
    64 /* the user's options */
     67// the user's options
    6568#include "ufortify.h"
    6669
    67 /* Prototypes and such */
     70// Prototypes and such
    6871#define __FORTIFY_C__                   // Suppress malloc replacement etc.
    6972#include "fortify.h"
     
    8184#endif
    8285
    83 /*
     86/**
    8487 * Round x up to the nearest multiple of n.
    8588 */
    8689#define ROUND_UP(x, n) ((((x) + (n)-1)/(n))*(n))
    8790
    88 /*
     91/**
    8992 * struct Header - this structure is used
    9093 * internally by Fortify to manage it's
     
    9396struct Header
    9497{
    95         unsigned short Checksum;    /* For the integrity of our goodies  */
    96         const char    *File;        /* The sourcefile of the allocator   */
    97         unsigned long  Line;        /* The sourceline of the allocator   */
     98        unsigned short Checksum;    // For the integrity of our goodies 
     99        const char    *File;        // The sourcefile of the allocator   
     100        unsigned long  Line;        // The sourceline of the allocator   
    98101#       ifdef FORTIFY_TRACK_DEALLOCATED_MEMORY
    99         const char    *FreedFile;   /* The sourcefile of the deallocator */
    100         unsigned long  FreedLine;   /* The sourceline of the deallocator */
    101         unsigned char  Deallocator; /* The deallocator used              */
     102        const char    *FreedFile;   // The sourcefile of the deallocator
     103        unsigned long  FreedLine;   // The sourceline of the deallocator
     104        unsigned char  Deallocator; // The deallocator used             
    102105#       endif
    103         size_t         Size;        /* The size of the malloc'd block    */
    104         struct Header *Prev;        /* Previous link                     */
    105         struct Header *Next;        /* Next link                         */
    106         char          *Label;   /* User's Label (may be null)        */
    107         unsigned char  Scope;       /* Scope level of the owner          */
    108         unsigned char  Allocator;   /* malloc/realloc/new/etc            */
     106        size_t         Size;        // The size of the malloc'd block   
     107        struct Header *Prev;        // Previous link                     
     108        struct Header *Next;        // Next link                         
     109        char          *Label;       // User's Label (may be null)       
     110        unsigned char  Scope;       // Scope level of the owner         
     111        unsigned char  Allocator;   // malloc/realloc/new/etc           
    109112#       ifdef MT_SCOPES
    110         unsigned short Owner;       /* TID ordinal of block owner        */
     113        unsigned short Owner;       // TID ordinal of block owner       
    111114#       endif
    112115};
     
    115118
    116119
    117 /*
     120/**
    118121 * FORTIFY_ALIGNED_BEFORE_SIZE is FORTIFY_BEFORE_SIZE rounded up to the
    119122 * next multiple of FORTIFY_ALIGNMENT. This is so that we can guarantee
     
    125128                   - FORTIFY_HEADER_SIZE)
    126129
    127 /*
     130/**
    128131 * FORTIFY_OVERHEAD is the total overhead added by Fortify to each
    129132 * memory block.
     
    134137
    135138
    136 /*
    137  *
    138  * Static Function Prototypes
    139  *
    140  */
     139// Static Function Prototypes
    141140static int  st_CheckBlock(struct Header *h, const char *file, unsigned long line);
    142141static int  st_CheckFortification (unsigned char *ptr, unsigned char value, size_t size);
     
    160159#ifdef FORTIFY_VERBOSE_WARN_WHEN_DISCARDING_DEALLOCATED_MEMORY
    161160static const char *st_DeallocatedMemoryBlockString(struct Header *h);
    162 #endif /* FORTIFY_WARN_WHEN_DISCARDING_DEALLOCATED_MEMORY */
    163 
    164 #endif /* FORTIFY_VERBOSE_WARN_WHEN_DISCARDING_DEALLOCATED_MEMORY */
     161#endif // FORTIFY_WARN_WHEN_DISCARDING_DEALLOCATED_MEMORY
     162
     163#endif // FORTIFY_VERBOSE_WARN_WHEN_DISCARDING_DEALLOCATED_MEMORY
    165164static int  st_IsOnDeallocatedList(struct Header *h);
    166165static int st_PurgeDeallocatedBlocks(unsigned long Bytes, const char *file, unsigned long line);
     
    168167static int st_CheckDeallocatedBlock(struct Header *h, const char *file, unsigned long line);
    169168static void st_FreeDeallocatedBlock(struct Header *h, const char *file, unsigned long line);
    170 #endif /* FORTIFY_TRACK_DEALLOCATED_MEMORY */
    171 
    172 
    173 /*
    174  *
    175  * Static variables
    176  *
    177  */
     169#endif // FORTIFY_TRACK_DEALLOCATED_MEMORY
     170
     171
     172// Static variables
    178173static struct Header *st_AllocatedHead;
    179174static int  st_AllocateFailRate;
     
    198193static unsigned long  st_DeleteLine[FORTIFY_DELETE_STACK_SIZE];
    199194static unsigned long  st_DeleteStackTop;
    200 #endif /* __cplusplus */
    201 
    202 /* statistics */
     195#endif // __cplusplus
     196
     197// statistics
    203198static unsigned long  st_MaxBlocks        = 0;
    204199static unsigned long  st_MaxAllocation    = 0;
     
    217212
    218213
    219 /* allocators */
     214// allocators
    220215static const char *st_AllocatorName[] =
    221216{
     
    228223};
    229224
    230 /* deallocators */
     225// deallocators
    231226static const char *st_DeallocatorName[] =
    232227{
     
    254249
    255250
    256 /*
     251/**
    257252 * Fortify_Allocate() - allocate a block of fortified memory
    258253 */
     
    268263#endif
    269264
    270         /*
    271          * If Fortify has been disabled, then it's easy
    272          */
     265        // If Fortify has been disabled, then it's easy
    273266        if(st_Disabled)
    274267        {
     
    277270                                  || allocator == Fortify_Allocator_array_new))
    278271                {
    279                         /*
     272                        /**
    280273                         * A new of zero bytes must succeed, but a malloc of
    281274                         * zero bytes probably won't
     
    306299        }
    307300
    308         /* Check to see if this allocation will
     301        /**
     302         * Check to see if this allocation will
    309303         * push us over the artificial limit
    310304         */
     
    330324                st_Output(st_Buffer);
    331325        }
    332 #endif /* FORTIFY_WARN_ON_ZERO_MALLOC */
     326#endif // FORTIFY_WARN_ON_ZERO_MALLOC
    333327
    334328#ifdef FORTIFY_FAIL_ON_ZERO_MALLOC
     
    341335                                st_AllocatorName[allocator], (unsigned long)size, file, line);
    342336                st_Output(st_Buffer);
    343 #endif /* FORTIFY_WARN_ON_ALLOCATE_FAIL */
     337#endif // FORTIFY_WARN_ON_ALLOCATE_FAIL
    344338                return 0;
    345339        }
    346 #endif /* FORTIFY_FAIL_ON_ZERO_MALLOC */
     340#endif // FORTIFY_FAIL_ON_ZERO_MALLOC
    347341
    348342#ifdef FORTIFY_WARN_ON_SIZE_T_OVERFLOW
    349         /*
     343        /**
    350344         * Ensure the size of the memory block
    351345         * plus the overhead isn't bigger than
     
    370364        do
    371365        {
    372                 /*
     366                /**
    373367                 * malloc the memory, including the space
    374368                 * for the header and fortification buffers
     
    380374
    381375#               ifdef FORTIFY_TRACK_DEALLOCATED_MEMORY
    382                 /*
     376                /**
    383377                 * If we're tracking deallocated memory, then
    384378                 * we can free some of it, rather than let
     
    389383                        another_try = st_PurgeDeallocatedBlocks(size, file, line);
    390384                }
    391 #               endif /* FORTIFY_TRACK_DEALLOCATED_MEMORY */
     385#               endif // FORTIFY_TRACK_DEALLOCATED_MEMORY
    392386
    393387        }
     
    404398        }
    405399
    406         /*
    407          * Begin Critical Region
    408          */
     400        // Begin Critical Region
    409401        FORTIFY_LOCK();
    410402
    411403
    412         /*
     404        /**
    413405         * Make the head's prev pointer point to us
    414406         * ('cos we're about to become the head)
     
    417409        {
    418410                st_CheckBlock(st_AllocatedHead, file, line);
    419                 /* what should we do if this fails? (apart from panic) */
     411                // what should we do if this fails? (apart from panic)
    420412
    421413                st_AllocatedHead->Prev = (struct Header *)ptr;
     
    427419#   endif
    428420
    429         /*
    430          * Initialize and validate the header
    431          */
     421        // Initialize and validate the header
    432422        h = (struct Header *)ptr;
    433423        h->Size      = size;
     
    448438        h->FreedLine = 0;
    449439        h->Deallocator = Fortify_Deallocator_nobody;
    450 #endif /* FORTIFY_TRACK_DEALLOCATED_MEMORY */
     440#endif // FORTIFY_TRACK_DEALLOCATED_MEMORY
    451441        st_MakeHeaderValid(h);
    452442        st_AllocatedHead = h;
    453443
    454         /*
    455          * Initialize the fortifications
    456          */
     444        // Initialize the fortifications
    457445        st_SetFortification(ptr + FORTIFY_HEADER_SIZE,
    458446                         FORTIFY_BEFORE_VALUE, FORTIFY_ALIGNED_BEFORE_SIZE);
     
    461449
    462450#       ifdef FORTIFY_FILL_ON_ALLOCATE
    463         /*
    464          * Fill the actual user memory
    465          */
     451        // Fill the actual user memory
    466452        st_SetFortification(ptr + FORTIFY_HEADER_SIZE + FORTIFY_ALIGNED_BEFORE_SIZE,
    467453                                                FORTIFY_FILL_ON_ALLOCATE_VALUE, size);
    468454#       endif
    469455
    470         /*
    471          * End Critical Region
    472          */
     456        // End Critical Region
    473457        FORTIFY_UNLOCK();
    474458
    475459
    476         /*
    477          * update the statistics
    478          */
     460        // update the statistics
    479461        st_TotalAllocation += size;
    480462        st_Allocations++;
     
    486468                st_MaxAllocation = st_CurAllocation;
    487469
    488         /*
     470        /**
    489471         * We return the address of the user's memory, not the start of the block,
    490472         * which points to our magic cookies
     
    495477
    496478
    497 /*
     479/**
    498480 * Fortify_Deallocate() - Free a block of memory allocated with Fortify_Allocate()
    499481 */
     
    516498#       endif
    517499
    518         /*
    519          * If Fortify has been disabled, then it's easy
    520          * (well, almost)
    521          */
     500        // If Fortify has been disabled, then it's easy * (well, almost)
    522501        if(st_Disabled)
    523502        {
    524                 /* there is a possibility that this memory
    525                  * block was allocated when Fortify was
    526                  * enabled, so we must check the Allocated
    527                  * list before we free it.
    528                  */
     503          /**
     504           *there is a possibility that this memory
     505           * block was allocated when Fortify was
     506           * enabled, so we must check the Allocated
     507           * list before we free it.
     508           */
    529509                if(!st_IsOnAllocatedList(h))
    530510                {
     
    534514                else
    535515                {
    536                         /* the block was allocated by Fortify, so we
    537                          * gotta free it differently.
    538                          */
    539                         /*
    540                          * Begin critical region
    541                          */
    542                         FORTIFY_LOCK();
    543 
    544                         /*
    545                          * Remove the block from the list
    546                          */
    547                         if(h->Prev)
    548                                 h->Prev->Next = h->Next;
    549                         else
    550                                 st_AllocatedHead = h->Next;
    551 
    552                         if(h->Next)
    553                                 h->Next->Prev = h->Prev;
    554 
    555                         /*
    556                          * End Critical Region
    557                          */
    558                         FORTIFY_UNLOCK();
    559 
    560                         /*
    561                          * actually free the memory
    562                          */
    563                         free(ptr);
    564                         return;
     516                  /**
     517                   * the block was allocated by Fortify, so we
     518                   * gotta free it differently.
     519                   */
     520                  // Begin critical region
     521                  FORTIFY_LOCK();
     522
     523                  // Remove the block from the list
     524                  if(h->Prev)
     525                          h->Prev->Next = h->Next;
     526                  else
     527                          st_AllocatedHead = h->Next;
     528
     529                  if(h->Next)
     530                          h->Next->Prev = h->Prev;
     531
     532                  // End Critical Region
     533                  FORTIFY_UNLOCK();
     534
     535                  // actually free the memory
     536                  free(ptr);
     537                  return;
    565538                }
    566539        }
     
    584557                        return;
    585558                }
    586 #               endif /* FORTIFY_TRACK_DEALLOCATED_MEMORY */
     559#               endif // FORTIFY_TRACK_DEALLOCATED_MEMORY
    587560
    588561#               ifdef FORTIFY_NO_PERCENT_P
     
    597570                return;
    598571        }
    599 #       endif /* FORTIFY_PARANOID_DEALLOCATE */
    600 
    601         /*
     572#       endif // FORTIFY_PARANOID_DEALLOCATE
     573
     574        /**
    602575         * Make sure the block is okay before we free it.
    603576         * If it's not okay, don't free it - it might not
     
    612585
    613586#       ifdef FORTIFY_TRACK_DEALLOCATED_MEMORY
    614         /*
     587        /**
    615588         * Make sure the block hasn't been freed already
    616589         * (we can get to here if FORTIFY_PARANOID_DEALLOCATE
     
    631604                return;
    632605        }
    633 #       endif /* FORTIFY_TRACK_DEALLOCATED_MEMORY */
    634 
    635         /*
     606#       endif // FORTIFY_TRACK_DEALLOCATED_MEMORY
     607
     608        /**
    636609         * Make sure the block is being freed with a valid
    637610         * deallocator. If not, complain. (but free it anyway)
     
    648621        }
    649622
    650         /*
    651          * Begin critical region
    652          */
     623        // Begin critical region
    653624        FORTIFY_LOCK();
    654625
    655         /*
    656          * Remove the block from the list
    657          */
     626        // Remove the block from the list
    658627        if(h->Prev)
    659628        {
     
    684653        }
    685654
    686         /*
    687          * End Critical Region
    688          */
     655        // End Critical Region
    689656        FORTIFY_UNLOCK();
    690657
    691         /*
    692          * update the statistics
    693          */
     658        // update the statistics
    694659        st_Frees++;
    695660        st_CurBlocks--;
     
    704669#endif
    705670        {
    706                 /*
     671                /**
    707672                 * Don't _actually_ free the memory block, just yet.
    708673                 * Place it onto the deallocated list, instead, so
     
    710675                 */
    711676#               ifdef FORTIFY_FILL_ON_DEALLOCATE
    712                 /*
    713                  * Nuke out all user memory that is about to be freed
    714                  */
     677                // Nuke out all user memory that is about to be freed
    715678                st_SetFortification(ptr + FORTIFY_HEADER_SIZE + FORTIFY_ALIGNED_BEFORE_SIZE,
    716679                                                FORTIFY_FILL_ON_DEALLOCATE_VALUE,
    717680                                          h->Size);
    718 #               endif /* FORTIFY_FILL_ON_DEALLOCATE */
    719 
    720                 /*
    721                  * Begin critical region
    722                  */
     681#               endif // FORTIFY_FILL_ON_DEALLOCATE
     682
     683                // Begin critical region
    723684                FORTIFY_LOCK();
    724685
    725                 /*
    726                  * Place the block on the deallocated list
    727                  */
     686                // Place the block on the deallocated list
    728687                if(st_DeallocatedHead)
    729688                {
     
    747706
    748707#               ifdef FORTIFY_DEALLOCATED_MEMORY_LIMIT
    749                 /*
    750                  * If we've got too much on the deallocated list; free some
    751                  */
     708                // If we've got too much on the deallocated list; free some
    752709                if(st_TotalDeallocated > FORTIFY_DEALLOCATED_MEMORY_LIMIT)
    753710                {
     
    756713#               endif
    757714
    758                 /*
    759                  * End critical region
    760                  */
     715                // End critical region
    761716                FORTIFY_UNLOCK();
    762717        }
    763718        else
    764 #       endif /* FORTIFY_TRACK_DEALLOCATED_MEMORY */
    765         {
    766                 /*
    767                  * Free the User Label
    768                  */
     719#       endif // FORTIFY_TRACK_DEALLOCATED_MEMORY
     720        {
     721                // Free the User Label
    769722                if(h->Label)
    770723                {
     
    773726
    774727#               ifdef FORTIFY_FILL_ON_DEALLOCATE
    775                 /*
    776                  * Nuke out all memory that is about to be freed, including the header
    777                  */
     728                // Nuke out all memory that is about to be freed, including the header
    778729                st_SetFortification(ptr, FORTIFY_FILL_ON_DEALLOCATE_VALUE,
    779730                                          FORTIFY_HEADER_SIZE + FORTIFY_ALIGNED_BEFORE_SIZE + h->Size + FORTIFY_AFTER_SIZE);
    780 #               endif /* FORTIFY_FILL_ON_DEALLOCATE */
    781 
    782                 /*
    783                  * And do the actual free
    784                  */
     731#               endif // FORTIFY_FILL_ON_DEALLOCATE
     732
     733                // And do the actual free
    785734                free(ptr);
    786735        }
     
    788737
    789738
    790 /*
     739/**
    791740 * Fortify_LabelPointer() - Labels the memory block
    792741 * with a string provided by the user. This function
     
    804753                struct Header *h = (struct Header *)ptr;
    805754
    806                 /* make sure the pointer is okay */
     755                // make sure the pointer is okay
    807756                Fortify_CheckPointer(uptr, file, line);
    808757
    809                 /* free the previous label */
     758                // free the previous label
    810759                if(h->Label)
    811760                {
     
    813762                }
    814763
    815                 /* make sure the label is sensible */
     764                // make sure the label is sensible
    816765                assert(label);
    817766
    818                 /* copy it in */
     767                // copy it in
    819768                h->Label = (char*)malloc(strlen(label)+1);
    820769                strcpy(h->Label, label);
    821770
    822                 /* update the checksum */
     771                // update the checksum
    823772                st_MakeHeaderValid(h);
    824773        }
    825774}
    826775
    827 /*
     776/**
    828777 * Fortify_CheckPointer() - Returns true if the uptr
    829778 * points to a valid piece of Fortify_Allocated()'d
     
    883832}
    884833
    885 /*
     834/**
    886835 * Fortify_SetOutputFunc(Fortify_OutputFuncPtr Output) -
    887836 * Sets the function used to output all error and
     
    901850}
    902851
    903 /*
     852/**
    904853 * Fortify_SetAllocateFailRate(int Percent) -
    905854 * Fortify_Allocate() will "fail" this Percent of
     
    920869
    921870
    922 /*
     871/**
    923872 * Fortify_CheckAllMemory() - Checks the fortifications
    924873 * of all memory on the allocated list. And, if
     
    939888        FORTIFY_LOCK();
    940889
    941         /*
    942          * Check the allocated memory
    943          */
     890        // Check the allocated memory
    944891        while(curr)
    945892        {
     
    950897        }
    951898
    952         /*
    953          * Check the deallocated memory while you're at it
    954          */
     899        // Check the deallocated memory while you're at it
    955900#       ifdef FORTIFY_TRACK_DEALLOCATED_MEMORY
    956901        curr = st_DeallocatedHead;
     
    964909#       endif
    965910
    966         /*
     911        /**
    967912         * If we know where we are, and everything is cool,
    968913         * remember that. It might be important.
     
    979924
    980925
    981 /*
     926/**
    982927 * Fortify_EnterScope() - enters a new Fortify scope
    983928 * level. Returns the new scope level.
     
    1019964}
    1020965
    1021 /* Fortify_LeaveScope - leaves a Fortify scope level,
     966/**
     967 * Fortify_LeaveScope - leaves a Fortify scope level,
    1022968 * also prints a memory dump of all non-freed memory
    1023969 * that was allocated during the scope being exited.
     
    11091055
    11101056#       ifdef FORTIFY_TRACK_DEALLOCATED_MEMORY
    1111         /*
     1057        /**
    11121058         * Quietly free all the deallocated memory
    11131059         * that was allocated in this scope that
     
    11201066        st_PurgeDeallocatedScope( st_Scope, file, line );
    11211067#       endif
    1122 #       endif /* FORTIFY_TRACK_DEALLOCATED_MEMORY */
     1068#       endif // FORTIFY_TRACK_DEALLOCATED_MEMORY
    11231069
    11241070        FORTIFY_UNLOCK();
     
    11301076}
    11311077
    1132 /*
     1078/**
    11331079 * Fortify_ListAllMemory() - Outputs the entire
    11341080 * list of currently allocated memory. For each block
     
    11801126}
    11811127
    1182 /*
     1128/**
    11831129 * Fortify_DumpAllMemory() - Outputs the entire list of
    11841130 * currently allocated memory. For each allocated block
     
    12181164}
    12191165
    1220 /* Fortify_OutputStatistics() - displays statistics
     1166/**
     1167 * Fortify_OutputStatistics() - displays statistics
    12211168 * about the maximum amount of memory that was
    12221169 * allocated at any one time.
     
    12521199}
    12531200
    1254 /* Fortify_GetCurrentAllocation() - returns the number of
     1201/**
     1202 * Fortify_GetCurrentAllocation() - returns the number of
    12551203 * bytes currently allocated.
    12561204 */
     
    12641212}
    12651213
    1266 /* Fortify_SetAllocationLimit() - set a limit on the total
     1214/**
     1215 * Fortify_SetAllocationLimit() - set a limit on the total
    12671216 * amount of memory allowed for this application.
    12681217 */
     
    12731222}
    12741223
    1275 /*
     1224/**
    12761225 * Fortify_Disable() - Run time method of disabling Fortify.
    12771226 * Useful if you need to turn off Fortify without recompiling
     
    12891238{
    12901239#       ifdef FORTIFY_TRACK_DEALLOCATED_MEMORY
    1291         /* free all deallocated memory we might be tracking */
     1240        // free all deallocated memory we might be tracking
    12921241        st_PurgeDeallocatedScope( 0, file, line );
    1293 #       endif /* FORTIFY_TRACK_DEALLOCATED_MEMORY */
     1242#       endif // FORTIFY_TRACK_DEALLOCATED_MEMORY
    12941243
    12951244        st_Disabled = 1;
     
    12981247
    12991248
    1300 /*
     1249/**
    13011250 * st_CheckBlock - Check a block's header and fortifications.
    13021251 * Returns true if the block is happy.
     
    13641313#ifdef FORTIFY_TRACK_DEALLOCATED_MEMORY
    13651314
    1366 /*
     1315/**
    13671316 * st_CheckDeallocatedBlock - Check a deallocated block's header and fortifications.
    13681317 * Returns true if the block is happy.
     
    14501399                st_SetFortification(ptr + FORTIFY_HEADER_SIZE + FORTIFY_ALIGNED_BEFORE_SIZE,
    14511400                                                        FORTIFY_FILL_ON_DEALLOCATE_VALUE, h->Size);
    1452 #               endif /* FORTIFY_FILL_ON_CORRUPTION */
     1401#               endif // FORTIFY_FILL_ON_CORRUPTION
    14531402                result = 0;
    14541403        }
    1455 #endif /* FORTIFY_FILL_ON_DEALLOCATE */
     1404#endif // FORTIFY_FILL_ON_DEALLOCATE
    14561405        return result;
    14571406 }
    14581407
    1459 #endif /* FORTIFY_TRACK_DEALLOCATED_MEMORY */
    1460 
    1461 
    1462 /*
     1408#endif // FORTIFY_TRACK_DEALLOCATED_MEMORY
     1409
     1410
     1411/**
    14631412 * st_CheckFortification - Checks if the _size_
    14641413 * bytes from _ptr_ are all set to _value_
     
    14751424}
    14761425
    1477 /*
     1426/**
    14781427 * st_SetFortification - Set the _size_ bytes from _ptr_ to _value_.
    14791428 */
     
    14841433}
    14851434
    1486 /*
     1435/**
    14871436 * st_OutputFortification - Output the corrupted section of the fortification
    14881437 */
     
    14981447        while(offset < size)
    14991448        {
    1500                 /*
    1501                  * Skip 3 or more 'correct' lines
    1502                  */
     1449                // Skip 3 or more 'correct' lines
    15031450                if((size - offset) < 3 * 16)
    15041451                        advance = size - offset;
     
    15421489}
    15431490
    1544 /*
     1491/**
    15451492 * st_HexDump - output a nice hex dump of "size" bytes, starting at "ptr" + "offset"
    15461493 */
     
    16081555}
    16091556
    1610 /*
     1557/**
    16111558 * st_IsHeaderValid - Returns true if the
    16121559 * supplied pointer does indeed point to a
     
    16191566}
    16201567
    1621 /*
     1568/**
    16221569 * st_MakeHeaderValid - Updates the checksum
    16231570 * to make the header valid
     
    16301577}
    16311578
    1632 /*
     1579/**
    16331580 * st_ChecksumHeader - Calculate (and return)
    16341581 * the checksum of the header. (Including the
     
    16511598}
    16521599
    1653 /*
     1600/**
    16541601 * st_IsOnAllocatedList - Examines the allocated
    16551602 * list to see if the given header is on it.
     
    16731620
    16741621#ifdef FORTIFY_TRACK_DEALLOCATED_MEMORY
    1675 /*
     1622
     1623/**
    16761624 * st_IsOnDeallocatedList - Examines the deallocated
    16771625 * list to see if the given header is on it.
     
    16941642}
    16951643
    1696 /*
     1644/**
    16971645 * st_PurgeDeallocatedBlocks - free at least "Bytes"
    16981646 * worth of deallocated memory, starting at the
     
    17101658                        file, line);
    17111659        st_Output(st_Buffer);
    1712 #       endif /* FORTIFY_WARN_WHEN_DISCARDING_DEALLOCATED_MEMORY */
     1660#       endif // FORTIFY_WARN_WHEN_DISCARDING_DEALLOCATED_MEMORY
    17131661
    17141662        while(st_DeallocatedTail && FreedBytes < Bytes)
     
    17221670                                st_DeallocatedMemoryBlockString(st_DeallocatedTail));
    17231671                st_Output(st_Buffer);
    1724 #               endif /* FORTIFY_VERBOSE_WARN_WHEN_DISCARDING_DEALLOCATED_MEMORY */
    1725 #               endif /* FORTIFY_WARN_WHEN_DISCARDING_DEALLOCATED_MEMORY */
     1672#               endif // FORTIFY_VERBOSE_WARN_WHEN_DISCARDING_DEALLOCATED_MEMORY
     1673#               endif // FORTIFY_WARN_WHEN_DISCARDING_DEALLOCATED_MEMORY
    17261674                st_FreeDeallocatedBlock(st_DeallocatedTail, file, line);
    17271675        }
     
    17301678}
    17311679
    1732 /*
     1680/**
    17331681 * st_PurgeDeallocatedScope - free all deallocated
    17341682 * memory blocks that were allocated within "Scope"
     
    17631711}
    17641712
    1765 /*
     1713/**
    17661714 * st_FreeDeallocatedBlock - actually remove
    17671715 * a deallocated block from the deallocated
     
    17731721        st_CheckDeallocatedBlock( h, file, line );
    17741722
    1775    /*
    1776         * Begin Critical region
    1777         */
     1723   // Begin Critical region
    17781724        FORTIFY_LOCK();
    17791725
     
    18041750        }
    18051751
    1806         /*
    1807          * Free the label
    1808          */
     1752        // Free the label
    18091753        if(h->Label)
    18101754        {
     
    18121756        }
    18131757
    1814         /*
    1815          * Nuke out all memory that is about to be freed, including the header
    1816          */
     1758        // Nuke out all memory that is about to be freed, including the header
    18171759        st_SetFortification((unsigned char*)h, FORTIFY_FILL_ON_DEALLOCATE_VALUE,
    18181760                        FORTIFY_HEADER_SIZE + FORTIFY_ALIGNED_BEFORE_SIZE + h->Size + FORTIFY_AFTER_SIZE);
    18191761
    1820         /*
    1821          * And do the actual free
    1822          */
     1762        // And do the actual free
    18231763        free(h);
    18241764
    1825         /*
    1826          * End critical region
    1827          */
     1765        // End critical region
    18281766        FORTIFY_UNLOCK();
    18291767}
    18301768
    1831 #endif /* FORTIFY_TRACK_DEALLOCATED_MEMORY */
    1832 
    1833 /*
     1769#endif // FORTIFY_TRACK_DEALLOCATED_MEMORY
     1770
     1771/**
    18341772 * st_OutputMemory - Hex and ascii dump the
    18351773 * user memory of a block.
     
    18431781
    18441782
    1845 /*
     1783/**
    18461784 * st_OutputHeader - Output the header
    18471785 */
     
    19081846}
    19091847
    1910 /*
     1848/**
    19111849 * st_OutputLastVerifiedPoint - output the last
    19121850 * known point where everything was hoopy.
     
    19211859}
    19221860
    1923 /*
     1861/**
    19241862 * st_MemoryBlockString - constructs a string that
    19251863 * desribes a memory block. (pointer,size,allocator,label)
     
    19611899#ifdef FORTIFY_WARN_WHEN_DISCARDING_DEALLOCATED_MEMORY
    19621900#ifdef FORTIFY_VERBOSE_WARN_WHEN_DISCARDING_DEALLOCATED_MEMORY
    1963 /*
     1901
     1902/**
    19641903 * st_DeallocatedMemoryBlockString - constructs
    19651904 * a string that desribes a deallocated memory
     
    19951934        return st_BlockString;
    19961935}
    1997 #endif /* FORTIFY_VERBOSE_WARN_WHEN_DISCARDING_DEALLOCATED_MEMORY */
    1998 #endif /* FORTIFY_WARN_WHEN_DISCARDING_DEALLOCATED_MEMORY */
    1999 #endif /* FORTIFY_TRACK_DEALLOCATED_MEMORY */
    2000 
    2001 
    2002 /*
     1936#endif // FORTIFY_VERBOSE_WARN_WHEN_DISCARDING_DEALLOCATED_MEMORY
     1937#endif // FORTIFY_WARN_WHEN_DISCARDING_DEALLOCATED_MEMORY
     1938#endif // FORTIFY_TRACK_DEALLOCATED_MEMORY
     1939
     1940
     1941/**
    20031942 * st_DefaultOutput - the default output function
    20041943 */
     
    20101949}
    20111950
    2012 /*
     1951/**
    20131952 * Fortify_malloc - Fortify's replacement malloc()
    20141953 */
     
    20191958}
    20201959
    2021 /*
     1960/**
    20221961 * Fortify_realloc - Fortify's replacement realloc()
    20231962 */
     
    20291968        void *new_ptr;
    20301969
    2031         /*
    2032          * If Fortify is disabled, we gotta do this a little
    2033          * differently.
    2034          */
     1970        // If Fortify is disabled, we gotta do this a little differently.
    20351971        if(!st_Disabled)
    20361972        {
     
    20842020        else
    20852021        {
    2086                 /*
    2087                  * If the old block was fortified, we can't use normal realloc.
    2088                  */
     2022                // If the old block was fortified, we can't use normal realloc.
    20892023                if(st_IsOnAllocatedList(h))
    20902024                {
     
    21012035                        return(new_ptr);
    21022036                }
    2103                 else /* easy */
     2037                else // easy
    21042038                {
    21052039                        return realloc(uptr, new_size);
     
    21082042}
    21092043
    2110 /*
     2044/**
    21112045 * Fortify_calloc - Fortify's replacement calloc
    21122046 */
     
    21292063}
    21302064
    2131 /*
     2065/**
    21322066 * Fortify_free - Fortify's replacement free
    21332067 */
     
    21352069Fortify_free(void *uptr, const char *file, unsigned long line)
    21362070{
    2137         /* it is defined to be safe to free(0) */
     2071        // it is defined to be safe to free(0)
    21382072        if(uptr == 0)
    21392073                return;
     
    21422076}
    21432077
    2144 /*
     2078/**
    21452079 * Fortify_strdup - Fortify's replacement strdup. Since strdup isn't
    21462080 * ANSI, it is only provided if FORTIFY_STRDUP is defined.
     
    21652099        }
    21662100}
    2167 #endif /* FORTIFY_STRDUP */
     2101#endif // FORTIFY_STRDUP
    21682102
    21692103static void
     
    21882122#ifdef __cplusplus
    21892123
    2190 /*
     2124/**
    21912125 * st_NewHandler() - there is no easy way to get
    21922126 * the new handler function. And isn't it great
     
    21982132st_NewHandler()
    21992133{
    2200         /* get the current handler */
     2134        // get the current handler
    22012135        Fortify_NewHandlerFunc handler = set_new_handler(0);
    22022136
    2203         /* and set it back (since we cant
    2204          * get it without changing it)
    2205          */
     2137        // and set it back (since we cant get it without changing it)
    22062138        set_new_handler(handler);
    22072139
     
    22092141}
    22102142
    2211 /*
     2143/**
    22122144 * operator new - Fortify's replacement new,
    22132145 * without source-code information.
     
    22302162}
    22312163
    2232 /*
     2164/**
    22332165 * operator new - Fortify's replacement new,
    22342166 * with source-code information
     
    22522184#ifdef FORTIFY_PROVIDE_ARRAY_NEW
    22532185
    2254 /*
     2186/**
    22552187 * operator new[], without source-code info
    22562188 */
     
    22722204}
    22732205
    2274 /*
     2206/**
    22752207 * operator new[], with source-code info
    22762208 */
     
    22912223}
    22922224
    2293 #endif /* FORTIFY_PROVIDE_ARRAY_NEW */
    2294 
    2295 /*
     2225#endif // FORTIFY_PROVIDE_ARRAY_NEW
     2226
     2227/**
    22962228 * Fortify_PreDelete - C++ does not allow overloading
    22972229 * of delete, so the delete macro calls Fortify_PreDelete
     
    23032235        FORTIFY_LOCK();
    23042236
    2305         /*
     2237        /**
    23062238         * Push the source code info for the delete onto the delete stack
    23072239         * (if we have enough room, of course)
     
    23162248}
    23172249
    2318 /*
     2250/**
    23192251 * Fortify_PostDelete() - Pop the delete source-code info
    23202252 * off the source stack.
     
    23282260}
    23292261
    2330 /*
     2262/**
    23312263 * operator delete - fortify's replacement delete
    23322264 */
     
    23372269        unsigned long line;
    23382270
    2339          /*
    2340           * It is defined to be harmless to delete 0
    2341           */
     2271        // It is defined to be harmless to delete 0
    23422272        if(uptr == 0)
    23432273                return;
    23442274
    2345         /*
    2346          * find the source-code info
    2347          */
     2275        // find the source-code info
    23482276        if(st_DeleteStackTop)
    23492277        {
     
    23702298#ifdef FORTIFY_PROVIDE_ARRAY_DELETE
    23712299
    2372 /*
     2300/**
    23732301 * operator delete[] - fortify's replacement delete[]
    23742302 */
     
    23792307        unsigned long line;
    23802308
    2381          /*
    2382           * It is defined to be harmless to delete 0
    2383           */
     2309        // It is defined to be harmless to delete 0
    23842310        if(uptr == 0)
    23852311                return;
    23862312
    2387         /*
    2388          * find the source-code info
    2389          */
     2313        // find the source-code info
    23902314        if(st_DeleteStackTop)
    23912315        {
     
    24102334}
    24112335
    2412 #endif /* FORTIFY_PROVIDE_ARRAY_DELETE */
     2336#endif // FORTIFY_PROVIDE_ARRAY_DELETE
    24132337
    24142338#ifdef FORTIFY_AUTOMATIC_LOG_FILE
    2415 /* Automatic log file stuff!
     2339/**
     2340 * Automatic log file stuff!
    24162341 *
    24172342 * AutoLogFile class. There can only ever be ONE of these
     
    24822407static Fortify_AutoLogFile Abracadabra;
    24832408
    2484 #endif /* FORTIFY_AUTOMATIC_LOG_FILE */
    2485 
    2486 #endif /* __cplusplus */
     2409#endif // FORTIFY_AUTOMATIC_LOG_FILE
     2410
     2411#endif // __cplusplus
    24872412
    24882413#ifdef MT_SCOPES
     
    25992524#endif // MT_SCOPES
    26002525
    2601 #endif /* FORTIFY */
     2526#endif // FORTIFY
  • trunk/dll/getnames.c

    r1545 r1673  
    5151    if (!loadedudirs)
    5252      load_udirs();
    53     {                                   /* fill user list box */
     53    {                                   // fill user list box
    5454      ULONG ulDriveNum, ulDriveMap;
    5555      ULONG ulSearchCount;
     
    116116  case WM_CONTROL:
    117117    switch (SHORT1FROMMP(mp1)) {
    118     case 260:                           /* drives dropdown list */
     118    case 260:                           // drives dropdown list
    119119      switch (SHORT2FROMMP(mp1)) {
    120120      case CBN_SHOWLIST:
     
    125125      break;
    126126
    127     case 258:                           /* name entry field */
     127    case 258:                           // name entry field
    128128      switch (SHORT2FROMMP(mp1)) {
    129129      case EN_SETFOCUS:
     
    137137      break;
    138138
    139     case 264:                           /* dirs listbox */
     139    case 264:                           // dirs listbox
    140140      switch (SHORT2FROMMP(mp1)) {
    141141      case LN_SETFOCUS:
     
    149149      break;
    150150
    151     case 266:                           /* files listbox */
     151    case 266:                           // files listbox
    152152      switch (SHORT2FROMMP(mp1)) {
    153153      case LN_SETFOCUS:
     
    295295  if (!DosQueryPathInfo(filename, FIL_STANDARD, &fsa, sizeof(fsa))) {
    296296    if (fsa.attrFile & FILE_DIRECTORY) {
    297       /* device or directory */
     297      // device or directory
    298298      saymsg(MB_CANCEL | MB_ICONEXCLAMATION,
    299299             hwnd, filename, GetPString(IDS_EXISTSBUTNOTFILETEXT), filename);
     
    380380  MakeFullName(filename);
    381381  if (!DosQueryPathInfo(filename, FIL_STANDARD, &fsa, sizeof(fsa))) {
    382     if (fsa.attrFile & FILE_DIRECTORY) {        /* device or directory */
     382    if (fsa.attrFile & FILE_DIRECTORY) {        // device or directory
    383383      saymsg(MB_CANCEL | MB_ICONEXCLAMATION,
    384384             hwnd, filename, GetPString(IDS_EXISTSBUTNOTFILETEXT), filename);
  • trunk/dll/grep.c

    r1668 r1673  
    146146}
    147147
    148 /*
     148/**
    149149 * this function originally from C_ECHO's Snippets -- modified
    150150 * brute force methodology
  • trunk/dll/i18nutil.c

    r1400 r1673  
    2020***********************************************************************/
    2121
    22 /*
     22/**
    2323 * COMMAFMT.C
    2424 * Adapted from public domain code by Bob Stout
  • trunk/dll/info.c

    r1544 r1673  
    383383} ICONSTUF;
    384384
    385 /*
     385/**
    386386 * subclass routine to allow changing a program's icon
    387387 */
  • trunk/dll/inis.c

    r1554 r1673  
    244244                                      (PSZ) inirec->app,
    245245                                      NULL, (PULONG) & ulSize) && ulSize) {
    246                 pDataK = xmalloc(ulSize, pszSrcFile, __LINE__); /* allocate space for keynames */
     246                pDataK = xmalloc(ulSize, pszSrcFile, __LINE__); // allocate space for keynames
    247247                if (pDataK) {
    248                   /* get keynames */
     248                  // get keynames
    249249                  if (PrfQueryProfileString(hiniTo,
    250250                                            (PSZ) inirec->app,
    251251                                            NULL, "\0", pDataK, ulSize)) {
    252252                    pCurrentK = pDataK;
    253                     /* step through keynames */
     253                    // step through keynames
    254254                    while (*pCurrentK) {
    255255                      if (PrfQueryProfileSize(hiniTo, inirec->app,
     
    258258                        pData = xmalloc(ulSize, pszSrcFile, __LINE__);
    259259                        if (pData) {
    260                           /* get data */
     260                          // get data
    261261                          if (PrfQueryProfileData(hiniTo, inirec->app,
    262262                                                  pCurrentK,
    263263                                                  pData, (PULONG) & ulSize))
    264                             /* write data to new ini file */
     264                            // write data to new ini file
    265265                            PrfWriteProfileData(hiniFrom, ((*inirec->app2) ?
    266266                                                        inirec->
    267267                                                        app2 : inirec->app),
    268268                                                pCurrentK, pData, ulSize);
    269                           free(pData);  /* free data */
     269                          free(pData);  // free data
    270270                        }
    271271                      }
    272                       while (*pCurrentK)        /* next keyname */
     272                      while (*pCurrentK)        // next keyname
    273273                        pCurrentK++;
    274274                      pCurrentK++;
    275275                    }
    276276                  }
    277                   free(pDataK);         /* free keynames */
     277                  free(pDataK);         // free keynames
    278278                }
    279279              }
     
    301301                pData = xmalloc(ulSize, pszSrcFile, __LINE__);
    302302                if (pData) {
    303                   /* get data */
     303                  // get data
    304304                  if (PrfQueryProfileData(hiniTo, inirec->app,
    305305                                          inirec->key,
    306306                                          pData, (PULONG) & ulSize))
    307                     /* write data to new ini file */
     307                    // write data to new ini file
    308308                    PrfWriteProfileData(hiniFrom, ((*inirec->app2) ?
    309309                                                inirec->app2 : inirec->app),
     
    311311                                         inirec->key2 : inirec->key),
    312312                                        pData, ulSize);
    313                   free(pData);          /* free data */
     313                  free(pData);          // free data
    314314                }
    315315              }
     
    429429            if (PrfQueryProfileSize(orig, NULL, NULL, (PULONG) & ulSize)
    430430                && ulSize) {
    431               pDataA = xmalloc(ulSize, pszSrcFile, __LINE__);   /* allocate space for applnames */
     431              pDataA = xmalloc(ulSize, pszSrcFile, __LINE__);   /// allocate space for applnames
    432432              if (pDataA) {
    433                 /* get applnames */
     433                // get applnames
    434434                if (PrfQueryProfileString
    435435                    (orig, NULL, NULL, "\0", pDataA, ulSize)) {
    436436                  pCurrentA = pDataA;
    437                   /* step through applnames */
     437                  // step through applnames
    438438                  while (*pCurrentA) {
    439                     /* now keynames for this applname */
     439                    // now keynames for this applname
    440440                    if (PrfQueryProfileSize(orig, (PSZ) pCurrentA, NULL,
    441441                                            (PULONG) & ulSize) && ulSize) {
    442                       pDataK = xmalloc(ulSize, pszSrcFile, __LINE__);   /* allocate space for keynames */
     442                      pDataK = xmalloc(ulSize, pszSrcFile, __LINE__);   // allocate space for keynames
    443443                      if (pDataK) {
    444                         /* get keynames */
     444                        // get keynames
    445445                        if (PrfQueryProfileString(orig, (PSZ) pCurrentA, NULL,
    446446                                                  "\0", pDataK, ulSize)) {
    447447                          pCurrentK = pDataK;
    448                           /* step through keynames */
     448                          // step through keynames
    449449                          while (*pCurrentK) {
    450450                            if (PrfQueryProfileSize(orig, pCurrentA,
     
    454454                              pData = xmalloc(ulSize, pszSrcFile, __LINE__);
    455455                              if (pData) {
    456                                 /* get data */
     456                                // get data
    457457                                if (PrfQueryProfileData(orig, pCurrentA,
    458458                                                        pCurrentK,
    459459                                                        pData,
    460460                                                        (PULONG) & ulSize))
    461                                   /* write data to new ini file */
     461                                  // write data to new ini file
    462462                                  PrfWriteProfileData(new, pCurrentA,
    463463                                                      pCurrentK, pData,
    464464                                                      ulSize);
    465                                 free(pData);    /* free data */
     465                                free(pData);    // free data
    466466                              }
    467467                            }
    468                             while (*pCurrentK)  /* next keyname */
     468                            while (*pCurrentK)  // next keyname
    469469                              pCurrentK++;
    470470                            pCurrentK++;
    471471                          }
    472472                        }
    473                         free(pDataK);   /* free keynames */
     473                        free(pDataK);   // free keynames
    474474                      }
    475475                    }
    476                     while (*pCurrentA)  /* next applname */
     476                    while (*pCurrentA)  // next applname
    477477                      pCurrentA++;
    478478                    pCurrentA++;
    479479                  }
    480480                }
    481                 free(pDataA);           /* free applnames */
     481                free(pDataA);           // free applnames
    482482              }
    483483            }
     
    11781178        }
    11791179        CloseProfile(testini, FALSE);
    1180         /* make copies of new inis */
     1180        // make copies of new inis
    11811181        *tempuserini = 0;
    11821182        *tempsysini = 0;
     
    12171217        }
    12181218        else {
    1219           /* backup old inis */
     1219          // backup old inis
    12201220          strcpy(tempuserini2, olduserini);
    12211221          p = strrchr(tempuserini2, '\\');
     
    12601260            break;
    12611261          }
    1262           /* copy new inis to old ini names */
     1262          // copy new inis to old ini names
    12631263          rc = DosCopy(userini, olduserini, DCPY_EXISTING);
    12641264          if (rc) {
     
    12851285            break;
    12861286          }
    1287           /* replace temp inis with new permanent inis */
     1287          // replace temp inis with new permanent inis
    12881288          memset(&prfp, 0, sizeof(PRFPROFILE));
    12891289          prfp.cchUserName = strlen(oldsysini);
     
    15151515HWND StartIniEditor(HWND hwnd, CHAR *fname, INT flags)
    15161516{
    1517   /*
     1517  /**
    15181518   * create an ini editor window
    15191519   * bitmapped flags:
     
    16991699      else {
    17001700        pDItem = DrgQueryDragitemPtr(pDInfo,0);
    1701         /* Check valid rendering mechanisms and data */
     1701        // Check valid rendering mechanisms and data
    17021702        if (DrgVerifyRMF(pDItem, (CHAR *) DRM_OS2FILE, NULL)) {
    17031703          DrgFreeDraginfo(pDInfo);
    1704           return (MRFROM2SHORT(DOR_DROP, DO_LINK));     /* OK to drop */
     1704          return (MRFROM2SHORT(DOR_DROP, DO_LINK));     // OK to drop
    17051705        }
    17061706        else if (DrgVerifyRMF(pDItem, (CHAR *) DRM_FM2INIRECORD, (CHAR *) DRF_FM2INI)) {
     
    17241724    {
    17251725      PDRAGINFO pDInfo = (PDRAGINFO) mp1;
    1726       PDRAGITEM pDItem;         /* Pointer to DRAGITEM */
     1726      PDRAGITEM pDItem;         // Pointer to DRAGITEM
    17271727      ULONG numitems, curitem, len;
    17281728      USHORT action;
     
    20442044    return 0;
    20452045
    2046   case UM_INITIALSIZE:                  /* kludge */
     2046  case UM_INITIALSIZE:                  // kludge
    20472047    inidata = INSTDATA(hwnd);
    20482048    if (!inidata)
     
    20862086
    20872087  case UM_LOADFILE:
    2088     /* load initial file */
     2088    // load initial file
    20892089    inidata = INSTDATA(hwnd);
    20902090    if (!inidata)
     
    21372137        WinFillRect(hps, &rcl, CLR_PALEGRAY);
    21382138        WinEndPaint(hps);
    2139         /*
    2140          * tell status window to paint its box
    2141          */
     2139        // tell status window to paint its box
    21422140        PaintRecessedWindow(WinWindowFromID(hwnd, INI_APPHDR),
    21432141                            (HPS) 0, FALSE, FALSE);
  • trunk/dll/init.c

    r1664 r1673  
    304304CHAR *NullStr             = "";
    305305PCSZ PCSZ_CM_ALLOCRECORD  = "CM_ALLOCRECORD";
     306PCSZ PCSZ_QUERYCNRINFO    = "CM_QUERYCNRINFO";
    306307PCSZ PCSZ_DOSCREATEMUTEXSEM =  "DosCreateMutexSem";
    307308PCSZ PCSZ_DOSCREATEEVENTSEM =  "DosCreateEventSem";
     
    543544VOID APIENTRY DeInitFM3DLL(ULONG why)
    544545{
    545   /* cleanup */
     546  // cleanup
    546547  static CHAR s[CCHMAXPATH];
    547548  CHAR *enddir, szTempFile[CCHMAXPATH];
     
    639640BOOL InitFM3DLL(HAB hab, int argc, char **argv)
    640641{
    641   /*
     642  /**
    642643   * this function should be called by any application using this DLL right
    643644   * after setting up a message queue
     
    714715    strcpy(profile, PCSZ_FM3DOTINI);
    715716  mypid = getpid();
    716   /* give default appname if none set by caller */
     717  // give default appname if none set by caller
    717718  if (!*appname)
    718719    strcpy(appname, FM3Str);
    719   /* save appname; may be reset below */
     720  // save appname; may be reset below
    720721  strcpy(realappname, appname);
    721722  if (!strcmp(appname, FM3Str))
     
    844845  priority_bumped();
    845846
    846   /* _heapmin() is done in a separate thread -- start it */
     847  // _heapmin() is done in a separate thread -- start it
    847848  if (xbeginthread(HeapThread,
    848849                   32768,
     
    853854  }
    854855
    855   /* timer messages are sent from a separate thread -- start it */
     856  // timer messages are sent from a separate thread -- start it
    856857  if (!StartTimer()) {
    857858    Runtime_Error(pszSrcFile, __LINE__,
     
    860861  }
    861862
    862   /* Are we the workplace shell? */
     863  // Are we the workplace shell?
    863864  env = getenv("WORKPLACE_PROCESS");
    864865  fWorkPlace = env != NULL &&
     
    957958    strcpy(appname, FM3Str);
    958959
    959   /* start help */
     960  // start help
    960961  memset(&hini, 0, sizeof(HELPINIT));
    961962  hini.cb = sizeof(HELPINIT);
    962   // hini.ulReturnCode = 0;
    963   // hini.pszTutorialName = NULL;
    964963  hini.phtHelpTable = (PHELPTABLE) MAKELONG(ID_HELPTABLE, 0xffff);
    965964  hini.hmodAccelActionBarModule = (HMODULE) 0;
    966   // hini.idAccelTable = 0;
    967   // hini.idActionBar = 0;
    968965  hini.pszHelpWindowTitle = (PSZ)GetPString(IDS_FM2HELPTITLETEXT);
    969966  hini.hmodHelpTableModule = FM3ModHandle;
     
    10151012  }
    10161013
    1017   /* register window classes we use */
     1014  // register window classes we use
    10181015  WinRegisterClass(hab,
    10191016                   (CHAR *) WC_MAINWND,
     
    16161613  LoadDetailsSwitches(PCSZ_DIRCNR, &dsDirCnrDefault, FALSE);
    16171614
    1618   /* load pointers and icons we use */
     1615  // load pointers and icons we use
    16191616  hptrArrow = WinQuerySysPointer(HWND_DESKTOP, SPTR_ARROW, FALSE);
    16201617  hptrBusy = WinQuerySysPointer(HWND_DESKTOP, SPTR_WAIT, FALSE);
     
    17651762    }
    17661763  }
    1767   DosClose(handle);                     /* Either way, we're done for now */
    1768   return ret;                           /* Return TRUE if matched */
     1764  DosClose(handle);                     // Either way, we're done for now
     1765  return ret;                           // Return TRUE if matched
    17691766}
    17701767
  • trunk/dll/init.h

    r1664 r1673  
    109109extern PCSZ FNT_8TIMESNEWROMAN;
    110110extern PCSZ PCSZ_CM_ALLOCRECORD;
     111extern PCSZ PCSZ_QUERYCNRINFO;
    111112extern PCSZ PCSZ_DOSCREATEMUTEXSEM;
    112113extern PCSZ PCSZ_DOSCREATEEVENTSEM;
  • trunk/dll/literal.c

    r1438 r1673  
    4141static INT index(const CHAR * s, const CHAR c);
    4242
    43 /* Get index of char in string
     43/**
     44 * Get index of char in string
    4445 * @parm s string to search
    4546 * @parm c char to search for
     
    5758}
    5859
    59 /* literal()
     60/**
     61 * literal()
    6062 * Translate a string with \ escape tokens to binary equivalent
    6163 * Translates in place
     
    103105    return 0;
    104106
    105   iBuf = 0;                                /* set index to first character */
     107  iBuf = 0;                                // set index to first character
    106108  while (pszBuf[iBuf]) {
    107109    switch (pszBuf[iBuf]) {
    108110    case '\\':
    109111      switch (pszBuf[iBuf + 1]) {
    110       case 'x':                        /* hexadecimal */
     112      case 'x':                        // hexadecimal
    111113        wchar = 0;
    112         iBuf += 2;                        /* get past "\x" */
     114        iBuf += 2;                        // get past "\x"
    113115        if (index(HEX, (CHAR) toupper(pszBuf[iBuf])) != -1) {
    114116          iBufSave = iBuf;
     
    120122        }
    121123        else
    122           wchar = 'x';                        /* just an x */
     124          wchar = 'x';                        // just an x
    123125        iBuf--;
    124126        *pszOut++ = wchar;
    125127        break;
    126128
    127       case '\\':                        /* we want a "\" */
     129      case '\\':                        // we want a "\"
    128130        iBuf++;
    129131        *pszOut++ = '\\';
    130132        break;
    131133
    132       case 't':                        /* tab CHAR */
     134      case 't':                        // tab CHAR
    133135        iBuf++;
    134136        *pszOut++ = '\t';
    135137        break;
    136138
    137       case 'n':                        /* new line */
     139      case 'n':                        // new line
    138140        iBuf++;
    139141        *pszOut++ = '\n';
    140142        break;
    141143
    142       case 'r':                        /* carr return */
     144      case 'r':                        // carr return
    143145        iBuf++;
    144146        *pszOut++ = '\r';
    145147        break;
    146148
    147       case 'b':                        /* back space */
     149      case 'b':                        // back space
    148150        iBuf++;
    149151        *pszOut++ = '\b';
    150152        break;
    151153
    152       case 'f':                        /* formfeed */
     154      case 'f':                        // formfeed
    153155        iBuf++;
    154156        *pszOut++ = '\x0c';
    155157        break;
    156158
    157       case 'a':                        /* bell */
     159      case 'a':                        // bell
    158160        iBuf++;
    159161        *pszOut++ = '\07';
    160162        break;
    161163
    162       case '\'':                        /* single quote */
     164      case '\'':                        // single quote
    163165        iBuf++;
    164166        *pszOut++ = '\'';
    165167        break;
    166168
    167       case '\"':                        /* double quote */
     169      case '\"':                        // double quote
    168170
    169171        iBuf++;
     
    171173        break;
    172174
    173       default:                                /* decimal */
    174         iBuf++;                                /* get past "\" */
     175      default:                                // decimal
     176        iBuf++;                                // get past "\"
    175177        wchar = 0;
    176178        if (index(DEC, pszBuf[iBuf]) != -1) {
    177179          iBufSave = iBuf;
    178           do {                                /* cvt to binary */
     180          do {                                // cvt to binary
    179181            wchar = (CHAR) (wchar * 10 + (pszBuf[iBuf++] - 48));
    180182          } while (index(DEC, pszBuf[iBuf]) != -1 && iBuf < iBufSave + 3);
     
    194196    iBuf++;
    195197  }                                        // while
    196   *pszOut = 0;                                /* Always terminate, even if not string */
    197 
    198   cBufBytes = pszOut - pszWork;                /* Calc string length excluding terminator */
    199   memcpy(pszBuf, pszWork, cBufBytes + 1);        /* Overwrite including terminator */
     198  *pszOut = 0;                                // Always terminate, even if not string
     199
     200  cBufBytes = pszOut - pszWork;                // Calc string length excluding terminator
     201  memcpy(pszBuf, pszWork, cBufBytes + 1);        // Overwrite including terminator
    200202  free(pszWork);
    201203
    202   return cBufBytes;                        /* Return string length */
     204  return cBufBytes;                        // Return string length
    203205}
    204206
  • trunk/dll/loadbmp.c

    r1544 r1673  
    9696  }
    9797
    98   /* Read bitmap info header
    99      Allocate enough to hold a complete 2.x bitmap array file header
    100      fixme to support > 256 colors?
     98  /**
     99   * Read bitmap info header
     100   * Allocate enough to hold a complete 2.x bitmap array file header
     101   * fixme to support > 256 colors?
    101102   */
    102103  pbmafh2 =
     
    104105  if (!pbmafh2)
    105106    goto ExitLoadBMP;
    106   /* Assign pointers to the file header and bitmap info header etc.
    107      Both the 1.x and 2.x structures are assigned to simplify code
    108      fixme to clean this up - aliased pointers are evil
     107  /**
     108   * Assign pointers to the file header and bitmap info header etc.
     109   * Both the 1.x and 2.x structures are assigned to simplify code
     110   * fixme to clean this up - aliased pointers are evil
    109111   */
    110112  pbmfh2 = &pbmafh2->bfh2;
     
    119121  case BFT_COLORPOINTER:
    120122    {
    121       /* Assume image is a 2.0 image and read as a 2.x header
    122          OK for 1.x file - read will not fail unless file is corrupted
     123      /**
     124       * Assume image is a 2.0 image and read as a 2.x header
     125       * OK for 1.x file - read will not fail unless file is corrupted
    123126       */
    124127      rc = fseek(pf, 0, SEEK_SET);
     
    135138
    136139      is2x = pbmih2->cbFix > sizeof(BITMAPINFOHEADER);  // 1.x or 2.x bitmap
    137       /* We will read the color table later
    138          Color table follows header but
    139          location depends on the type of the bitmap (old vs new)
    140          1.x header is fixed size
    141          2.x header is variable sized, so offset must be calculated
    142          cbFix contains actual size of BITMAPINFOHEADER2 in file
     140      /**
     141       * We will read the color table later
     142       * Color table follows header but
     143       * location depends on the type of the bitmap (old vs new)
     144       * 1.x header is fixed size
     145       * 2.x header is variable sized, so offset must be calculated
     146       *  cbFix contains actual size of BITMAPINFOHEADER2 in file
    143147       */
    144148      ulRGBOffset = is2x ? sizeof(*pbmfh2) - sizeof(*pbmih2) + pbmih2->cbFix :
     
    149153  case BFT_BITMAPARRAY:
    150154    {
    151       /* Now we are dealing with a bitmap array which is a collection of bitmaps
    152          Each bitmap has its own file header
     155      /**
     156       * Now we are dealing with a bitmap array which is a collection of bitmaps
     157       * Each bitmap has its own file header
    153158       */
    154159
     
    163168      HDC hdc;
    164169
    165       /* Scan the array and chose the bitmap best suited
    166          for the current display size and color capacities
     170      /**
     171       * Scan the array and chose the bitmap best suited
     172       * for the current display size and color capacities
    167173       */
    168174      hdc = GpiQueryDevice(hPS);
     
    233239
    234240      is2x = pbmih2->cbFix > sizeof(BITMAPINFOHEADER);
    235       /* As before, we calculate offset in file stream to color table
    236          This code must match single bitmap logic
     241      /**
     242       * As before, we calculate offset in file stream to color table
     243       * This code must match single bitmap logic
    237244       */
    238245      ulRGBOffset = ulOffsetPicked;
     
    257264  // Read color table
    258265  if (is2x) {
    259     /* For a 2.0 bitmap, read the color table as is
    260        The bitmap info structure is header + color table
    261        If we have 24 bits per pel, there is usually no color table, unless
    262        pbmih2->cclrUsed or pbmih2->cclrImportant are non zero
    263        fixme to test this
     266    /**
     267     * For a 2.0 bitmap, read the color table as is
     268     * The bitmap info structure is header + color table
     269     * If we have 24 bits per pel, there is usually no color table, unless
     270     * pbmih2->cclrUsed or pbmih2->cclrImportant are non zero
     271     *  fixme to test this
    264272     */
    265273    if (pbmih2->cBitCount < 24) {
     
    284292  }
    285293  else {
    286     /* This is a 1.x format bitmap
    287        Since the current standard format is the 2.0
    288        convert the header and color table to 2.x format
     294    /**
     295     * This is a 1.x format bitmap
     296     * Since the current standard format is the 2.0
     297     * convert the header and color table to 2.x format
    289298     */
    290299    ULONG ul;
     
    319328  }                                     // if 1.x
    320329
    321   /* The 2.0 bitmap info structure set up
    322      Position to start of the bitmap data
     330  /**
     331   * The 2.0 bitmap info structure set up
     332   * Position to start of the bitmap data
    323333   */
    324334  rc = fseek(pf, pbmfh2->offBits, SEEK_SET);
     
    328338  }
    329339
    330   /* Read the bitmap data
    331      The read size is derived using the magic formula
    332      Each bitmap scan line is aligned on a doubleword boundary
    333      The size of the scan line is the number of pels times the bpp
    334      After aligning it, we divide by 4 to get the number of bytes, and
    335      multiply by the number of scan lines and the number of pel planes
     340  /**
     341   * Read the bitmap data
     342   * The read size is derived using the magic formula
     343   * Each bitmap scan line is aligned on a doubleword boundary
     344   * The size of the scan line is the number of pels times the bpp
     345   * After aligning it, we divide by 4 to get the number of bytes, and
     346   * multiply by the number of scan lines and the number of pel planes
    336347   */
    337348  if (pbmi2->ulCompression)
  • trunk/dll/mainwnd.c

    r1672 r1673  
    262262  case UM_SETUP4:
    263263  case UM_SETUP5:
    264     /*
    265      * feed setup messages to main window
    266      */
     264    // feed setup messages to main window
    267265    PostMsg(hwndMain, msg, mp1, mp2);
    268266    return 0;
    269267
    270268  case UM_SETUP6:
    271     /*
    272      * handle bubble help requests from drive bar buttons
    273      */
     269    // handle bubble help requests from drive bar buttons
    274270    {
    275271      char dv[3], d;
     
    365361
    366362  case UM_NOTIFY:
    367     /*
    368      * bring up notify messages for various windows
    369      */
     363    // bring up notify messages for various windows
    370364    if (mp1)
    371365      return MRFROMLONG(DoNotify((char *)mp1));
     
    600594  noattrib &= (~(SWP_SHOW | SWP_ZORDER));
    601595  noattrib |= SWP_HIDE;
    602   /* count tools */
     596  // count tools
    603597  tool = toolhead;
    604598  for (numtools = 0L; tool; numtools++)
    605599    tool = tool->next;
    606   /* allocate swp array for WinSetMultWindowPos */
     600  // allocate swp array for WinSetMultWindowPos
    607601  swp = xmallocz(sizeof(SWP) * (numtools + 2), pszSrcFile, __LINE__);
    608602  if (swp) {
     
    995989    hwndActive = WinQueryActiveWindow(HWND_DESKTOP);
    996990    if (hwndActive) {
    997       /* don't bring up help if window isn't active */
     991      // don't bring up help if window isn't active
    998992      if (!WinIsChild(hwnd, hwndActive))
    999993        return;
     
    1001995    hwndActive = WinQueryFocus(HWND_DESKTOP);
    1002996    if (WinQueryClassName(hwndActive, sizeof(ucClassname), ucClassname)) {
    1003       /* don't bring up help if a menu is active */
     997      // don't bring up help if a menu is active
    1004998      if (!strcmp(ucClassname, "#4"))
    1005999        return;
     
    13431337      break;
    13441338
    1345     case IDM_HIDEANYTOOL:               /* hide any tool */
    1346     case IDM_HIDETOOL:                  /* hide tool */
     1339    case IDM_HIDEANYTOOL:               // hide any tool
     1340    case IDM_HIDETOOL:                  // hide tool
    13471341      if (SHORT1FROMMP(mp1) == IDM_HIDETOOL)
    13481342        id = WinQueryWindowUShort(hwnd, QWS_ID);
     
    13601354      break;
    13611355
    1362     case IDM_SHOWTOOLS:                 /* show all tools */
     1356    case IDM_SHOWTOOLS:                 // show all tools
    13631357      tool = toolhead;
    13641358      while (tool) {
     
    13691363      break;
    13701364
    1371     case IDM_DELETEANYTOOL:             /* delete any button */
    1372     case IDM_DELETETOOL:                /* delete button */
     1365    case IDM_DELETEANYTOOL:             // delete any button
     1366    case IDM_DELETETOOL:                // delete button
    13731367      if (SHORT1FROMMP(mp1) == IDM_DELETETOOL)
    13741368        id = WinQueryWindowUShort(hwnd, QWS_ID);
     
    13821376      return 0;
    13831377
    1384     case IDM_EDITANYTOOL:               /* edit any button */
    1385     case IDM_EDITTOOL:                  /* edit button */
     1378    case IDM_EDITANYTOOL:               // edit any button
     1379    case IDM_EDITTOOL:                  // edit button
    13861380      if (SHORT1FROMMP(mp1) == IDM_EDITTOOL)
    13871381        id = WinQueryWindowUShort(hwnd, QWS_ID);
     
    14041398      break;
    14051399
    1406     case IDM_ADDTOOL:                   /* add tool */
     1400    case IDM_ADDTOOL:                   // add tool
    14071401      id = (USHORT) WinDlgBox(HWND_DESKTOP, hwnd, AddToolProc, FM3ModHandle,
    14081402                              ADDBTN_FRAME, MPVOID);
     
    14151409      break;
    14161410
    1417     case IDM_REORDERTOOLS:              /* reorder tools */
     1411    case IDM_REORDERTOOLS:              // reorder tools
    14181412      WinDlgBox(HWND_DESKTOP,
    14191413                hwnd, ReOrderToolsProc, FM3ModHandle, RE_FRAME, MPVOID);
     
    14431437
    14441438  case WM_CONTEXTMENU:
    1445     //DosEnterCritSec(); //GKY 11-29-08
    14461439    DosRequestMutexSem(hmtxFM2Globals, SEM_INDEFINITE_WAIT);
    14471440    if (!hwndMenu)
    14481441      hwndMenu = WinLoadMenu(hwnd, FM3ModHandle, ID_BUTTONMENU);
    14491442    DosReleaseMutexSem(hmtxFM2Globals);
    1450     //DosExitCritSec();
    14511443    //fixme to allow user to change font 1-10-09 GKY
    14521444    SetPresParams(hwndMenu, NULL, NULL, NULL, FNT_10SYSTEMPROPORT);
     
    14571449  case DM_DRAGOVER:
    14581450    {
    1459       PDRAGINFO pDInfo;                 /* Pointer to DRAGINFO */
    1460 
    1461       pDInfo = (PDRAGINFO) mp1;         /* Get DRAGINFO pointer */
    1462       DrgAccessDraginfo(pDInfo);        /* Access DRAGINFO */
     1451      PDRAGINFO pDInfo;                 // Pointer to DRAGINFO
     1452
     1453      pDInfo = (PDRAGINFO) mp1;         // Get DRAGINFO pointer
     1454      DrgAccessDraginfo(pDInfo);        // Access DRAGINFO
    14631455      id = WinQueryWindowUShort(hwnd, QWS_ID);
    14641456      tool = find_tool(id);
    14651457      if (!tool) {
    14661458        DrgFreeDraginfo(pDInfo);
    1467         return (MRFROM2SHORT(DOR_NEVERDROP, 0));        /* Drop not valid */
     1459        return (MRFROM2SHORT(DOR_NEVERDROP, 0));        // Drop not valid
    14681460      }
    14691461      if (!(tool->flags & T_DROPABLE)) {
    14701462        DrgFreeDraginfo(pDInfo);
    1471         return (MRFROM2SHORT(DOR_NEVERDROP, 0));        /* Drop not valid */
     1463        return (MRFROM2SHORT(DOR_NEVERDROP, 0));        // Drop not valid
    14721464      }
    14731465      {
    1474         PDRAGITEM pDItem;               /* Pointer to DRAGITEM */
    1475 
    1476         pDItem = DrgQueryDragitemPtr(pDInfo,    /* Access DRAGITEM */
    1477                                      0);        /* Index to DRAGITEM */
    1478         if (DrgVerifyRMF(pDItem,        /* Check valid rendering */
    1479                          (CHAR *) DRM_OS2FILE,   /* mechanisms and data */
    1480                          NULL)) {       /* formats */
     1466        PDRAGITEM pDItem;               // Pointer to DRAGITEM
     1467
     1468        pDItem = DrgQueryDragitemPtr(pDInfo,    // Access DRAGITEM
     1469                                     0);        // Index to DRAGITEM
     1470        if (DrgVerifyRMF(pDItem,                // Check valid rendering
     1471                         (CHAR *) DRM_OS2FILE,  // mechanisms and data
     1472                         NULL)) {               // formats
    14811473          if (!(tool->flags & T_EMPHASIZED)) {
    14821474            tool->flags |= T_EMPHASIZED;
     
    14841476            DrgFreeDraginfo(pDInfo);
    14851477          }
    1486           return (MRFROM2SHORT(DOR_DROP,        /* Return okay to drop */
    1487                                DO_MOVE));       /* Move operation valid */
     1478          return (MRFROM2SHORT(DOR_DROP,        // Return okay to drop
     1479                               DO_MOVE));       // Move operation valid
    14881480        }
    14891481        DrgFreeDraginfo(pDInfo);
    14901482      }
    14911483    }
    1492     return (MRFROM2SHORT(DOR_NEVERDROP, 0));    /* Drop not valid */
     1484    return (MRFROM2SHORT(DOR_NEVERDROP, 0));    // Drop not valid
    14931485
    14941486  case DM_DROPHELP:
     
    22922284          WinEnableMenuItem(hwndMenu, IDM_CHKDSK, FALSE);
    22932285        }
    2294         /* fixme to be gone?
    2295           if (!rdy || ~driveflags[iDrv] & DRIVE_CDROM) {
    2296             WinEnableMenuItem(hwndMenu, IDM_CLOSETRAY, FALSE);
    2297           }
    2298         */
    22992286        PopupMenu(hwnd, hwnd, hwndMenu);
    23002287      }
     
    29822969    return 0;
    29832970
    2984   case UM_SETUP2:  /* Used to load a new a toolbar */
     2971  case UM_SETUP2:  // Used to load a new a toolbar
    29852972    BuildTools(hwnd, TRUE);
    29862973    return 0;
     
    31993186BOOL CloseDirCnrChildren(HWND hwndClient)
    32003187{
    3201   /* returns TRUE if a directory container window was told to close */
     3188  // returns TRUE if a directory container window was told to close
    32023189
    32033190  HENUM henum;
     
    36803667    if (ulCnt == (ULONG) - 1) {
    36813668      ulCnt = CountChildren(hwndClient, &ulNumMinChildren);
    3682       /* return these values to the caller for later use */
     3669      // return these values to the caller for later use
    36833670      *ulCntR = ulCnt;
    36843671      *ulNumMinChildrenR = ulNumMinChildren;
     
    38973884                           SHORT newcx, SHORT newcy)
    38983885{
    3899   /*
     3886  /**
    39003887   * resize all children of the client to maintain their proportional
    39013888   * sizes and positions
     
    42374224      mr = oldproc(hwnd, msg, mp1, mp2);
    42384225
    4239       /*
     4226      /**
    42404227       * Calculate the position of the client rectangle.
    42414228       * Otherwise, we'll see a lot of redraw when we move the
     
    43164303      soldCount = sCount;
    43174304
    4318       /*
     4305      /**
    43194306       * Reformat the frame to "squeeze" the client
    43204307       * and make room for status window sibling beneath
     
    56605647    hwndFrame = WinQueryWindow(hwnd, QW_PARENT);
    56615648
    5662     /*
    5663      * create frame children (not client children, frame children)
    5664      */
     5649    // create frame children (not client children, frame children)
    56655650    DosSleep(1);
    56665651    WinQueryWindowPos(hwndFrame, &swp);
     
    59325917
    59335918  case UM_SETUP:
    5934     /*
    5935      * start up some initial children
    5936      */
     5919    // start up some initial children
    59375920    WinShowWindow(WinQueryWindow(hwnd, QW_PARENT), TRUE);
    59385921    PostMsg(MainObjectHwnd, UM_SETUP2, mp1, mp2);
     
    59945977
    59955978  case UM_SETUP3:
    5996     /* start remaining child windows */
     5979    // start remaining child windows
    59975980    if (!fNoSaveState && fSaveState) {
    59985981      PCSZ pszStatename = PCSZ_SHUTDOWNSTATE;
     
    61906173
    61916174    case IDM_WINDOWSMENU:
    6192       /*
     6175      /**
    61936176       * add child windows of client
    61946177       * and switchlist entries to end of pulldown menu
     
    66416624
    66426625  case UM_SETDIR:
    6643     /* mp1 == name of directory to open */
     6626    // mp1 == name of directory to open
    66446627    if (mp1)
    66456628      return MRFROMLONG(OpenDirCnr((HWND) 0,
  • trunk/dll/mainwnd2.c

    r1670 r1673  
    181181        PFNWPFrame(hwnd, msg, mp1, mp2);
    182182
    183       /*
     183      /**
    184184       * Calculate the position of the client rectangle.
    185185       * Otherwise, we'll see a lot of redraw when we move the
     
    241241                        PFNWPFrame(hwnd, msg, mp1, mp2));
    242242      soldCount = sCount;
    243       /*
     243      /**
    244244       * Reformat the frame to "squeeze" the client
    245245       * and make room for status window sibling beneath
     
    819819      PFNWP oldproc;
    820820
    821       /*
    822        * create frame children (not client children, frame children)
    823        */
     821      // create frame children (not client children, frame children)
    824822      DosSleep(1);
    825823      WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swp);
     
    12821280        return 0;
    12831281    }
    1284     /* intentional fallthru */
     1282    // intentional fallthru
    12851283  case WM_SIZE:
    12861284    pd = WinQueryWindowPtr(hwnd, QWL_USER + 4);
  • trunk/dll/makelist.c

    r1570 r1673  
    4444VOID SortList(LISTINFO *li)
    4545{
    46   /* bubble-sort entries by size, descending */
     46  // bubble-sort entries by size, descending
    4747
    4848  UINT x;
  • trunk/dll/menu.c

    r1544 r1673  
    114114              info->type = SEPARATOR;
    115115            else {
    116               /* error! */
     116              // error!
    117117              xfree(info->text, pszSrcFile, __LINE__);
    118118              free(info);
  • trunk/dll/misc.c

    r1647 r1673  
    118118#include "info.h"                       // driveflags
    119119
    120 #define CONTAINER_COLUMNS       13      /* Number of columns in details view */
     120#define CONTAINER_COLUMNS       13      // Number of columns in details view
    121121#define MS_POPUP          0x00000010L
    122122
     
    302302void PaintSTextWindow(HWND hwnd, HPS hps)
    303303{
    304   /*
     304  /**
    305305   * paint a text window such that the rightmost part of the text is
    306306   * always visible even if the text length exceeds the length of the
     
    364364VOID PaintRecessedWindow(HWND hwnd, HPS hps, BOOL outtie, BOOL dbl)
    365365{
    366   /*
     366  /**
    367367   * paint a recessed box around the window
    368368   * two pixels width required around window for painting...
     
    947947              strchr(szData, '*') || IsRoot(pci->pszFileName))
    948948            return (MRESULT) FALSE;
    949           /* If the text changed, rename the file system object. */
     949          // If the text changed, rename the file system object.
    950950          chop_at_crnl(szData);
    951951          bstrip(szData);
     
    969969              if (stricmp(szData, testname) && IsFile(testname) != -1) {
    970970                if (!fAlertBeepOff)
    971                   DosBeep(50, 100);       /* exists; disallow */
    972                 return (MRESULT) FALSE;
     971                  DosBeep(50, 100);       
     972                return (MRESULT) FALSE;    // exists; disallow
    973973              }
    974974              if (fVerify && (driveflags[toupper(*szData) - 'A'] & DRIVE_WRITEVERIFYOFF ||
     
    12961296VOID FcloseFile(FILE * fp)
    12971297{
    1298   /* for use by apps that don't use the DLLs runtime library */
     1298  // for use by apps that don't use the DLLs runtime library
    12991299  fclose(fp);
    13001300}
     
    16841684                                       MPFROMLONG(CMA_FIRST),
    16851685                                       MPFROMSHORT(attrib));
    1686     if ((!pmi || (INT) pmi == -1) && attrib == CRA_SELECTED)    /* punt */
     1686    if ((!pmi || (INT) pmi == -1) && attrib == CRA_SELECTED)    // punt
    16871687      attrib = CRA_CURSORED;
    16881688    else
     
    18991899HWND CheckMenu(HWND hwnd, HWND * hwndMenu, USHORT id)
    19001900{
    1901   /* load and adjust menus as required */
     1901  // load and adjust menus as required
    19021902  if (!*hwndMenu || !WinIsWindow((HAB) 0, *hwndMenu)) {
    19031903    *hwndMenu = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, id);
     
    23012301void SetupWinList(HWND hwndMenu, HWND hwndTop, HWND hwndFrame)
    23022302{
    2303   /*
     2303  /**
    23042304   * add switchlist entries to end of pulldown menu
    23052305   */
     
    23112311                                  MM_QUERYITEMCOUNT, MPVOID, MPVOID);
    23122312
    2313   /* clean out old additions */
     2313  // clean out old additions
    23142314  while ((SHORT) WinSendMsg(hwndMenu,
    23152315                            MM_DELETEITEM,
     
    23312331    HWND hwndChild;
    23322332
    2333     /* add children of the main FM/2 client */
     2333    // add children of the main FM/2 client
    23342334    henum = WinBeginEnumWindows(hwndTop);
    23352335    memset(&mi, 0, sizeof(mi));
     
    23552355  }
    23562356
    2357   /* add external FM/2 windows */
     2357  // add external FM/2 windows
    23582358  {
    23592359    PSWBLOCK pswb;
     
    23632363
    23642364    hwndTopFrame = hwndTop ? WinQueryWindow(hwndTop, QW_PARENT) : (HWND)0;
    2365     /* Get the switch list information */
     2365    // Get the switch list information
    23662366    x = 0;
    23672367    ulcEntries = WinQuerySwitchList(0, NULL, 0);
    23682368    ulSize = sizeof(SWBLOCK) + sizeof(HSWITCH) + (ulcEntries + 4L) *
    23692369      (LONG) sizeof(SWENTRY);
    2370     /* Allocate memory for list */
     2370    // Allocate memory for list
    23712371    pswb = xmalloc(ulSize, pszSrcFile, __LINE__);
    23722372    if (pswb) {
    2373       /* Put the info in the list */
     2373      // Put the info in the list
    23742374      ulcEntries = WinQuerySwitchList(0, pswb, ulSize - sizeof(SWENTRY));
    2375       /* do the dirty deed */
     2375      // do the dirty deed
    23762376      memset(&mi, 0, sizeof(mi));
    23772377      for (i = 0; i < pswb->cswentry; i++) {
     
    24202420
    24212421  if (hwndMain && hwndMenu && cmd >= IDM_WINDOWSTART && cmd < IDM_SWITCHSTART) {
    2422     /*
    2423      * select a child window (of client)
    2424      */
     2422    // select a child window (of client)
    24252423
    24262424    MENUITEM mi;
  • trunk/dll/mkdir.c

    r1545 r1673  
    9191{
    9292
    93   /*
     93  /**
    9494   * bitmapped flags:
    9595   * 1 = don't ask to create if non-existent
  • trunk/dll/mle.c

    r1628 r1673  
    7171        ((c) - (char) 0xd):(c)
    7272
    73 /*((FAKEROT==0)?(c):(FAKEROT==1)?(!isalpha((c)))?(c):((((c) >= (char) 'A') && \
    74         ((c) <= (char) 'M')) || (((c) >= (char) 'a') && ((c) <= (char) 'm')))?((c) + (char) 0xd)\
    75         :((((c) >= (char) 'N') && ((c) <= (char) 'Z')) || (((c) >= (char) 'n') && ((c) <= (char) 'z')))?\
    76         ((c) - (char) 0xd):(c):((c) >= (char) '!') ? ((((c) + (char) 47) > (char) '~') ? ((c) - (char) 47) :\
    77         ((c) + (char) 47)) : (c))*/
    78 
    7973LONG MLEgetlinetext(HWND h, LONG l, CHAR * buf, INT maxlen)
    8074{
    81   /* get text of line l from MLE */
     75  // get text of line l from MLE
    8276
    8377  IPT s, e;
     
    9084LONG MLEdeleteline(HWND h, LONG l)
    9185{
    92   /* delete line l from MLE */
     86  // delete line l from MLE
    9387
    9488  IPT s, e;
     
    10195LONG MLEdeletecurline(HWND h)
    10296{
    103   /* delete current line from MLE */
     97  // delete current line from MLE
    10498
    10599  LONG l;
     
    111105LONG MLEdeletetoeol(HWND h)
    112106{
    113   /* delete from cursor pos to end of line */
     107  // delete from cursor pos to end of line
    114108
    115109  IPT s, e;
     
    122116VOID MLEclearall(HWND h)
    123117{
    124   /* remove all text from MLE */
     118  // remove all text from MLE
    125119  LONG len;
    126120
     
    132126LONG MLEtextatcursor(HWND h, CHAR * buffer, INT buflen)
    133127{
    134   /* place up to buflen chars of text from cursor pos into buffer
     128  /**
     129   * place up to buflen chars of text from cursor pos into buffer
    135130   * return # of chars imported
    136131   */
     
    144139LONG MLEtextatpos(HWND h, IPT i, CHAR * buffer, INT buflen)
    145140{
    146   /* place up to buflen chars of text from pos i in buffer
     141  /**
     142   * place up to buflen chars of text from pos i in buffer
    147143   * return # of chars imported
    148144   */
     
    156152LONG MLEsizeofsel(HWND h)
    157153{
    158   /* return length of selected text */
     154  // return length of selected text
    159155
    160156  IPT cursor, anchor, test;
     
    163159  anchor = MLEancpos(h);
    164160  test = min(cursor, anchor);
    165   /* MLE fakes us out; get real length in bytes */
     161  // MLE fakes us out; get real length in bytes
    166162  return (LONG) WinSendMsg(h, MLM_QUERYFORMATTEXTLENGTH,
    167163                           MPFROMLONG(test),
     
    247243BOOL MLEdoblock(HWND h, INT action, CHAR * filename)
    248244{
    249   /* perform action on text in selection */
     245  // perform action on text in selection
    250246
    251247  register CHAR *p;
     
    396392    break;
    397393
    398   default:                              /* unknown action */
     394  default:                              // unknown action
    399395#ifdef __DEBUG_ALLOC__
    400396    _heap_check();
     
    410406  }
    411407
    412   /* replace selection with altered text */
     408  // replace selection with altered text
    413409  p = sel;
    414410  here = min(curpos, ancpos);
    415   MLEclear(h);                          /* delete current selection */
    416   sellen = oldlen = strlen(sel);        /* actual number of bytes */
     411  MLEclear(h);                          // delete current selection
     412  sellen = oldlen = strlen(sel);        // actual number of bytes
    417413  while (oldlen > 0) {
    418414    sellen = min(oldlen, 32700);
     
    428424    p += sellen;
    429425    oldlen -= sellen;
    430     if (oldlen && *p == '\n' /* && *(p - 1) == '\r' */ )
     426    if (oldlen && *p == '\n')
    431427      p--;
    432428  }                                     // while
     
    498494BOOL MLEHexLoad(HWND h, CHAR * filename)
    499495{
    500   /* insert a file into the current position in the MLE */
     496  // insert a file into the current position in the MLE
    501497
    502498  HAB hab;
     
    550546            numimport = CreateHexDump(buffer,
    551547                                      numread, hexbuff, 50000, left, TRUE);
    552             while (len && numimport) {  /* import entire file */
     548            while (len && numimport) {  // import entire file
    553549              left += numread;
    554550              len -= numread;
     
    664660        if (numread < 1)
    665661          ret = FALSE;
    666         while (len && numread > 0) {    /* here we go... */
     662        while (len && numread > 0) {    // here we go...
    667663
    668664          CHAR s[81];
    669665
    670           while (numread > 0) {         /* import entire file */
     666          while (numread > 0) {         // import entire file
    671667            if (!WinIsWindow(hab, h) || (vw && vw->killme))
    672668              break;
     
    822818                      INT hex)
    823819{
    824   /* load a file into the MLE in the background (via a separate thread)
     820  /**
     821   * load a file into the MLE in the background (via a separate thread)
    825822   * return _beginthread status
    826823   */
     
    846843BOOL MLEloadfile(HWND h, CHAR * filename)
    847844{
    848   /* load a file into the MLE, getting rid of whatever was already
     845  /**
     846   * load a file into the MLE, getting rid of whatever was already
    849847   * there.  Note this returns without erasing existing text if the
    850848   * file to load does not exist
     
    867865                   BOOL striptraillines, BOOL striptrailspaces)
    868866{
    869   /* save the MLE contents as a file.  Format the output so that
     867  /**
     868   * save the MLE contents as a file.  Format the output so that
    870869   * the file is CR/LF terminated as presented in the MLE.
    871870   */
     
    879878  CHAR *mode;
    880879
    881   if (!MLEgetlen(h))                    /* nothing to save; forget it */
     880  if (!MLEgetlen(h))                    // nothing to save; forget it
    882881    return TRUE;
    883882
     
    897896    }
    898897    if (!MLEgetlen(h)) {
    899       /* nothing to save; forget it */
     898      // nothing to save; forget it
    900899      MLEsetwrap(h, fWrap);             // Restore
    901900      return TRUE;
     
    989988MRESULT EXPENTRY SandRDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
    990989{
    991   /* initiate search(/replace)s in edit mode */
     990  // initiate search(/replace)s in edit mode
    992991
    993992  SRCHPTR *vw;
  • trunk/dll/newview.c

    r1544 r1673  
    453453            while (*e != '\r' && *e != '\n' && e < ad->text + ad->textsize)
    454454              e++;
    455             /* fixme to be gone?
    456                if((*e == '\r' || *e == '\n') && e > p)
    457                e--;
    458             */
    459455            width = e - p;
    460456          }
     
    13271323                    whereiam = NULL;
    13281324                  }
    1329                   /* assign ad->lines[ad->numlines] */
     1325                  // assign ad->lines[ad->numlines]
    13301326                  if (ad->numlines + 1 > ad->numalloc) {
    13311327
     
    13431339                  ad->numlines++;
    13441340                  if (ad->numlines == numlines) {
    1345                     /* display first page */
     1341                    // display first page
    13461342                    register INT x;
    13471343
     
    15701566      mr = oldproc(hwnd, msg, mp1, mp2);
    15711567
    1572       /*
     1568      /**
    15731569       * Calculate the position of the client rectangle.
    15741570       * Otherwise,  we'll see a lot of redraw when we move the
     
    15981594      soldCount = sCount;
    15991595
    1600       /*
     1596      /**
    16011597       * Reformat the frame to "squeeze" the client
    16021598       * and make room for status window sibling beneath
  • trunk/dll/notebook.c

    r1664 r1673  
    35433543                   MPFROMLONG(CMA_FLWINDOWATTR));
    35443544      }
    3545       /* intentional fallthru */
     3545      // intentional fallthru
    35463546    case CFG9_1X:
    35473547      if (SHORT1FROMMP(mp1) == CFG9_1X) {
     
    40154015      break;
    40164016
    4017     case IDM_HELP:                      /* relay message to appropriate page's window */
     4017    case IDM_HELP:                      // relay message to appropriate page's window
    40184018      ulPageId = (ULONG) WinSendDlgItemMsg(hwnd,
    40194019                                         CFG_NOTEBOOK,
  • trunk/dll/objcnr.c

    r1438 r1673  
    161161    pciP->rc.hptrIcon = hptr;
    162162
    163   if (!pciP->rc.hptrIcon || pciP->rc.hptrIcon == hptrFile)      /* OS/2 bug bug bug bug */
     163  if (!pciP->rc.hptrIcon || pciP->rc.hptrIcon == hptrFile)      // OS/2 bug bug bug bug
    164164    pciP->rc.hptrIcon = hptrDir;
    165165
  • trunk/dll/objwin.c

    r1498 r1673  
    9292#       endif
    9393        WinSetWindowPtr(ObjectHwnd, QWL_USER, args);
    94         /* initially populate container */
     94        // initially populate container
    9595        // 18 Jul 08 SHL fixme to know if this really kills WM_CREATE
    9696        WinSendMsg(ObjectHwnd, UM_SETUP, MPVOID, MPVOID);
  • trunk/dll/presparm.c

    r1409 r1673  
    3737
    3838#ifdef NEVER
    39 /*
     39/**
    4040 * this routine will fill a buffer with all defined window pres params
    4141 * the PRESPARAMS structure returned is suitable to be passed as
     
    4949  if (!tagname || !*tagname || !prof)
    5050    return;
    51   /* setup memory access */
     51  // setup memory access
    5252  ppresparams = (PRESPARAMS *) xmalloc(PP_MAXBUF, pszSrcFile, __LINE__);
    5353  if (!ppresparams)
    5454    return;
    55   ppresparams->cb = 0;                  /* no entries yet */
    56   pparam = ppresparams->aparam;         /* cast structure onto memory */
    57 
    58   /*
    59    * query every possible presentation parameter...
    60    */
    61 
    62   /* foreground color -- takes 12 bytes */
     55  ppresparams->cb = 0;                  // no entries yet
     56  pparam = ppresparams->aparam;         // cast structure onto memory
     57
     58  // query every possible presentation parameter...
     59
     60  // foreground color -- takes 12 bytes
    6361  pparam->cb = WinQueryPresParam(hwnd,
    6462                                 PP_FOREGROUNDCOLOR,
     
    6765                                 sizeof(LONG),
    6866                                 (PVOID) pparam->ab, QPF_NOINHERIT);
    69   if (pparam->cb) {                     /* was the param found? */
    70     ppresparams->cb += 12;              /* used 12 bytes */
    71     pparam = (PPARAM) (((ULONG) pparam) + 12);  /* advance 12 bytes to next memory location */
    72   }
    73 
    74   /* background color -- takes 12 bytes */
     67  if (pparam->cb) {                             // was the param found?
     68    ppresparams->cb += 12;                      // used 12 bytes
     69    pparam = (PPARAM) (((ULONG) pparam) + 12);  // advance 12 bytes to next memory location
     70  }
     71
     72  // background color -- takes 12 bytes
    7573  pparam->cb = WinQueryPresParam(hwnd,
    7674                                 PP_BACKGROUNDCOLOR,
     
    8482  }
    8583
    86   /* hilited foreground color -- takes 12 bytes */
     84  // hilited foreground color -- takes 12 bytes
    8785  pparam->cb = WinQueryPresParam(hwnd,
    8886                                 PP_HILITEFOREGROUNDCOLOR,
     
    9694  }
    9795
    98   /* hilited background color -- takes 12 bytes */
     96  // hilited background color -- takes 12 bytes
    9997  pparam->cb = WinQueryPresParam(hwnd,
    10098                                 PP_HILITEBACKGROUNDCOLOR,
     
    108106  }
    109107
    110   /* disabled foreground color -- takes 12 bytes */
     108  // disabled foreground color -- takes 12 bytes
    111109  pparam->cb = WinQueryPresParam(hwnd,
    112110                                 PP_DISABLEDFOREGROUNDCOLOR,
     
    120118  }
    121119
    122   /* disabled background color -- takes 12 bytes */
     120  // disabled background color -- takes 12 bytes
    123121  pparam->cb = WinQueryPresParam(hwnd,
    124122                                 PP_DISABLEDBACKGROUNDCOLOR,
     
    132130  }
    133131
    134   /* border color -- takes 12 bytes */
     132  // border color -- takes 12 bytes
    135133  pparam->cb = WinQueryPresParam(hwnd,
    136134                                 PP_BORDERCOLOR,
     
    144142  }
    145143
    146   /* font name & size -- maximum 44 bytes (32 for face name, 4 for point size) + 8 for data */
     144  // font name & size -- maximum 44 bytes (32 for face name, 4 for point size) + 8 for data
    147145  pparam->cb = WinQueryPresParam(hwnd,
    148146                                 PP_FONTNAMESIZE,
     
    155153  }
    156154
    157   /* active color -- takes 12 bytes */
     155  // active color -- takes 12 bytes
    158156  pparam->cb = WinQueryPresParam(hwnd,
    159157                                 PP_ACTIVECOLOR,
     
    167165  }
    168166
    169   /* inactive color -- takes 12 bytes */
     167  // inactive color -- takes 12 bytes
    170168  pparam->cb = WinQueryPresParam(hwnd,
    171169                                 PP_INACTIVECOLOR,
     
    179177  }
    180178
    181   /* active text foreground color -- takes 12 bytes */
     179  // active text foreground color -- takes 12 bytes
    182180  pparam->cb = WinQueryPresParam(hwnd,
    183181                                 PP_ACTIVETEXTFGNDCOLOR,
     
    192190  }
    193191
    194   /* active text background color -- takes 12 bytes */
     192  // active text background color -- takes 12 bytes
    195193  pparam->cb = WinQueryPresParam(hwnd,
    196194                                 PP_ACTIVETEXTBGNDCOLOR,
     
    205203  }
    206204
    207   /* inactive text foreground color -- takes 12 bytes */
     205  // inactive text foreground color -- takes 12 bytes
    208206  pparam->cb = WinQueryPresParam(hwnd,
    209207                                 PP_INACTIVETEXTFGNDCOLOR,
     
    218216  }
    219217
    220   /* inactive text background color -- takes 12 bytes */
     218  // inactive text background color -- takes 12 bytes
    221219  pparam->cb = WinQueryPresParam(hwnd,
    222220                                 PP_INACTIVETEXTBGNDCOLOR,
     
    231229  }
    232230
    233   /* shadow color -- takes 12 bytes */
     231  // shadow color -- takes 12 bytes
    234232  pparam->cb = WinQueryPresParam(hwnd,
    235233                                 PP_SHADOW, 0,
     
    242240  }
    243241
    244   /* menu foreground color -- takes 12 bytes */
     242  // menu foreground color -- takes 12 bytes
    245243  pparam->cb = WinQueryPresParam(hwnd,
    246244                                 PP_MENUFOREGROUNDCOLOR,
     
    254252  }
    255253
    256   /* menu background color -- takes 12 bytes */
     254  // menu background color -- takes 12 bytes
    257255  pparam->cb = WinQueryPresParam(hwnd,
    258256                                 PP_MENUBACKGROUNDCOLOR,
     
    266264  }
    267265
    268   /* menu hilite foreground color -- takes 12 bytes */
     266  // menu hilite foreground color -- takes 12 bytes
    269267  pparam->cb = WinQueryPresParam(hwnd,
    270268                                 PP_MENUHILITEFGNDCOLOR,
     
    278276  }
    279277
    280   /* menu hilite background color -- takes 12 bytes */
     278  // menu hilite background color -- takes 12 bytes
    281279  pparam->cb = WinQueryPresParam(hwnd,
    282280                                 PP_MENUHILITEBGNDCOLOR,
     
    290288  }
    291289
    292   /* menu disabled foreground color -- takes 12 bytes */
     290  // menu disabled foreground color -- takes 12 bytes
    293291  pparam->cb = WinQueryPresParam(hwnd,
    294292                                 PP_MENUDISABLEDFGNDCOLOR,
     
    302300  }
    303301
    304   /* menu disabled background color -- takes 12 bytes */
     302  // menu disabled background color -- takes 12 bytes
    305303  pparam->cb = WinQueryPresParam(hwnd,
    306304                                 PP_MENUDISABLEDBGNDCOLOR,
     
    325323VOID CopyPresParams(HWND target, HWND source)
    326324{
    327   /*
     325  /**
    328326   * Copy presentation parameters of interest to us from one window
    329327   * to another
  • trunk/dll/printer.c

    r1544 r1673  
    8383  CHAR *modea = "a+";
    8484
    85   if (!fWorkPlace)                      /* assume spooler is active */
     85  if (!fWorkPlace)                      // assume spooler is active
    8686    return TRUE;
    8787  DosError(FERR_DISABLEHARDERR);
     
    104104    }
    105105    fclose(printhandle);
    106     if (data & 32)                      /* bit 5 is out of paper */
     106    if (data & 32)                      // bit 5 is out of paper
    107107      return FALSE;
    108108    return TRUE;
  • trunk/dll/remap.c

    r1544 r1673  
    8181VOID load_resources(VOID)
    8282{
    83   /* load linked list of resources from RESOURCE.DAT file */
     83  // load linked list of resources from RESOURCE.DAT file
    8484
    8585  FILE *fp;
     
    120120VOID save_resources(VOID)
    121121{
    122   /* save linked list of resources to RESOURCE.DAT file */
     122  // save linked list of resources to RESOURCE.DAT file
    123123
    124124  LINKRES *info;
     
    364364      while (info) {
    365365        if (info->happ == (HAPP) mp1) {
    366 /* Note:  if this next line is removed, FM/2 will start the attach/detach
    367  * request again, once for each request, to see if it might succeed and to
    368  * ensure the request is seen by the user in case interaction is required.
    369  */
     366          /**
     367           * Note:  if this next line is removed, FM/2 will start the attach/detach
     368           * request again, once for each request, to see if it might succeed and to
     369           * ensure the request is seen by the user in case interaction is required.
     370           */
    370371          info->failedonce = TRUE;
    371372          hwndList = WinWindowFromID(hwnd,
  • trunk/dll/saveclip.c

    r1628 r1673  
    853853                                 FILE_HIDDEN | FILE_SYSTEM,
    854854                                 &ffb4, sizeof(ffb4), &nm, FIL_QUERYEASIZEL)) {
    855                 /* load the object's Subject, if required */
     855                // load the object's Subject, if required
    856856                if (ffb4.cbList > 4) {
    857857                  APIRET rc;
     
    894894                  }
    895895                }
    896                 /* load the object's longname */
     896                // load the object's longname
    897897                if (ffb4.cbList > 4) {
    898898                  APIRET rc;
  • trunk/dll/seeall.c

    r1664 r1673  
    524524            break;
    525525          }
    526           if (!WinDlgBox(HWND_DESKTOP, hwndFrame, ArchiveDlgProc, FM3ModHandle, ARCH_FRAME, (PVOID) & ad) || !*ad.arcname || !*ad.command) {    /* we blew it */
     526          if (!WinDlgBox(HWND_DESKTOP, hwndFrame, ArchiveDlgProc, FM3ModHandle, ARCH_FRAME, (PVOID) & ad) ||
     527              !*ad.arcname || !*ad.command) {    // we blew it
    527528            FreeList(list);
    528529            break;
     
    622623          goto RetryPath;
    623624        }
    624         /* intentional fallthru */
     625        // intentional fallthru
    625626      case IDM_RENAME:
    626627        {
     
    756757            }
    757758            if (plen) {
    758               /* make directory/ies, if required */
     759              // make directory/ies, if required
    759760
    760761              CHAR dirpart[CCHMAXPATH];
     
    14391440static BOOL Mark(HWND hwnd, INT command, CHAR ** list)
    14401441{
    1441   /* Marks only unfiltered files */
     1442  // Marks only unfiltered files
    14421443
    14431444  ALLDATA *pAD = WinQueryWindowPtr(hwnd, QWL_USER);
     
    15001501static BOOL UpdateList(HWND hwnd, CHAR **list)
    15011502{
    1502   /* Updates files in the list */
     1503  // Updates files in the list
    15031504
    15041505  ALLDATA *ad = WinQueryWindowPtr(hwnd, QWL_USER);
     
    24942495      mr = oldproc(hwnd, msg, mp1, mp2);
    24952496
    2496       /*
     2497      /**
    24972498       * Calculate the position of the client rectangle.
    24982499       * Otherwise,  we'll see a lot of redraw when we move the
     
    25152516      sCount = (SHORT) oldproc(hwnd, msg, mp1, mp2);
    25162517
    2517       /*
     2518      /**
    25182519       * Reformat the frame to "squeeze" the client
    25192520       * and make room for status window sibling beneath
     
    35343535          for (x = pAD->topfile - 1; x < pAD->afindexcnt; x++) {
    35353536            ptl.x = pAD->horzscroll;
    3536             if (wascursored) {          /* reestablish normal colors */
     3537            if (wascursored) {          // reestablish normal colors
    35373538              GpiSetColor(pAD->hps,
    35383539                          standardcolors[Colors[COLORS_NORMALFORE]]);
  • trunk/dll/select.c

    r1604 r1673  
    743743            cmp = TestCDates(&bsres->pci->date, &bsres->pci->time,
    744744                             &Cnrs[z].ss[x].pci->date, &Cnrs[z].ss[x].pci->time);
    745               /*(Cnrs[z].ss[x].pci->date.year >
    746                bsres->pci->date.year) ? TRUE : (Cnrs[z].ss[x].pci->date.year <
    747                                                 bsres->pci->date.
    748                                                 year) ? FALSE : (Cnrs[z].
    749                                                                  ss[x].pci->
    750                                                                  date.month >
    751                                                                  bsres->pci->
    752                                                                  date.
    753                                                                  month) ? TRUE
    754               : (Cnrs[z].ss[x].pci->date.month <
    755                  bsres->pci->date.month) ? FALSE : (Cnrs[z].ss[x].pci->date.
    756                                                     day >
    757                                                     bsres->pci->date.
    758                                                     day) ? TRUE : (Cnrs[z].
    759                                                                    ss[x].pci->
    760                                                                    date.day <
    761                                                                    bsres->
    762                                                                    pci->date.
    763                                                                    day) ?
    764               FALSE : (Cnrs[z].ss[x].pci->time.hours >
    765                        bsres->pci->time.hours) ? TRUE : (Cnrs[z].ss[x].pci->
    766                                                          time.hours <
    767                                                          bsres->pci->time.
    768                                                          hours) ? FALSE
    769               : (Cnrs[z].ss[x].pci->time.minutes >
    770                  bsres->pci->time.minutes) ? TRUE : (Cnrs[z].ss[x].pci->time.
    771                                                      minutes <
    772                                                      bsres->pci->time.
    773                                                      minutes) ? FALSE
    774               : (Cnrs[z].ss[x].pci->time.seconds >
    775                  bsres->pci->time.seconds) ? TRUE : (Cnrs[z].ss[x].pci->time.
    776                                                      seconds <
    777                                                      bsres->pci->time.
    778                                                      seconds) ? FALSE : FALSE;*/
    779745            if (cmp != 1)
    780746              Cnrs[z].ss[x].newest = FALSE;
    781             /*cmp =
    782               (Cnrs[z].ss[x].pci->date.year <
    783                bsres->pci->date.year) ? TRUE : (Cnrs[z].ss[x].pci->date.year >
    784                                                 bsres->pci->date.
    785                                                 year) ? FALSE : (Cnrs[z].
    786                                                                  ss[x].pci->
    787                                                                  date.month <
    788                                                                  bsres->pci->
    789                                                                  date.
    790                                                                  month) ? TRUE
    791               : (Cnrs[z].ss[x].pci->date.month >
    792                  bsres->pci->date.month) ? FALSE : (Cnrs[z].ss[x].pci->date.
    793                                                     day <
    794                                                     bsres->pci->date.
    795                                                     day) ? TRUE : (Cnrs[z].
    796                                                                    ss[x].pci->
    797                                                                    date.day >
    798                                                                    bsres->
    799                                                                    pci->date.
    800                                                                    day) ?
    801               FALSE : (Cnrs[z].ss[x].pci->time.hours <
    802                        bsres->pci->time.hours) ? TRUE : (Cnrs[z].ss[x].pci->
    803                                                          time.hours >
    804                                                          bsres->pci->time.
    805                                                          hours) ? FALSE
    806               : (Cnrs[z].ss[x].pci->time.minutes <
    807                  bsres->pci->time.minutes) ? TRUE : (Cnrs[z].ss[x].pci->time.
    808                                                      minutes >
    809                                                      bsres->pci->time.
    810                                                      minutes) ? FALSE
    811               : (Cnrs[z].ss[x].pci->time.seconds <
    812                  bsres->pci->time.seconds) ? TRUE : (Cnrs[z].ss[x].pci->time.
    813                                                      seconds >
    814                                                      bsres->pci->time.
    815                                                      seconds) ? FALSE : FALSE;*/
    816747            if (cmp != -1)
    817748              Cnrs[z].ss[x].oldest = FALSE;
  • trunk/dll/shadow.c

    r1498 r1673  
    153153            "SHADOWID=%s%s%s",
    154154            (path) ? path : NullStr, (path) ? PCSZ_BACKSLASH : NullStr, objtitle);
    155     {                                   /* find an icon for it if possible */
     155    {                                   // find an icon for it if possible
    156156      CHAR *p, temp[CCHMAXPATH + 1];
    157157
     
    262262        if ((fsa.attrFile & FILE_DIRECTORY) || Shadows)
    263263          CreateShadowObject(p, (obj) ? szBuffer : NULL, szDir, 0, cnr);
    264         else if (!(apt & (FAPPTYP_NOTWINDOWCOMPAT | FAPPTYP_WINDOWCOMPAT | FAPPTYP_WINDOWAPI | FAPPTYP_BOUND | FAPPTYP_DOS | FAPPTYP_WINDOWSREAL | FAPPTYP_WINDOWSPROT | 0x1000)))      /* not an executable app? */
     264        else if (!(apt & (FAPPTYP_NOTWINDOWCOMPAT | FAPPTYP_WINDOWCOMPAT | FAPPTYP_WINDOWAPI |
     265                          FAPPTYP_BOUND | FAPPTYP_DOS | FAPPTYP_WINDOWSREAL |
     266                          FAPPTYP_WINDOWSPROT | 0x1000)))       // not an executable app?
    265267          CreateDataObject(p, (obj) ? szBuffer : NULL, szDir, cnr);
    266268        else
     
    282284       filename[strlen(filename) - 1] == '>') || IsFile(filename) != -1) {
    283285    hWPSObject = WinQueryObject(filename);
    284     if (hWPSObject != NULLHANDLE) {     /* got something; try to to open it */
     286    if (hWPSObject != NULLHANDLE) {     // got something; try to to open it
    285287
    286288      CHAR s[CCHMAXPATH];
  • trunk/dll/sortcnr.c

    r1501 r1673  
    149149      ret =  TestCDates(&pCI1->date, &pCI1->time,
    150150                        &pCI2->date, &pCI2->time);
    151         /*(pCI1->date.year < pCI2->date.year) ? 1 :
    152         (pCI1->date.year > pCI2->date.year) ? -1 :
    153         (pCI1->date.month < pCI2->date.month) ? 1 :
    154         (pCI1->date.month > pCI2->date.month) ? -1 :
    155         (pCI1->date.day < pCI2->date.day) ? 1 :
    156         (pCI1->date.day > pCI2->date.day) ? -1 :
    157         (pCI1->time.hours < pCI2->time.hours) ? 1 :
    158         (pCI1->time.hours > pCI2->time.hours) ? -1 :
    159         (pCI1->time.minutes < pCI2->time.minutes) ? 1 :
    160         (pCI1->time.minutes > pCI2->time.minutes) ? -1 :
    161         (pCI1->time.seconds < pCI2->time.seconds) ? 1 :
    162         (pCI1->time.seconds > pCI2->time.seconds) ? -1 : 0;*/
    163151      break;
    164152
     
    166154      ret = TestCDates(&pCI1->ladate, &pCI1->latime,
    167155                       &pCI2->ladate, &pCI2->latime);
    168         /*(pCI1->ladate.year < pCI2->ladate.year) ? 1 :
    169         (pCI1->ladate.year > pCI2->ladate.year) ? -1 :
    170         (pCI1->ladate.month < pCI2->ladate.month) ? 1 :
    171         (pCI1->ladate.month > pCI2->ladate.month) ? -1 :
    172         (pCI1->ladate.day < pCI2->ladate.day) ? 1 :
    173         (pCI1->ladate.day > pCI2->ladate.day) ? -1 :
    174         (pCI1->latime.hours < pCI2->latime.hours) ? 1 :
    175         (pCI1->latime.hours > pCI2->latime.hours) ? -1 :
    176         (pCI1->latime.minutes < pCI2->latime.minutes) ? 1 :
    177         (pCI1->latime.minutes > pCI2->latime.minutes) ? -1 :
    178         (pCI1->latime.seconds < pCI2->latime.seconds) ? 1 :
    179         (pCI1->latime.seconds > pCI2->latime.seconds) ? -1 : 0;*/
    180156      break;
    181157
     
    183159      ret = TestCDates(&pCI1->crdate, &pCI1->crtime,
    184160                       &pCI2->crdate, &pCI2->crtime);
    185         /*(pCI1->crdate.year < pCI2->crdate.year) ? 1 :
    186         (pCI1->crdate.year > pCI2->crdate.year) ? -1 :
    187         (pCI1->crdate.month < pCI2->crdate.month) ? 1 :
    188         (pCI1->crdate.month > pCI2->crdate.month) ? -1 :
    189         (pCI1->crdate.day < pCI2->crdate.day) ? 1 :
    190         (pCI1->crdate.day > pCI2->crdate.day) ? -1 :
    191         (pCI1->crtime.hours < pCI2->crtime.hours) ? 1 :
    192         (pCI1->crtime.hours > pCI2->crtime.hours) ? -1 :
    193         (pCI1->crtime.minutes < pCI2->crtime.minutes) ? 1 :
    194         (pCI1->crtime.minutes > pCI2->crtime.minutes) ? -1 :
    195         (pCI1->crtime.seconds < pCI2->crtime.seconds) ? 1 :
    196         (pCI1->crtime.seconds > pCI2->crtime.seconds) ? -1 : 0;*/
    197161      break;
    198162    }
  • trunk/dll/srchpath.c

    r1498 r1673  
    8989    *p = 0;
    9090    p++;
    91     if (*ret == '.') {                  /* skip initial "cur dir" */
     91    if (*ret == '.') {                  // skip initial "cur dir"
    9292      pp = strchr(p, ';');
    9393      if (pp)
  • trunk/dll/stristr.c

    r1348 r1673  
    2020#include "stristr.h"
    2121
    22 // static CHAR *strnistr(register CHAR * t, CHAR * s, LONG len);
    23 
    2422CHAR *stristr(const register CHAR * t, const CHAR * s)
    25 // CHAR *stristr(register CHAR * t, CHAR * s)
    2623{
    27   /* case-insensitive strstr() */
     24  // case-insensitive strstr()
    2825
    2926  const register CHAR *t1, *s1;
     
    5047CHAR *strnistr(register CHAR * t, CHAR * s, LONG len)
    5148{
    52   /* case-insensitive strnstr() */
     49  // case-insensitive strnstr()
    5350
    5451  register CHAR *s1;
     
    7673CHAR *strnstr(register CHAR * t, CHAR * s, LONG len)
    7774{
    78   /* strnstr() */
    79 
    8075  register CHAR *s1;
    8176  register LONG len2;
  • trunk/dll/sysinfo.c

    r1554 r1673  
    140140    WinDefDlgProc(hwnd, WM_SETICON, MPFROMLONG(hptrIcon), MPVOID);
    141141    {
    142       static CHAR *names[] = { "Max. Path Length",      /* 1  */
    143         "Max. Text Sessions",   /* 2  */
    144         "Max. PM Sessions",     /* 3  */
    145         "Max. VDM Sessions",    /* 4  */
    146         "Boot Drive",           /* 5  */
    147         "Dynamic Priority",     /* 6  */
    148         "Max. Wait",            /* 7  */
    149         "Min. Timeslice",       /* 8  */
    150         "Max. Timeslice",       /* 9  */
    151         "Page Size",            /* 10 */
    152         "Version Major",        /* 11 */
    153         "Version Minor",        /* 12 */
    154         "Version Revision",     /* 13 */
    155         "Millisecs Up",         /* 14 */
    156         "Unixtime Low",         /* 15 */
    157         "Unixtime High",        /* 16 */
    158         "Physical Memory",      /* 17 */
    159         "Resident Memory",      /* 18 */
    160         "Total Available Memory",       /* 19 */
    161         "Max. Private Memory",  /* 20 */
    162         "Max. Shared Memory",   /* 21 */
    163         "Timer Interval",       /* 22 */
    164         "Max. Path Comp. Length",       /* 23 */
    165         "Foreground FS Session ID",     /* 24 */
    166         "Foreground Process PID",       /* 25 */
     142      static CHAR *names[] = { "Max. Path Length",      // 1
     143        "Max. Text Sessions",     // 2
     144        "Max. PM Sessions",       // 3
     145        "Max. VDM Sessions",      // 4
     146        "Boot Drive",             // 5
     147        "Dynamic Priority",       // 6
     148        "Max. Wait",              // 7
     149        "Min. Timeslice",         // 8
     150        "Max. Timeslice",         // 9
     151        "Page Size",              // 10
     152        "Version Major",          // 11
     153        "Version Minor",          // 12
     154        "Version Revision",       // 13
     155        "Millisecs Up",           // 14
     156        "Unixtime Low",           // 15
     157        "Unixtime High",          // 16
     158        "Physical Memory",        // 17
     159        "Resident Memory",        // 18
     160        "Total Available Memory", // 19
     161        "Max. Private Memory",    // 20
     162        "Max. Shared Memory",     // 21
     163        "Timer Interval",         // 22
     164        "Max. Path Comp. Length", // 23
     165        "Foreground FS Session ID"// 24
     166        "Foreground Process PID", // 25
    167167        NULL
    168168      };
  • trunk/dll/systemf.c

    r1628 r1673  
    159159               PSZ *list, PCSZ prompt, PCSZ pszCallingFile, UINT uiLineNumber)
    160160{
    161   /* executes the command once for all files in list */
     161  // executes the command once for all files in list
    162162
    163163  CHAR path[CCHMAXPATH], *commandline, modpath[CCHMAXPATH], listfile[CCHMAXPATH],
     
    252252    if (*p == '%') {
    253253      switch (*(p + 1)) {
    254       case '!':                 /* write list to file, add filename */
     254      case '!':                 // write list to file, add filename
    255255        if (list) {
    256256          if (!*listfile) {
     
    279279        break;
    280280
    281       case 'c':                 /* add name of command processor */
     281      case 'c':                 // add name of command processor
    282282        {
    283283          char *env = GetCmdSpec(FALSE);
     
    300300        break;
    301301
    302       case 't':                 /* add Target directory */
     302      case 't':                 // add Target directory
    303303        if (needs_quoting(targetdir) && !strchr(targetdir, '\"')) {
    304304          *pp = '\"';
     
    317317        break;
    318318
    319       case '$':                 /* add drive letter */
     319      case '$':                 // add drive letter
    320320        if (drive)
    321321          *pp = drive;
     
    330330        break;
    331331
    332       case 'U':                 /* add path of first list component */
     332      case 'U':                 // add path of first list component
    333333      case 'u':
    334334        if (*modpath) {
     
    382382        break;
    383383
    384       case 'P':                 /* add path of execution */
     384      case 'P':                 // add path of execution
    385385      case 'p':
    386386        if (*path) {
     
    672672      strcpy(ex.environment, environment);
    673673    if (flags & PROMPT) {
    674       /* allow editing command line */
     674      // allow editing command line
    675675      ex.flags = (flags & (~PROMPT));
    676676      ex.commandline = commandline;
     
    687687    else
    688688      ex.flags = flags;
    689     //ex.flags &= (~PROMPT);  redundant GKY 1-9-10
    690689    //DbgMsg(pszSrcFile, __LINE__, "Inserted %s", environment);
    691690    ret = runemf2(ex.flags, hwnd, pszCallingFile, uiLineNumber, path,
     
    706705{
    707706  /** example:
    708 
     707   *
    709708   * status = runemf2(SEPARATE | WINDOWED,
    710709   *                  hwnd, pszCallingFile, __LINE__,
     
    718717   * pszCallingFile and __LINE__ are used to determine caller for easier error tracking
    719718   */
    720 
    721   /**
     719   /**
    722720   * type bitmapped flag -- see systemf.h
    723721   */
     
    804802  if (*pszPgm) {
    805803    if (*pszPgm == '<' && strchr(pszPgm, '>')) {
    806       /* is a workplace object */
     804      // is a workplace object
    807805      HOBJECT hWPSObject;
    808806      char temp;
     
    820818        pszArgs = NULL;
    821819      *p = 0;
    822       /* Find the handle of the WPS object */
     820      // Find the handle of the WPS object
    823821      hWPSObject = WinQueryObject(pszPgm);
    824822      *p = temp;
     
    873871      else
    874872        p = pszPgm;
    875       p[strlen(p) + 1] = 0;             /* double-terminate args */
     873      p[strlen(p) + 1] = 0;             // double-terminate args
    876874      if (*pszPgm) {
    877875        if (!strchr(pszPgm, '\\') &&
     
    11151113            type |= FULLSCREEN;
    11161114          }
    1117           else                          /* ? */
     1115          else                          // ?
    11181116            ulAppType = SSF_TYPE_WINDOWABLEVIO;
    11191117        }
  • trunk/dll/tools.c

    r1544 r1673  
    764764          istext = FALSE;
    765765        tool = INSTDATA(hwnd);
    766         if (tool) {                     /* just editing strings... */
     766        if (tool) {                     // just editing strings...
    767767          istext = ((tool->flags & T_TEXT) != 0);
    768768          xfree(tool->help, pszSrcFile, __LINE__);
  • trunk/dll/treecnr.c

    r1663 r1673  
    265265                 BOOL maketop)
    266266{
    267   /* Find a record in tree view, move it so it shows in container and
    268      make it the current record */
     267    /**
     268     * Find a record in tree view, move it so it shows in container and
     269     * make it the current record
     270     */
    269271
    270272  PCNRITEM pci, pciToSelect, pciP;
     
    341343        } // while
    342344      }
    343       /* expand all parent branches */
     345      // expand all parent branches
    344346      pciToSelect = pci;
    345347      for (;;) {
     
    358360      } // for
    359361    }
    360     /* make record visible */
     362    // make record visible
    361363  MakeTop:
    362364    pciToSelect = pci;
     
    471473      mr = CommonFrameWndProc(TREE_CNR, hwnd, msg, mp1, mp2);
    472474
    473       /*
     475      /**
    474476       * Calculate the position of the client rectangle.
    475477       * Otherwise,  we'll see a lot of redraw when we move the
     
    492494      sCount = (SHORT) CommonFrameWndProc(TREE_CNR, hwnd, msg, mp1, mp2);
    493495
    494       /*
    495        * Reformat the frame to "squeeze" the client
    496        */
     496      // Reformat the frame to "squeeze" the client
    497497
    498498      pswp = (PSWP) mp1;
     
    843843          }
    844844          else {
    845             /* find root record and strip it */
     845            // find root record and strip it
    846846            pci = FindParentRecord(dcd->hwndCnr, pci);
    847847            driveserial[toupper(*pci->pszFileName) - 'A'] = -1;
     
    857857
    858858  case UM_RESCAN:
    859     /*
    860      * populate container
    861      */
     859    // populate container
    862860    DosWaitEventSem(hevTreeCnrScanComplete, SEM_INDEFINITE_WAIT);
    863861    DosResetEventSem(hevTreeCnrScanComplete, &ulScanPostCnt);
     
    11881186
    11891187    if (dcd && dcd->hwndFrame == WinQueryActiveWindow(dcd->hwndParent)) {
    1190       /*
    1191        * put name of our window on status line
    1192        */
     1188      // put name of our window on status line
    11931189
    11941190      PCNRITEM pci = NULL;
     
    12621258    else {
    12631259      if (!dcd->hwndObject) {
    1264         /*
    1265          * first time through -- set things up
    1266          */
     1260        // first time through -- set things up
    12671261        CNRINFO cnri;
    12681262
     
    14611455            Win_Error(hwnd, hwnd, pszSrcFile, __LINE__,
    14621456                      PCSZ_DRGACCESSDRAGINFO);
    1463             return (MRFROM2SHORT(DOR_NODROP, 0));       /* Drop not valid */
     1457            return (MRFROM2SHORT(DOR_NODROP, 0));       // Drop not valid
    14641458          }
    14651459          pci = (PCNRITEM) ((PCNRDRAGINFO) mp2)->pRecord;
     
    15031497            }
    15041498          }
    1505           pDItem = DrgQueryDragitemPtr(pDInfo,  /* Access DRAGITEM */
    1506                                        0);      /* Index to DRAGITEM */
    1507           if (DrgVerifyRMF(pDItem,      /* Check valid rendering */
    1508                            (CHAR *) DRM_OS2FILE,        /* mechanisms and data */
    1509                            NULL) || DrgVerifyRMF(pDItem, (CHAR *) DRM_FM2ARCMEMBER,
    1510                                                  (CHAR *) DRF_FM2ARCHIVE)) {    /* formats */
    1511             DrgFreeDraginfo(pDInfo);    /* Free DRAGINFO */
     1499          pDItem = DrgQueryDragitemPtr(pDInfo,          // Access DRAGITEM
     1500                                       0);              // Index to DRAGITEM
     1501          if (DrgVerifyRMF(pDItem,                      // Check valid rendering
     1502                           (CHAR *) DRM_OS2FILE,        // mechanisms and data
     1503                           NULL) || DrgVerifyRMF(pDItem,
     1504                                                 (CHAR *) DRM_FM2ARCMEMBER,
     1505                                                 (CHAR *) DRF_FM2ARCHIVE)) {    // formats
     1506            DrgFreeDraginfo(pDInfo);                    // Free DRAGINFO
    15121507            if (!pci || (INT) pci == -1)
    15131508              return MRFROM2SHORT(DOR_DROP, DO_MOVE);
     
    15171512            if (toupper(*pci->pszFileName) < 'C')
    15181513              return MRFROM2SHORT(DOR_DROP, DO_COPY);
    1519             return MRFROM2SHORT(DOR_DROP,       /* Return okay to drop */
     1514            return MRFROM2SHORT(DOR_DROP,               // Return okay to drop
    15201515                                ((fCopyDefault) ? DO_COPY : DO_MOVE));
    15211516          }
    1522           DrgFreeDraginfo(pDInfo);      /* Free DRAGINFO */
    1523         }
    1524         return MRFROM2SHORT(DOR_NODROP, 0);     /* Drop not valid */
     1517          DrgFreeDraginfo(pDInfo);                      // Free DRAGINFO
     1518        }
     1519        return MRFROM2SHORT(DOR_NODROP, 0);             // Drop not valid
    15251520
    15261521      case CN_INITDRAG:
     
    29172912          }
    29182913        }
    2919         /* else intentional fallthru */
     2914        // else intentional fallthru
    29202915      case IDM_ATTRS:
    29212916      case IDM_INFO:
     
    31033098      dcd->stopflag++;
    31043099    if (dcd && dcd->hwndObject) {
    3105       /* kill object window */
     3100      // kill object window
    31063101      if (WinIsWindow((HAB) 0, dcd->hwndObject)) {
    31073102        if (!PostMsg(dcd->hwndObject, WM_CLOSE, MPVOID, MPVOID))
     
    31503145HWND StartTreeCnr(HWND hwndParent, ULONG flags)
    31513146{
    3152   /* bitmapped flags:
     3147  /**
     3148   * bitmapped flags:
    31533149   * 0x00000001 = don't close app when window closes
    31543150   * 0x00000002 = no frame controls
  • trunk/dll/update.c

    r1611 r1673  
    7373}
    7474
    75 /* Update/add CNRITEM record for filename
     75/**
     76 * Update/add CNRITEM record for filename
    7677 * Deletes existing CNRITEM if file has disappeared
    7778 * @returns pci pointer to CNRITEM record or NULL if not found or if stale CNRITEM deleted
     
    9293  if (IsFullName(filename)) {
    9394    if (driveflags[toupper(*filename) - 'A'] & DRIVE_NOTWRITEABLE)
    94       /* ignore non-writeable drives */
     95      // ignore non-writeable drives
    9596      return (PCNRITEM) NULL;
    9697  }
     
    102103                         &ffb, sizeof(ffb), &nm, FIL_QUERYEASIZEL);
    103104  if (!status) {
    104     /* file exists */
     105    // file exists
    105106    DosFindClose(hDir);
    106107    if (!dcd)
    107108      dcd = INSTDATA(hwndCnr);
    108 /*
    109     if(dcd->type == TREE_FRAME &&
    110        !(ffb.attrFile & FILE_DIRECTORY))
    111       return (PCNRITEM)NULL;
    112 */
    113109    if (dcd->type == ARC_FRAME)
    114110      return (PCNRITEM) NULL;
     
    167163                     MPFROMP(pci), MPFROM2SHORT(TRUE, oldemphasis));
    168164      }
    169       else                              /* existed, unchanged, do nothing but return */
     165      else                              // existed, unchanged, do nothing but return
    170166        return pci;
    171167    }
     
    207203      else if (ffb.attrFile & FILE_DIRECTORY) {
    208204
    209         /* check all parts and insert as required */
     205        // check all parts and insert as required
    210206        CHAR *p, temp;
    211207        PCNRITEM pciParent = NULL, pciT;
     
    359355      if (IsFullName(filename[x])) {
    360356        if (driveflags[toupper(*filename[x]) - 'A'] & DRIVE_NOTWRITEABLE)
    361           /* ignore non-writeable drives */
     357          // ignore non-writeable drives
    362358          continue;
    363359      }
     
    370366                             &ffb, sizeof(ffb), &nm, FIL_QUERYEASIZEL);
    371367      if (!status) {
    372         /* file exists */
     368        // file exists
    373369        DosFindClose(hDir);
    374         //      if(dcd->type == TREE_FRAME && !(ffb.attrFile & FILE_DIRECTORY))
    375         //        continue;
    376370        if (dcd->type == DIR_FRAME && *dcd->directory) {
    377371
     
    398392                            (PCNRITEM) NULL, partial, FALSE, TRUE);
    399393        if (pci) {
    400           /* update record? */
     394          // update record?
    401395          if ((!fForceUpper && !fForceLower &&
    402396               strcmp(pci->pszFileName, filename[x])) ||
     
    415409              pci->latime.minutes != ffb.ftimeLastAccess.minutes ||
    416410              pci->latime.hours != ffb.ftimeLastAccess.hours) {
    417             /* changed; update */
     411            // changed; update
    418412            pciList[numlist++] = pci;
    419413            *ffb.achName = 0;
     
    430424        }
    431425        else {
    432           /* add record */
     426          // add record
    433427          if (dcd->type == DIR_FRAME) {
    434428            RECORDINSERT ri;
     
    470464          }
    471465          else if (ffb.attrFile & FILE_DIRECTORY) {
    472             /* check all parts and insert as required */
     466            // check all parts and insert as required
    473467            CHAR *p, temp;
    474468            PCNRITEM pciParent = NULL, pciT;
     
    577571                                    TRUE)) != NULL &&
    578572               (INT) pci != -1 && !IsRoot(pci->pszFileName)) {
    579         /* file doesn't exist; delete record */
     573        // file doesn't exist; delete record
    580574        if (pci->rc.flRecordAttr & CRA_SELECTED)
    581575          WinSendMsg(hwndCnr,
  • trunk/dll/uudecode.c

    r1544 r1673  
    4747static PSZ pszSrcFile = __FILE__;
    4848
    49 /* prototypes */
     49// prototypes
    5050static BOOL decode(FILE * in, FILE * out);
    5151static void outdec(char *p, FILE * f, int n);
    5252
    53 /* single character decode */
     53// single character decode
    5454#define DEC(c)  (((c) - ' ') & 077)
    5555
     
    7373  }
    7474
    75   /* search for header line */
     75  // search for header line
    7676  for (;;) {
    7777    if (!fgets(buf, sizeof(buf), in)) {
     
    9090  dest[CCHMAXPATH - 1] = 0;
    9191  {
    92     /* place dest in same directory as filename by default... */
     92    // place dest in same directory as filename by default...
    9393    char build[CCHMAXPATH], *p;
    9494
     
    110110  }
    111111
    112   /* create output file */
     112  // create output file
    113113  moder = "ab+";
    114114  out = xfsopen(dest, moder, SH_DENYWR, pszSrcFile, __LINE__, TRUE);
     
    132132}
    133133
    134 /*
     134/**
    135135 * copy from in to out, decoding as you go along.
    136136 */
     
    142142
    143143  for (;;) {
    144     /* for each input line */
     144    // for each input line
    145145    if (!xfgets(buf, sizeof(buf), in, pszSrcFile, __LINE__))
    146146      return FALSE;
     
    158158}
    159159
    160 /*
     160/**
    161161 * output a group of 3 bytes (4 input characters).
    162162 * the input chars are pointed to by p, they are to
  • trunk/dll/valid.c

    r1672 r1673  
    9292APIRET MakeFullName(char *pszFileName)
    9393{
    94   /* pszFileName must be CCHMAXPATH long minimum! */
     94  // pszFileName must be CCHMAXPATH long minimum!
    9595
    9696  char szPathName[CCHMAXPATH];
     
    117117    p = (p) ? (pp) ? (p > pp) ? p : pp : p : pp;
    118118  }
    119   if (!p)                               /* name is itself a root */
     119  if (!p)                               // name is itself a root
    120120    p = filename;
    121   else                                  /* skip past backslash */
     121  else                                  // skip past backslash
    122122    p++;
    123123  return p;
     
    220220BOOL IsNewer(char *file1, char *file2)
    221221{
    222   /* return TRUE if file2 is newer than file1 */
     222  // return TRUE if file2 is newer than file1
    223223
    224224  return (TestFDates(file1, file2, NULL, NULL, NULL, NULL) > 0);
     
    319319                        (PFSQBUFFER2) pvBuffer, &clBufferSize);
    320320  if (rc) {
    321     /* can't get any info at all */
     321    // can't get any info at all
    322322    DosFreeMem(pvBuffer);
    323323    DosError(FERR_DISABLEHARDERR);
     
    411411  NonRemovable = 1;                     // Preset as non removable
    412412  DosError(FERR_DISABLEHARDERR);
    413   rc = DosDevIOCtl(hDev, IOCTL_DISK, DSK_BLOCKREMOVABLE, &parmPkt.Cmd,  /* Address of the command-specific argument list. */
    414                    sizeof(parmPkt.Cmd), /* Length, in bytes, of pParams. */
    415                    &clParmBytes,        /* Pointer to the length of parameters. */
    416                    &NonRemovable,       /* Address of the data area. */
    417                    sizeof(NonRemovable),        /* Length, in bytes, of pData. */
    418                    &clDataBytes);       /* Pointer to the length of data. */
     413  rc = DosDevIOCtl(hDev, IOCTL_DISK, DSK_BLOCKREMOVABLE, &parmPkt.Cmd, // Address of the command-specific argument list.
     414                   sizeof(parmPkt.Cmd), // Length, in bytes, of pParams.
     415                   &clParmBytes,        // Pointer to the length of parameters.
     416                   &NonRemovable,       // Address of the data area.
     417                   sizeof(NonRemovable),// Length, in bytes, of pData.
     418                   &clDataBytes);       // Pointer to the length of data.
    419419
    420420  if (!rc && NonRemovable) {
     
    424424    memset(&dataPkt, 0xff, sizeof(dataPkt));
    425425    DosError(FERR_DISABLEHARDERR);
    426     rc = DosDevIOCtl(hDev, IOCTL_DISK, DSK_GETDEVICEPARAMS, &parmPkt.Cmd,       /* Address of the command-specific argument list. */
    427                      sizeof(parmPkt.Cmd),       /* Length, in bytes, of pParams. */
    428                      &clParmBytes,      /* Pointer to the length of parameters. */
    429                      &dataPkt,          /* Address of the data area. */
    430                      sizeof(dataPkt),   /* Length, in bytes, of pData. */
    431                      &clDataBytes);     /* Pointer to the length of data. */
     426    rc = DosDevIOCtl(hDev, IOCTL_DISK, DSK_GETDEVICEPARAMS, &parmPkt.Cmd,// Address of the command-specific argument list.
     427                     sizeof(parmPkt.Cmd),       // Length, in bytes, of pParams.
     428                     &clParmBytes,              // Pointer to the length of parameters.
     429                     &dataPkt,                  // Address of the data area.
     430                     sizeof(dataPkt),           // Length, in bytes, of pData.
     431                     &clDataBytes);             // Pointer to the length of data.
    432432
    433433    if (!rc && (dataPkt.bpb.fsDeviceAttr & BPB_REMOVABLE_MEDIA))
     
    448448BOOL IsFileSame(CHAR * filename1, CHAR * filename2)
    449449{
    450   /* returns: -1 (error), 0 (is a directory), or 1 (is a file) */
     450  // returns: -1 (error), 0 (is a directory), or 1 (is a file)
    451451
    452452  FILESTATUS3L fsa1, fsa2;
     
    492492      return 0;
    493493  }
    494   return -1;                            /* error; doesn't exist or can't read or null filename */
     494  return -1;                            // error; doesn't exist or can't read or null filename
    495495}
    496496
     
    10801080  *objectpath = 0;
    10811081  if (OS2ver[0] > 20 || (OS2ver[0] == 20 && OS2ver[1] >= 30)) {
    1082     /*
     1082    /**
    10831083     * if running under warp, we can get the desktop name
    10841084     * this way...
  • trunk/dll/viewer.c

    r1544 r1673  
    7878{
    7979
    80   /*
     80  /**
    8181   * create an editor window
    8282   * bitmapped flags:
     
    357357  switch (msg) {
    358358  case WM_CREATE:
    359     /* create MLE window */
     359    // create MLE window
    360360    if (!WinCreateWindow(hwnd,
    361361                         WC_MLE,
     
    460460      vw->hab = WinQueryAnchorBlock(hwnd);
    461461      WinSendMsg(hwnd, UM_SETUP2, MPVOID, MPVOID);
    462       /* set up initial MLE conditions */
     462      // set up initial MLE conditions
    463463      vw->srch.hwndmle = hwndMLE;
    464464      MLEsetcurpos(hwndMLE, 0);
     
    609609    return 0;
    610610
    611   case UM_CONTAINER_FILLED:             /* file was loaded */
     611  case UM_CONTAINER_FILLED:             // file was loaded
    612612    WinEnableWindow(vw->hwndMenu, TRUE);
    613613    vw->busy = FALSE;
     
    647647
    648648  case UM_SELECT:
    649   case WM_SETFOCUS:                     /* sling focus to MLE */
     649  case WM_SETFOCUS:                     // sling focus to MLE
    650650    if (mp2) {
    651651      if (hwndMain && fAutoView)
     
    711711    }
    712712    switch (SHORT1FROMMP(mp1)) {
    713       /*
    714          case MLE_PREVIEW:
    715          preview_text(hwndMLE);
    716          break;
    717        */
     713
    718714    case MLE_VIEWFTP:
    719715      MLEinternet(hwndMLE, TRUE);
     
    817813      }
    818814      else {
    819         /* I dunno why I gotta reset the colors... */
     815        // I dunno why I gotta reset the colors...
    820816        BOOL ro;
    821817        LONG fColor, bColor;
     
    909905        }
    910906        {
    911           /* zero file length instead of unlink (protects EAs from loss) */
     907          // zero file length instead of unlink (protects EAs from loss)
    912908          FILE *fp;
    913909          CHAR *moder = "r+";
     
    952948          break;
    953949      }
    954       /* intentional fallthru */
     950      // intentional fallthru
    955951    case MLE_INSERTFILE:
    956952      if (!MLEgetreadonly(hwndMLE)) {
     
    967963            MLEinsertfile(hwndMLE, filename);
    968964          else {
    969 //                switch_to(filename);
    970965            if (MLEbackgroundload(hwnd,
    971966                                  UM_CONTAINER_FILLED,
     
    11171112      break;
    11181113
    1119     case MLE_CUTLINE:                   /* delete current line */
     1114    case MLE_CUTLINE:                   // delete current line
    11201115      if (!MLEgetreadonly(hwndMLE))
    11211116        MLEdeletecurline(hwndMLE);
     
    11281123      break;
    11291124
    1130     case DID_CANCEL:                    /* escape */
     1125    case DID_CANCEL:                    // escape
    11311126      if (MLEgetreadonly(hwndMLE))
    11321127        PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
     
    11351130      break;
    11361131
    1137     case MLE_QUIT:                      /* outtahere */
     1132    case MLE_QUIT:                      // outtahere
    11381133      MLEsetchanged(hwndMLE, FALSE);
    11391134      vw->ch = FALSE;
    1140       /* intentional fallthru */
     1135      // intentional fallthru
    11411136    case MLE_END:
    11421137      PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
    11431138      break;
    11441139
    1145     case MLE_SETFONT:                   /* select a new font */
     1140    case MLE_SETFONT:                   // select a new font
    11461141      SetMLEFont(hwndMLE, &vw->fattrs, 0);
    11471142      PrfWriteProfileData(fmprof,
     
    11841179      break;
    11851180
    1186     case MLE_FINDFIRST:         /* search */
     1181    case MLE_FINDFIRST:         // search
    11871182      if (MLEfindfirst(hwnd, &vw->srch))
    11881183        PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(MLE_FINDNEXT, 0), MPVOID);
     
    12021197      break;
    12031198
    1204     case MLE_TOGWRAP:                   /* toggle wrap mode */
     1199    case MLE_TOGWRAP:                   // toggle wrap mode
    12051200      if (vw->hex != 1) {
    12061201        SetMenuCheck(vw->hwndMenu, MLE_TOGWRAP, &vw->fWrap, TRUE, "MLEWrap");
     
    12311226    break;
    12321227
    1233   case WM_CLOSE:                        /* outtahere */
     1228  case WM_CLOSE:                        // outtahere
    12341229    WinSendMsg(hwnd, WM_SAVEAPPLICATION, MPVOID, MPVOID);
    12351230    if (vw) {
  • trunk/dll/viewinf.c

    r1648 r1673  
    2626***********************************************************************/
    2727
    28 /* offset 107:  title of INF file */
    29 
    3028#include <stdlib.h>
    3129#include <string.h>
    3230#include <share.h>
    33 // #include <process.h>                    // _beginthread
    3431
    3532#define INCL_DOS
  • trunk/dll/walkem.c

    r1670 r1673  
    372372VOID load_udirs(VOID)
    373373{
    374   /* load linked list of user directories from USERDIRS.DAT file */
     374  // load linked list of user directories from USERDIRS.DAT file
    375375
    376376  FILE *fp;
     
    489489      }
    490490      else {
    491         /* if adding manual directory, remove from auto list if present */
     491        // if adding manual directory, remove from auto list if present
    492492        info = ldirhead;
    493493        temp = NULL;
     
    645645                     BOOL nounwriteable)
    646646{
    647   /*
     647  /**
    648648   * this function fills one or two list boxes with drive and directory
    649649   * information showing all available drives and all directories off of
     
    741741  CHAR szBuff[CCHMAXPATH + 1], szBuffer[CCHMAXPATH + 1], *p;
    742742  SHORT sSelect;
    743   static BOOL okay;             /* avoid combobox selecting as filled */
     743  static BOOL okay;             // avoid combobox selecting as filled
    744744  static CHAR lastdir[CCHMAXPATH + 1];
    745745
     
    821821    if (!loadedudirs)
    822822      load_udirs();
    823     {                                   /* fill user list box */
     823    {                                   // fill user list box
    824824      ULONG ulDriveNum, ulDriveMap;
    825825      ULONG ulSearchCount;
     
    13771377  CHAR szBuff[CCHMAXPATH + 1], szBuffer[CCHMAXPATH + 1], *p;
    13781378  SHORT sSelect;
    1379   static BOOL okay;             /* avoid combobox selecting as filled */
     1379  static BOOL okay;             // avoid combobox selecting as filled
    13801380
    13811381  switch (msg) {
  • trunk/dll/winlist.c

    r1400 r1673  
    8686        register INT i, y;
    8787
    88         /* Get the switch list information */
     88        // Get the switch list information
    8989        ulcEntries = WinQuerySwitchList(0, NULL, 0);
    9090        ulSize = sizeof(SWBLOCK) + sizeof(HSWITCH) + (ulcEntries + 4) *
    9191          (LONG) sizeof(SWENTRY);
    92         /* Allocate memory for list */
     92        // Allocate memory for list
    9393        pswb = xmalloc((unsigned)ulSize, pszSrcFile, __LINE__);
    9494        if (pswb) {
    95           /* Put the info in the list */
     95          // Put the info in the list
    9696          ulcEntries = WinQuerySwitchList(0, pswb, ulSize - sizeof(SWENTRY));
    97           /* do the dirty deed */
     97          // do the dirty deed
    9898          y = 0;
    9999          for (i = 0; i < pswb->cswentry; i++) {
  • trunk/dll/worker.c

    r1666 r1673  
    613613                    break;
    614614                }
    615                 /* else intentional fallthru */
     615                // else intentional fallthru
    616616              case IDM_OPENDEFAULT:
    617617              case IDM_OPENSETTINGS:
     
    856856                    }
    857857                    if (plen) {
    858                       /* make directory/ies, if required */
     858                      // make directory/ies, if required
    859859
    860860                      CHAR dirpart[CCHMAXPATH];
     
    10591059                              GetPString(IDS_WPSCOPYTEXT) :
    10601060                              GetPString(IDS_RENAMETEXT),
    1061                       &"s"[x == 1],             /* s or nul */
     1061                      &"s"[x == 1],             // s or nul
    10621062                      (wk->li->type == IDM_MOVE ||
    10631063                       wk->li->type == IDM_COPY ||
     
    11571157              break;
    11581158            }
    1159             /* else intentional fallthru */
     1159            // else intentional fallthru
    11601160          case IDM_UPDATE:
    11611161            Broadcast(hab2,
     
    12211221              }
    12221222            }
    1223             /* intentional fallthru */
     1223            // intentional fallthru
    12241224          case IDM_FAKEEXTRACT:
    12251225          case IDM_FAKEEXTRACTM:
     
    13401340                if (*wk->li->targetpath && !IsFile(wk->li->targetpath))
    13411341                  AddBackslashToPath(wk->li->targetpath);
    1342                   //if (wk->li->targetpath[strlen(wk->li->targetpath) - 1] !=
    1343                   //    '\\')
    1344                   //  strcat(wk->li->targetpath, "\\");
    13451342                ad.namecanchange = 1;
    13461343              }
     
    13551352                               FM3ModHandle,
    13561353                               ASEL_FRAME, (PVOID) & ad.info) || !ad.info) {
    1357                   break;                /* we blew it */
     1354                  break;                // we blew it
    13581355                }
    13591356              }
     
    13691366                strcpy(ad.arcname, wk->directory);
    13701367                AddBackslashToPath(ad.arcname);
    1371                 //if (ad.arcname[strlen(ad.arcname) - 1] != '\\')
    1372                 //  strcat(ad.arcname, "\\");
    13731368              }
    13741369              if (!WinDlgBox(HWND_DESKTOP, wk->hwndFrame, ArchiveDlgProc, FM3ModHandle,
    1375                              ARCH_FRAME, (PVOID) & ad) || !*ad.arcname || !*ad.command) /* we blew it */
     1370                             ARCH_FRAME, (PVOID) & ad) || !*ad.arcname || !*ad.command) // we blew it
    13761371                break;
    13771372              // Provide extension so containers work
     
    13851380                strcat(ad.arcname, ad.info->ext);
    13861381              }
    1387               /* build the sucker */
     1382              // build the sucker
    13881383              strcpy(szBuffer, ad.command);
    13891384              strcat(szBuffer, " ");
     
    14361431            else
    14371432              wk->li->type = IDM_VIEWBINARY;
    1438             /* intentional fallthru */
     1433            // intentional fallthru
    14391434          case IDM_VIEWBINARY:
    14401435            if (*binview) {
     
    14451440              break;
    14461441            }
    1447             /* else intentional fallthru */
     1442            // else intentional fallthru
    14481443          case IDM_VIEWTEXT:
    14491444          SkipViewing:
     
    14821477            else
    14831478              wk->li->type = IDM_EDITBINARY;
    1484             /* intentional fallthru */
     1479            // intentional fallthru
    14851480          case IDM_EDITBINARY:
    14861481            if (*bined) {
     
    14911486              break;
    14921487            }
    1493             /* else intentional fallthru */
     1488            // else intentional fallthru
    14941489          case IDM_EDITTEXT:
    14951490          SkipEditing:
Note: See TracChangeset for help on using the changeset viewer.