Changeset 184 for trunk/src/helpers


Ignore:
Timestamp:
Jul 5, 2002, 9:13:36 AM (23 years ago)
Author:
umoeller
Message:

Second round of fixes for 0.9.19.

Location:
trunk/src/helpers
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/helpers/animate.c

    r35 r184  
    140140
    141141            WinDrawBitmap(hps, hbm, NULL, (PPOINTL)&rtlStretch,
    142                     0, 0,       // we don't need colors
    143                     DBM_STRETCH);
     142                          0, 0,       // we don't need colors
     143                          DBM_STRETCH);
    144144
    145145            DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT,
     
    159159        // finally, draw the 1:1 version
    160160        WinDrawBitmap(hps, hbm, NULL, &ptl,
    161                 0, 0,       // we don't need colors
    162                 DBM_NORMAL);
     161                      0, 0,       // we don't need colors
     162                      DBM_NORMAL);
    163163
    164164    } // end if (hps)
    165165
    166     return (ulrc);
     166    return ulrc;
    167167}
    168168
  • trunk/src/helpers/apmh.c

    r167 r184  
    7878                            &DataPacket, sizeof(DataPacket), &ulRetSize)))
    7979        if (DataPacket.ReturnCode)
    80             arc = DataPacket.ReturnCode | 10000;
     80            arc = DataPacket.ReturnCode + 10000;
    8181
    8282    return arc;
  • trunk/src/helpers/apps.c

    r167 r184  
    9494    }
    9595
    96     return (cbEnvironment);
     96    return cbEnvironment;
    9797}
    9898
     
    299299    }
    300300
    301     return (ppszRet);
     301    return ppszRet;
    302302}
    303303
     
    717717    {
    718718        if (G_aProgTypes[ul].progc == progc)
    719             return (G_aProgTypes[ul].pcsz);
     719            return G_aProgTypes[ul].pcsz;
    720720    }
    721721
     
    748748        case PROG_31_ENHSEAMLESSCOMMON:     // 18
    749749        case PROG_31_ENH:                   // 19
    750             return (2);
     750            return 2;
    751751
    752752#ifndef PROG_30_STD
     
    766766        case PROG_31_STDSEAMLESSCOMMON:     // 16
    767767        case PROG_31_STD:                   // 20
    768             return (1);
    769     }
    770 
    771     return (0);
     768            return 1;
     769    }
     770
     771    return 0;
    772772}
    773773
     
    19921992    }
    19931993
    1994     return (happReturn);
     1994    return happReturn;
    19951995}
  • trunk/src/helpers/cctl_chart.c

    r167 r184  
    10841084    } // end if (dTotal > 0)
    10851085
    1086     return (hbmReturn);
     1086    return hbmReturn;
    10871087}
    10881088
     
    14551455                              LONG ly)
    14561456{
    1457     // LONG lRegionFound = -1; // none
    1458 
    14591457    POINTL ptlMouse = {lx, ly};
    14601458
     
    14771475                     == PRGN_INSIDE)
    14781476                {
    1479                     return (ul);
     1477                    return ul;
    14801478                }
    14811479            }
     
    14831481    }
    14841482
    1485     return (-1);
     1483    return -1;
    14861484}
    14871485
     
    18971895            pChtCData->fHasFocus = FALSE;
    18981896            WinSetWindowPtr(hwndChart, QWL_USER, pChtCData);
    1899             return (TRUE);
     1897            return TRUE;
    19001898        }
    19011899    }
    19021900
    1903     return (FALSE);
     1901    return FALSE;
    19041902}
    19051903
  • trunk/src/helpers/cctl_checkcnr.c

    r167 r184  
    745745            pcbco->habCnr = WinQueryAnchorBlock(hwndCnr);
    746746
    747             return (pcbco);
     747            return pcbco;
    748748        }
    749749    }
     
    891891        }
    892892    }
    893     return (ulrc);
     893
     894    return ulrc;
    894895}
    895896
     
    914915                      (ULONG)&precc);
    915916
    916     return (precc);
     917    return precc;
    917918}
    918919
     
    938939                         USHORT usCheckState)   // in: 0, 1, 2, 3
    939940{
    940     BOOL brc = FALSE;
    941     PCHECKBOXRECORDCORE precc = ctlFindCheckRecord(hwndCnr, ulItemID);
    942 
    943     if (precc)
     941    PCHECKBOXRECORDCORE precc;
     942    if (precc = ctlFindCheckRecord(hwndCnr, ulItemID))
    944943    {
    945944        precc->usCheckState = usCheckState;
     
    949948                   MPFROM2SHORT(1,
    950949                                CMA_NOREPOSITION));
    951         brc = TRUE;
    952     }
    953 
    954     return brc;
     950        return TRUE;
     951    }
     952
     953    return FALSE;
    955954}
    956955
     
    975974                            USHORT usCheckState)   // in: 0, 1, 2, 3
    976975{
    977     ULONG ulrc = -1;
    978     PCHECKBOXRECORDCORE precc = ctlFindCheckRecord(hwndCnr, ulItemID);
    979 
    980     if (precc)
    981         ulrc = precc->usCheckState;
    982 
    983     return (ulrc);
     976    PCHECKBOXRECORDCORE precc;
     977    if (precc = ctlFindCheckRecord(hwndCnr, ulItemID))
     978        return precc->usCheckState;
     979
     980    return -1;
    984981}
    985982
     
    999996                     BOOL fEnable)
    1000997{
    1001     BOOL brc = FALSE;
    1002     PCHECKBOXRECORDCORE precc = ctlFindCheckRecord(hwndCnr, ulItemID);
    1003 
    1004     if (precc)
     998    PCHECKBOXRECORDCORE precc;
     999
     1000    if (precc = ctlFindCheckRecord(hwndCnr, ulItemID))
    10051001    {
    10061002        ULONG ulAttr = precc->recc.flRecordAttr;
     
    10181014                                    CMA_NOREPOSITION));
    10191015
    1020         brc = TRUE;
    1021     }
    1022 
    1023     return brc;
    1024 }
    1025 
    1026 
     1016        return TRUE;
     1017    }
     1018
     1019    return FALSE;
     1020}
     1021
     1022
  • trunk/src/helpers/cctl_progbar.c

    r167 r184  
    401401BOOL ctlProgressBarFromStatic(HWND hwndChart, ULONG ulAttr)
    402402{
    403     PFNWP OldStaticProc = WinSubclassWindow(hwndChart, ctl_fnwpProgressBar);
    404     if (OldStaticProc)
     403    PFNWP OldStaticProc;
     404    if (OldStaticProc = WinSubclassWindow(hwndChart, ctl_fnwpProgressBar))
    405405    {
    406406        PPROGRESSBARDATA pData = (PPROGRESSBARDATA)malloc(sizeof(PROGRESSBARDATA));
     
    414414        return (TRUE);
    415415    }
    416     else return (FALSE);
     416
     417    return (FALSE);
    417418}
    418419
  • trunk/src/helpers/cctl_splitwin.c

    r167 r184  
    735735        }
    736736
    737         hwndSplit = WinCreateWindow(psbcd->hwndParentAndOwner,  // parent
    738                                     WC_SPLITWINDOW,
    739                                     "",
    740                                     WS_VISIBLE,
    741                                     0, 0, 10, 10,
    742                                     psbcd->hwndParentAndOwner,  // owner
    743                                     HWND_TOP,
    744                                     psbcd->ulSplitWindowID,
    745                                     NULL,
    746                                     NULL);
    747         if (hwndSplit)
     737        if (    (hwndSplit = WinCreateWindow(psbcd->hwndParentAndOwner,  // parent
     738                                             WC_SPLITWINDOW,
     739                                             "",
     740                                             WS_VISIBLE,
     741                                             0, 0, 10, 10,
     742                                             psbcd->hwndParentAndOwner,  // owner
     743                                             HWND_TOP,
     744                                             psbcd->ulSplitWindowID,
     745                                             NULL,
     746                                             NULL))
     747             && (hwndBar = WinCreateWindow(psbcd->hwndParentAndOwner,  // parent
     748                                           WC_STATIC,
     749                                           "",
     750                                           WS_VISIBLE            // wnd style
     751                                             | SS_TEXT,
     752                                           0, 0, 10, 10,
     753                                           psbcd->hwndParentAndOwner,  // owner
     754                                           HWND_TOP,
     755                                           ID_SPLITBAR,          // win ID
     756                                           NULL,                 // cdata
     757                                           NULL))                // presparams
     758           )
    748759        {
    749             hwndBar    = WinCreateWindow(psbcd->hwndParentAndOwner,  // parent
    750                                          WC_STATIC,
    751                                          "",
    752                                          WS_VISIBLE            // wnd style
    753                                            | SS_TEXT,
    754                                          0, 0, 10, 10,
    755                                          psbcd->hwndParentAndOwner,  // owner
    756                                          HWND_TOP,
    757                                          ID_SPLITBAR,          // win ID
    758                                          NULL,                 // cdata
    759                                          NULL                  // presparams
    760                                      );
    761             if (hwndBar)
     760            // create SPLITBARDATA to store in split bar's QWL_USER
     761            PSPLITBARDATA pData;
     762            if (pData = (PSPLITBARDATA)malloc(sizeof(SPLITBARDATA)))
    762763            {
    763                 // create SPLITBARDATA to store in split bar's QWL_USER
    764                 PSPLITBARDATA pData = (PSPLITBARDATA)malloc(sizeof(SPLITBARDATA));
    765                 if (pData)
    766                 {
    767                     // set parent for split bar
    768                     WinSetParent(hwndBar, hwndSplit, FALSE);
    769 
    770                     memset(pData, 0, sizeof(SPLITBARDATA));
    771 
    772                     // copy control data
    773                     memcpy(&(pData->sbcd), psbcd, sizeof(SPLITBARCDATA));
    774                     // set other data
    775                     /* WinQueryWindowRect(hwndBar, &(pData->rclBar));
    776                     (pData->rclBar.xRight)--;
    777                     (pData->rclBar.yTop)--; */
    778                     // subclass static control to make it a split bar
    779                     pData->OldStaticProc = WinSubclassWindow(hwndBar, ctl_fnwpSplitBar);
    780                     pData->hptrOld = NULLHANDLE;
    781                     pData->hptrMove = WinQuerySysPointer(HWND_DESKTOP,
    782                                 (psbcd->ulCreateFlags & SBCF_HORIZONTAL)
    783                                     ? SPTR_SIZENS
    784                                     : SPTR_SIZEWE,
    785                                 FALSE);     // don't make copy
    786                     pData->fCaptured = FALSE;
    787                     pData->hwndLinked1 =
    788                     pData->hwndLinked2 = NULLHANDLE;
    789 
    790                     WinSetWindowULong(hwndBar, QWL_USER, (ULONG)pData);
    791                 }
     764                // set parent for split bar
     765                WinSetParent(hwndBar, hwndSplit, FALSE);
     766
     767                memset(pData, 0, sizeof(SPLITBARDATA));
     768
     769                // copy control data
     770                memcpy(&(pData->sbcd), psbcd, sizeof(SPLITBARCDATA));
     771                // set other data
     772                /* WinQueryWindowRect(hwndBar, &(pData->rclBar));
     773                (pData->rclBar.xRight)--;
     774                (pData->rclBar.yTop)--; */
     775                // subclass static control to make it a split bar
     776                pData->OldStaticProc = WinSubclassWindow(hwndBar, ctl_fnwpSplitBar);
     777                pData->hptrOld = NULLHANDLE;
     778                pData->hptrMove = WinQuerySysPointer(HWND_DESKTOP,
     779                            (psbcd->ulCreateFlags & SBCF_HORIZONTAL)
     780                                ? SPTR_SIZENS
     781                                : SPTR_SIZEWE,
     782                            FALSE);     // don't make copy
     783                pData->fCaptured = FALSE;
     784                pData->hwndLinked1 =
     785                pData->hwndLinked2 = NULLHANDLE;
     786
     787                WinSetWindowULong(hwndBar, QWL_USER, (ULONG)pData);
    792788            }
    793789        }
    794790    }
    795791
    796     return (hwndSplit);
     792    return hwndSplit;
    797793}
    798794
     
    999995LONG ctlQuerySplitPos(HWND hwndSplit)
    1000996{
    1001     ULONG lrc = 0;
    1002 
    1003997    // the split bar data is stored in QWL_USER of the
    1004998    // split bar (not the split window)
    1005     HWND    hwndSplitBar = WinWindowFromID(hwndSplit, ID_SPLITBAR);
    1006     if (hwndSplitBar)
    1007     {
    1008         PSPLITBARDATA psbd = (PSPLITBARDATA)WinQueryWindowULong(hwndSplitBar, QWL_USER);
    1009         if (psbd)
    1010             lrc = psbd->sbcd.lPos;
    1011     }
    1012 
    1013     return (lrc);
     999    HWND    hwndSplitBar;
     1000    PSPLITBARDATA psbd;
     1001    if (    (hwndSplitBar = WinWindowFromID(hwndSplit, ID_SPLITBAR))
     1002         && (psbd = (PSPLITBARDATA)WinQueryWindowULong(hwndSplitBar, QWL_USER))
     1003       )
     1004        return psbd->sbcd.lPos;
     1005
     1006    return 0;
    10141007}
    10151008
  • trunk/src/helpers/cctl_tooltip.c

    r169 r184  
    111111BOOL ctlRegisterTooltip(HAB hab)
    112112{
    113     return (WinRegisterClass(hab,
    114                              COMCTL_TOOLTIP_CLASS,
    115                              ctl_fnwpTooltip,
    116                              CS_HITTEST,     // class styles;
    117                                              // CS_FRAME not working,
    118                                              // CS_CLIPSIBLINGS not working
    119                              sizeof(PVOID)*2));   // addt'l bytes to reserve:
     113    return WinRegisterClass(hab,
     114                            COMCTL_TOOLTIP_CLASS,
     115                            ctl_fnwpTooltip,
     116                            CS_HITTEST,     // class styles;
     117                                            // CS_FRAME not working,
     118                                            // CS_CLIPSIBLINGS not working
     119                            sizeof(PVOID) * 2);   // addt'l bytes to reserve:
    120120                                    // one pointer for QWL_USER,
    121121                                    // one more for instance data
     
    203203        PSUBCLASSEDTOOL pstThis = (PSUBCLASSEDTOOL)pNode->pItemData;
    204204        if (pstThis->hwndTool == hwndTool)
    205         {
    206             return (pstThis);
    207         }
     205            return pstThis;
     206
    208207        pNode = pNode->pNext;
    209208    }
     
    327326static BOOL UnSubclassTool(HWND hwndTool)
    328327{
    329     PSUBCLASSEDTOOL pst = FindSubclassedTool(hwndTool);
    330     if (pst)
     328    PSUBCLASSEDTOOL pst;
     329    if (pst = FindSubclassedTool(hwndTool))
    331330    {
    332331        WinSubclassWindow(hwndTool,
    333332                          pst->pfnwpOrig);
    334333                            // orig winproc == un-subclass
    335         return (lstRemoveItem(&G_llSubclassedTools, pst));
     334        return lstRemoveItem(&G_llSubclassedTools, pst);
    336335                    // this frees the item
    337336    }
    338337
    339     return (FALSE);
     338    return FALSE;
    340339}
    341340
     
    446445
    447446    // allocate and initialize tooltip data
    448     pttd = (PTOOLTIPDATA)malloc(sizeof(TOOLTIPDATA));
    449     if (pttd)
     447    if (pttd = (PTOOLTIPDATA)malloc(sizeof(TOOLTIPDATA)))
    450448    {
    451449        CHAR        szFont[256];
     
    498496        return (MPARAM)FALSE;
    499497    }
    500     else
    501         // malloc failed:
    502         return (MPARAM)TRUE;
     498
     499    // malloc failed:
     500    return (MPARAM)TRUE;
    503501}
    504502
     
    543541    } // end switch
    544542
    545     return (TRUE);
     543    return TRUE;
    546544}
    547545
     
    735733{
    736734    PTOOLTIPDATA pttd = (PTOOLTIPDATA)WinQueryWindowPtr(hwndTooltip, 1);
    737     PTOOLINFO ptiSearch = (PTOOLINFO)mp2;
    738     if (ptiSearch)
     735    PTOOLINFO ptiSearch;
     736    if (ptiSearch = (PTOOLINFO)mp2)
    739737    {
    740738        PLISTNODE pToolNode = lstQueryFirstNode(&pttd->llTools);
     
    962960{
    963961    PTOOLTIPDATA pttd = (PTOOLTIPDATA)WinQueryWindowPtr(hwndTooltip, 1);
    964     PTOOLINFO ptiTarget = (PTOOLINFO)mp2;
    965     if (ptiTarget)
     962    PTOOLINFO ptiTarget;
     963    if (ptiTarget = (PTOOLINFO)mp2)
    966964    {
    967965        PTOOLINFO ptiFound = (PTOOLINFO)lstItemFromIndex(&pttd->llTools,
     
    987985{
    988986    PTOOLTIPDATA pttd = (PTOOLTIPDATA)WinQueryWindowPtr(hwndTooltip, 1);
    989     PTOOLINFO ptiTarget = (PTOOLINFO)mp2;
    990     if (ptiTarget)
     987    PTOOLINFO ptiTarget;
     988    if (ptiTarget = (PTOOLINFO)mp2)
    991989    {
    992990        if (pttd->ptiMouseOver)
    993991        {
    994992            memcpy(ptiTarget, pttd->ptiMouseOver, sizeof(TOOLINFO));
    995             return (MPARAM)TRUE;
     993            return (MRESULT)TRUE;
    996994        }
    997995    }
    998996
    999     return ((MPARAM)FALSE);
     997    return (MRESULT)FALSE;
    1000998}
    1001999
     
    10101008{
    10111009    PTOOLTIPDATA pttd = (PTOOLTIPDATA)WinQueryWindowPtr(hwndTooltip, 1);
    1012     PTOOLINFO ptiSearch = (PTOOLINFO)mp2;
    1013     if (ptiSearch)
     1010    PTOOLINFO ptiSearch;
     1011    if (ptiSearch = (PTOOLINFO)mp2)
    10141012    {
    10151013        PLISTNODE pToolNode = lstQueryFirstNode(&pttd->llTools);
  • trunk/src/helpers/cnrh.c

    r167 r184  
    9696        ulFlags |= CMA_INVALIDATE;
    9797
    98     return (ULONG)(WinSendMsg(hwndCnr,
    99                               CM_REMOVEDETAILFIELDINFO,
    100                               (MPARAM)NULL,
    101                               MPFROM2SHORT(0,      // all
    102                                            ulFlags)));
     98    return (ULONG)WinSendMsg(hwndCnr,
     99                             CM_REMOVEDETAILFIELDINFO,
     100                             (MPARAM)NULL,
     101                             MPFROM2SHORT(0,      // all
     102                                          ulFlags));
    103103}
    104104
     
    218218    fii.cFieldInfoInsert = ulFieldCount;
    219219
    220     return ((ULONG)WinSendMsg(hwndCnr,
    221                               CM_INSERTDETAILFIELDINFO,
    222                               (MPARAM)pFieldInfoFirst,
    223                               (MPARAM)&fii));
     220    return (ULONG)WinSendMsg(hwndCnr,
     221                             CM_INSERTDETAILFIELDINFO,
     222                             (MPARAM)pFieldInfoFirst,
     223                             (MPARAM)&fii);
    224224}
    225225
     
    348348    }
    349349
    350     return (pFieldInfoReturn);
     350    return pFieldInfoReturn;
    351351}
    352352
     
    395395                             ULONG ulCount)  // in: number of records to allocate (> 0)
    396396{
    397     PRECORDCORE      precc;
    398     precc = (PRECORDCORE)WinSendMsg(hwndCnr,
    399                                     CM_ALLOCRECORD,
    400                                     (MPARAM)(cbrecc-sizeof(RECORDCORE)),
    401                                     (MPARAM)ulCount);
    402 
    403     return (precc);
     397    return (PRECORDCORE)WinSendMsg(hwndCnr,
     398                                   CM_ALLOCRECORD,
     399                                   (MPARAM)(cbrecc - sizeof(RECORDCORE)),
     400                                   (MPARAM)ulCount);
    404401}
    405402
     
    478475                        ULONG ulCount)  // in: number of records to insert (> 0)
    479476{
    480     ULONG           ulrc = 0;
    481477    RECORDINSERT    ri;
    482478
     
    503499        ri.cRecordsInsert = ulCount;        // V0.9.0
    504500
    505         ulrc = (ULONG)WinSendMsg(hwndCnr,
     501        return (ULONG)WinSendMsg(hwndCnr,
    506502                                 CM_INSERTRECORD,
    507503                                 (MPARAM)precc,
    508504                                 (MPARAM)&ri);
    509505    }
    510     return (ulrc);
     506
     507    return 0;
    511508}
    512509
     
    528525                            BOOL fInvalidate)           // in: invalidate records?
    529526{
    530     ULONG           ulrc = 0;
    531527    RECORDINSERT    ri;
    532528
     
    552548            ri.cRecordsInsert = 1;
    553549
    554             ulrc = (ULONG)WinSendMsg(hwndCnr,
     550            return (ULONG)WinSendMsg(hwndCnr,
    555551                                     CM_INSERTRECORD,
    556552                                     (MPARAM)precc,
     
    558554        }
    559555    }
    560     return (ulrc);
     556
     557    return 0;
    561558}
    562559
     
    608605        return (ulrc != 0);
    609606    }
    610     else return (FALSE);
     607
     608    return FALSE;
    611609}
    612610
     
    807805    } while (TRUE);
    808806
    809     return (ulrc);
     807    return ulrc;
    810808}
    811809
     
    946944    //     _Pmpf(("  CM_QUERYVIEWPORTRECT failed."));
    947945
    948     return (preccReturn);
     946    return preccReturn;
    949947}
    950948
     
    979977    }
    980978
    981     return (ul);
     979    return ul;
    982980}
    983981
     
    13871385    }
    13881386
    1389     return (preccReturn);
     1387    return preccReturn;
    13901388}
    13911389
     
    14161414            preccReturn = preccNext;
    14171415    }
    1418     return (preccReturn);
     1416
     1417    return preccReturn;
    14191418}
    14201419
     
    14851484    }
    14861485
    1487     return (lrc);
     1486    return lrc;
    14881487}
    14891488
     
    16421641    }
    16431642
    1644     return (ulrc);
     1643    return ulrc;
    16451644}
    16461645
     
    17731772    if (hwndFrame)
    17741773    {
    1775         henum = WinBeginEnumWindows(hwndFrame);
    1776         if (henum)
     1774        if (henum = WinBeginEnumWindows(hwndFrame))
    17771775        {
    17781776            do
    17791777            {
    1780                 hwndTemp = WinGetNextWindow(henum);
    1781                 if (hwndTemp)
     1778                if (hwndTemp = WinGetNextWindow(henum))
    17821779                {
    17831780                    if (WinQueryClassName(hwndTemp, 250, szClassName))
     
    20011998    } // end if (pdrgInfo)
    20021999
    2003     return (pdrgInfo);
     2000    return pdrgInfo;
    20042001}
    20052002
     
    21832180            pctime->hours = pdt->hours;
    21842181        }
    2185         return (TRUE);
     2182        return TRUE;
    21862183    }
    2187     else
    2188         return (FALSE);
     2184
     2185    return FALSE;
    21892186}
    21902187
     
    22032200        pcd->month = pfd->month;
    22042201        pcd->year = pfd->year + 1980;
    2205         return (TRUE);
     2202        return TRUE;
    22062203    }
    2207     else
    2208         return (FALSE);
     2204
     2205    return FALSE;
    22092206}
    22102207
     
    22242221        pct->hours = pft->hours;
    22252222        pct->ucReserved = 0;
    2226         return (TRUE);
     2223        return TRUE;
    22272224    }
    2228     else
    2229         return (FALSE);
    2230 }
     2225
     2226    return FALSE;
     2227}
  • trunk/src/helpers/comctl.c

    r178 r184  
    632632            free(pmbd);
    633633    }
     634
    634635    return brc;
    635636}
     
    10051006    }
    10061007
    1007     return (pa);
     1008    return pa;
    10081009}
    10091010
     
    11411142        }
    11421143    }
     1144
    11431145    return (paNew != NULL);
    11441146}
     
    14201422BOOL ctlMakeHotkeyEntryField(HWND hwndHotkeyEntryField)
    14211423{
    1422     PFNWP pfnwpOrig = WinSubclassWindow(hwndHotkeyEntryField,
    1423                                         ctl_fnwpObjectHotkeyEntryField);
    1424     if (pfnwpOrig)
     1424    PFNWP pfnwpOrig;
     1425    if (pfnwpOrig = WinSubclassWindow(hwndHotkeyEntryField,
     1426                                      ctl_fnwpObjectHotkeyEntryField))
    14251427    {
    14261428        WinSetWindowPtr(hwndHotkeyEntryField, QWL_USER, (PVOID)pfnwpOrig);
    1427         return (TRUE);
     1429        return TRUE;
    14281430    }
    14291431
    1430     return (FALSE);
     1432    return FALSE;
    14311433}
    14321434
  • trunk/src/helpers/configsys.c

    r167 r184  
    284284    } while ((!pReturn) && (p != NULL) && (p != pcszSearchIn));
    285285
    286     return (pReturn);
     286    return pReturn;
    287287}
    288288
     
    335335    }
    336336
    337     return (prc);
     337    return prc;
    338338}
    339339
     
    457457    }
    458458
    459     return (pReturn);
     459    return pReturn;
    460460}
    461461
  • trunk/src/helpers/datetime.c

    r123 r184  
    8787                    &ulTimeNow,
    8888                    sizeof(ulTimeNow));
    89     return (ulTimeNow);
    90 
    91     /* DATETIME    dt;
    92     ULONG       ulHours,
    93                 ulDaysPassed = 0;
    94 
    95     if (G_ulDateScalarFirstCalled == 0)
    96     {
    97         // first call:
    98         G_ulDateScalarFirstCalled = dtDate2Scalar(dt.year,
    99                                                   dt.month,
    100                                                   dt.day);
    101     }
    102     else
    103     {
    104         // not first call:
    105         ULONG ulDateScalarNow = dtDate2Scalar(dt.year,
    106                                               dt.month,
    107                                               dt.day);
    108         ulDaysPassed = (ulDateScalarNow - G_ulDateScalarFirstCalled);
    109         _Pmpf((__FUNCTION__ ": days passed = %d", ulDaysPassed));
    110     }
    111 
    112     DosGetDateTime(&dt);
    113     ulHours = dt.hours;     // this is UCHAR in DATETIME
    114     // get the hours; for every day passed, add 24 hours...
    115     ulHours += (24 * ulDaysPassed);
    116             // 0 if we're still on the first date
    117 
    118     return (10*(dt.hundredths + 100*(dt.seconds + 60*(dt.minutes + 60*(ulHours))))); */
     89    return ulTimeNow;
    11990}
    12091
     
    150121                          FTIME* pftime)         // in: time
    151122{
    152     return (sprintf(pszTimeStamp,
    153                     pcszFormatTimestamp,
    154                     pfdate->year + 1980,
    155                     pfdate->month,
    156                     pfdate->day,
    157                     pftime->hours,
    158                     pftime->minutes,
    159                     pftime->twosecs * 2));
     123    return sprintf(pszTimeStamp,
     124                   pcszFormatTimestamp,
     125                   pfdate->year + 1980,
     126                   pfdate->month,
     127                   pfdate->day,
     128                   pftime->hours,
     129                   pftime->minutes,
     130                   pftime->twosecs * 2);
    160131}
    161132
     
    173144                         DATETIME* pdt)
    174145{
    175     return (sprintf(pszTimeStamp,
    176                     pcszFormatTimestamp,
    177                     pdt->year,
    178                     pdt->month,
    179                     pdt->day,
    180                     pdt->hours,
    181                     pdt->minutes,
    182                     pdt->seconds));
     146    return sprintf(pszTimeStamp,
     147                   pcszFormatTimestamp,
     148                   pdt->year,
     149                   pdt->month,
     150                   pdt->day,
     151                   pdt->hours,
     152                   pdt->minutes,
     153                   pdt->seconds);
    183154}
    184155
     
    372343                    if (day == 29)
    373344                        if (dtIsLeapYear(year))
    374                             return (TRUE);
     345                            return TRUE;
    375346        }
    376347    }
    377348
    378     return (FALSE);
    379 }
    380 
     349    return FALSE;
     350}
     351
  • trunk/src/helpers/encodings.c

    r169 r184  
    1515
    1616/*
    17  *      Copyright (C) 2001 Ulrich M”ller.
     17 *      Copyright (C) 2001-2002 Ulrich M”ller.
    1818 *      This file is part of the "XWorkplace helpers" source package.
    1919 *      This is free software; you can redistribute it and/or modify
  • trunk/src/helpers/nls.c

    r174 r184  
    8585
    8686BOOL        G_afLeadByte[MAX_LEADBYTE] = {0};
    87 ULONG       G_fDBCS = -1;       // not queried yet
     87ULONG       G_fDBCS = 2;       // not queried yet
    8888COUNTRYCODE G_cc = { 0, 0 };
    8989DBCSVECTOR  G_aDBCSVector[8];
     
    9494 *
    9595 *@@added V0.9.19 (2002-06-13) [umoeller]
     96 *@@changed V0.9.20 (2002-07-03) [umoeller]: fixed, this never worked
    9697 */
    9798
    9899BOOL nlsDBCS(VOID)
    99100{
    100     int i;
    101 
    102     if (G_fDBCS != -1)
     101    APIRET arc;
     102
     103    if (G_fDBCS != 2)
    103104        // already queried:
    104105        return G_fDBCS;
    105106
    106     if (DosQueryDBCSEnv(8 * sizeof(DBCSVECTOR),
    107                         &G_cc,
    108                         (PCHAR)G_aDBCSVector))
     107    // V0.9.20 (2002-07-03) [umoeller]
     108    // assume a non-DBCS system UNLESS the below
     109    // loop gives us something meaningful; even
     110    // on non-DBCS systems like mine, DosQueryDBCSEnv
     111    // does not return an error
     112    G_fDBCS = FALSE;
     113
     114    if (arc = DosQueryDBCSEnv(8 * sizeof(DBCSVECTOR),
     115                              &G_cc,
     116                              (PCHAR)G_aDBCSVector))
     117    {
    109118        // not DBCS:
    110         return (G_fDBCS = FALSE);
    111 
    112     for (i = 0;
    113          i < 8;
    114          ++i)
    115     {
    116         if (    (G_aDBCSVector[i].bLow)
    117              && (G_aDBCSVector[i].bHigh)
    118            )
     119        _PmpfF(("DosQueryDBCSEnv returned arc %d", arc));
     120    }
     121    else
     122    {
     123        int i;
     124        for (i = 0;
     125             i < 8;
     126             ++i)
    119127        {
    120             int n;
    121             for (n = G_aDBCSVector[i].bLow;
    122                  n <= G_aDBCSVector[i].bHigh;
    123                  ++n)
    124                 G_afLeadByte[n] = TRUE;
    125             G_fDBCS = TRUE;
     128            if (    (G_aDBCSVector[i].bLow)
     129                 && (G_aDBCSVector[i].bHigh)
     130               )
     131            {
     132                int n;
     133                for (n = G_aDBCSVector[i].bLow;
     134                     n <= G_aDBCSVector[i].bHigh;
     135                     ++n)
     136                    G_afLeadByte[n] = TRUE;
     137                G_fDBCS = TRUE;
     138            }
     139            else
     140                break;
    126141        }
    127         else
    128             break;
    129142    }
    130143
     
    342355 *
    343356 *      Use nlsThousandsDouble for "double" values.
     357 *
     358 *@@changed V0.9.20 (2002-07-03) [umoeller]: optimized
    344359 */
    345360
     
    350365    USHORT ust, uss, usc;
    351366    CHAR   szTemp[40];
    352     sprintf(szTemp, "%lu", ul);
     367    usc = sprintf(szTemp, "%lu", ul);  // V0.9.20 (2002-07-03) [umoeller]
    353368
    354369    ust = 0;
    355     usc = strlen(szTemp);
     370    // usc = strlen(szTemp);
    356371    for (uss = 0; uss < usc; uss++)
    357372    {
     
    367382    pszTarget[ust] = '\0';
    368383
    369     return (pszTarget);
     384    return pszTarget;
    370385}
    371386
     
    382397                                CHAR cThousands)     // in: separator char (e.g. '.')
    383398{
    384     return (nlsThousandsULong(pszTarget, ul, cThousands));
     399    return nlsThousandsULong(pszTarget, ul, cThousands);
    385400}
    386401
     
    389404 *      like nlsThousandsULong, but for a "double"
    390405 *      value. Note that after-comma values are truncated.
     406 *
     407 *@@changed V0.9.20 (2002-07-03) [umoeller]: optimized
    391408 */
    392409
     
    397414    USHORT ust, uss, usc;
    398415    CHAR   szTemp[40];
    399     sprintf(szTemp, "%.0f", floor(dbl));
     416    usc = sprintf(szTemp, "%.0f", floor(dbl)); // V0.9.20 (2002-07-03) [umoeller]
    400417
    401418    ust = 0;
    402     usc = strlen(szTemp);
     419    // usc = strlen(szTemp);
    403420    for (uss = 0; uss < usc; uss++)
    404421    {
     
    414431    pszTarget[ust] = '\0';
    415432
    416     return (pszTarget);
     433    return pszTarget;
    417434}
    418435
     
    424441 *
    425442 *@@added V0.9.6 (2000-11-12) [pr]
     443 *@@changed V0.9.20 (2002-07-03) [umoeller]: now using PCSZ pcszUnits
    426444 */
    427445
    428446PSZ nlsVariableDouble(PSZ pszTarget,
    429447                      double dbl,
    430                       PSZ pszUnits,
     448                      PCSZ pcszUnits,
    431449                      CHAR cThousands)
    432450{
    433451    if (dbl < 100.0)
    434         sprintf(pszTarget, "%.2f%s", dbl, pszUnits);
     452        sprintf(pszTarget, "%.2f%s", dbl, pcszUnits);
    435453    else
    436454        if (dbl < 1000.0)
    437             sprintf(pszTarget, "%.1f%s", dbl, pszUnits);
     455            sprintf(pszTarget, "%.1f%s", dbl, pcszUnits);
    438456        else
    439457            strcat(nlsThousandsDouble(pszTarget, dbl, cThousands),
    440                    pszUnits);
    441 
    442     return(pszTarget);
     458                   pcszUnits);
     459
     460    return pszTarget;
    443461}
    444462
     
    700718            cc.country = 0;         // use system country code
    701719            cc.codepage = 0;        // use process default codepage
    702             return (DosMapCase(ulLength,
    703                                &cc,
    704                                psz));
     720            return DosMapCase(ulLength,
     721                              &cc,
     722                              psz);
    705723        }
    706724    }
    707725
    708     return (ERROR_INVALID_PARAMETER);
    709 }
    710 
    711 
     726    return ERROR_INVALID_PARAMETER;
     727}
     728
     729
  • trunk/src/helpers/shapewin.c

    r167 r184  
    578578            return WinSendMsg(pRgn->pCtrl->hwndShape, msg, mp1, mp2);
    579579    }
     580
    580581    return WinDefWindowProc(hwnd, msg, mp1, mp2);
    581582}
     
    647648        }
    648649    } */
     650
    649651    return 0;
    650652}
     
    675677        pRect = &rect;
    676678    }
     679
    677680    for (i = 0, pRgn = pCtrl->aRegion; i < pCtrl->nRegion; i++, pRgn++)
    678681    {
     
    683686        }
    684687    }
     688
    685689    return 0;
    686690}
     
    783787            }
    784788        }
     789
    785790        if (inspan == TRUE)
    786791        {
     
    9971002                NULL);                  // Pres. Param.
    9981003    }
     1004
    9991005    return 0;
    10001006}
  • trunk/src/helpers/syssound.c

    r167 r184  
    2121 *      These are the general flags in the "MMPM2_AlarmSoundsData"
    2222 *      application:
     23 *
    2324 *      --  If "EnableSounds" is FALSE, all system sounds are disabled.
    2425 *          This defaults to TRUE (tested).
     26 *
    2527 *      --  If "ApplyVolumeToAll" is TRUE, the same volume is used for
    2628 *          all sounds. This defaults to FALSE (tested).
     29 *
    2730 *      --  If ApplyVolumeToAll is TRUE, "Volume" is used for the
    2831 *          global volume. Otherwise, the individual sound volumes
     
    3437 *
    3538 *      Each sound data block in there consists of three elements:
     39 *
    3640 +          soundfile#description#volume
     41 *
    3742 *      where "description" is what is listed in the "Sound" object.
    3843 *      "volume" is only used when "ApplyVolumeToAll" (above) is FALSE.
     
    114119 *
    115120 *@@added V0.9.0 [umoeller]
    116  */
    117 
    118 ULONG sndParseSoundData(PSZ pszSoundData,  // in: INI data from MMPM.INI
     121 *@@changed V0.9.20 (2002-07-03) [umoeller]: optimized
     122 */
     123
     124ULONG sndParseSoundData(PCSZ pszSoundData,  // in: INI data from MMPM.INI
    119125                        PSZ pszDescr,    // out: sound description, as displayed
    120126                               // in the "Sound" object (ptr may be NULL)
     
    124130                               // even if "Global volume" is set in MMPM.INI.
    125131{
    126     PSZ         p1 = pszSoundData, p2;
     132    PCSZ        p1 = pszSoundData, p2;
    127133    ULONG       ulrc = 0;
    128134    // get sound file
    129     p2 = strchr(p1, '#');
    130     if (p2)
     135    if (p2 = strchr(p1, '#'))
    131136    {
    132137        ulrc++;
    133138        if (pszFile)
    134139        {
    135             strncpy(pszFile, p1, p2-p1);
     140            strncpy(pszFile, p1, p2 - p1);
    136141            pszFile[p2-p1] = '\0';
    137142        }
     
    139144
    140145        // get sound description
    141         p2 = strchr(p1, '#');
    142         if (p2)
     146        if (p2 = strchr(p1, '#'))
    143147        {
    144148            ulrc++;
     
    154158            {
    155159                // individual volume settings per sound
    156                 sscanf(p1, "%lu", pulVolume);
     160                *pulVolume = atoi(p1);      // V0.9.20 (2002-07-03) [umoeller]
     161                // sscanf(p1, "%lu", pulVolume);
    157162                ulrc++;
    158163            }
     
    160165    }
    161166
    162     return (ulrc);
     167    return ulrc;
    163168}
    164169
     
    173178VOID sndQueryMmpmIniPath(PSZ pszMMPM)       // out: fully q'fied MMPM.INI
    174179{
    175     PSZ     pszMMPMPath = getenv("MMBASE"); // V0.9.6 (2000-10-16) [umoeller]
    176     if (pszMMPMPath)
     180    PSZ pszMMPMPath;
     181    if (pszMMPMPath = getenv("MMBASE"))  // V0.9.6 (2000-10-16) [umoeller]
    177182    {
    178183        // variable set:
     
    182187
    183188        // kill semicolon if present
    184         p = strchr(pszMMPM, ';');
    185         if (p)
     189        if (p = strchr(pszMMPM, ';'))
    186190           *p = 0;
    187191
     
    211215    HAB     habDesktop = WinQueryAnchorBlock(HWND_DESKTOP);
    212216    CHAR    szMMPM[CCHMAXPATH];
    213     HINI    hini = NULLHANDLE;
    214217
    215218    sndQueryMmpmIniPath(szMMPM);
    216219
    217     hini = PrfOpenProfile(habDesktop, szMMPM);
    218     return (hini);
     220    return PrfOpenProfile(habDesktop, szMMPM);
    219221}
    220222
     
    324326    }
    325327
    326     return (rc);
     328    return rc;
    327329}
    328330
     
    345347BOOL sndWriteSoundData(HINI hiniMMPM,       // in: MMPM.INI handle (from sndOpenMmpmIni)
    346348                       USHORT usIndex,      // in: sound index
    347                        PSZ pszDescr,        // in: sound name or NULL for removal
    348                        PSZ pszFile,         // in: sound file
     349                       PCSZ pszDescr,       // in: sound name or NULL for removal
     350                       PCSZ pszFile,        // in: sound file
    349351                       ULONG ulVolume)      // in: sound volume
    350352{
     
    359361        sprintf(szData, "%s#%s#%lu", pszFile, pszDescr, ulVolume);
    360362        brc = PrfWriteProfileString(hiniMMPM,
    361                                     MMINIKEY_SYSSOUNDS, szKey,
     363                                    MMINIKEY_SYSSOUNDS,
     364                                    szKey,
    362365                                    szData);
    363366    }
     
    366369        // delete entry
    367370        brc = PrfWriteProfileString(hiniMMPM,
    368                                     MMINIKEY_SYSSOUNDS, szKey,
     371                                    MMINIKEY_SYSSOUNDS,
     372                                    szKey,
    369373                                    NULL);
    370374
     
    396400BOOL sndSetSystemSound(HAB hab,
    397401                       USHORT usIndex,
    398                        PSZ pszDescr,
    399                        PSZ pszFile,
     402                       PCSZ pszDescr,
     403                       PCSZ pszFile,
    400404                       ULONG ulVolume)
    401405{
    402406    BOOL    brc = FALSE;
    403     HINI    hiniMMPM = sndOpenMmpmIni(hab);
    404     if (hiniMMPM)
     407    HINI    hiniMMPM;
     408    if (hiniMMPM = sndOpenMmpmIni(hab))
    405409    {
    406410        brc = sndWriteSoundData(hiniMMPM, usIndex, pszDescr, pszFile, ulVolume);
    407411        PrfCloseProfile(hiniMMPM);
    408412    }
     413
    409414    return brc;
    410415}
     
    415420 *      in OS2SYS.INI.
    416421 *
     422 *      If so, and *ppszRealScheme is != NULL, it
     423 *      is set to the key name found. Since the
     424 *      scheme names are case-insensitive, this
     425 *      check is necessary to delete the original
     426 *      scheme for overwrites. The caller is
     427 *      responsible for free()ing *ppszRealScheme
     428 *      then.
     429 *
    417430 *@@added V0.9.0 [umoeller]
    418  */
    419 
    420 BOOL sndDoesSchemeExist(PSZ pszScheme)
    421 {
     431 *@@changed V0.9.20 (2002-07-03) [umoeller]: check has to be case-insensitive, fixed; changed prototype
     432 */
     433
     434BOOL sndDoesSchemeExist(PCSZ pcszScheme,
     435                        PSZ *ppszRealScheme)    // out: actual key name (ptr can be NULL)
     436{
     437    BOOL fExists = FALSE;
     438    PSZ pszKeysList;
     439    if (!prfhQueryKeysForApp(HINI_SYSTEM,
     440                             MMINIKEY_SOUNDSCHEMES,  // "PM_SOUND_SCHEMES_LIST"
     441                             &pszKeysList))
     442    {
     443        PSZ pKey2 = pszKeysList;
     444        while (*pKey2)
     445        {
     446            if (!stricmp(pKey2, pcszScheme))
     447            {
     448                fExists = TRUE;
     449
     450                if (ppszRealScheme)
     451                    *ppszRealScheme = strdup(pKey2);
     452
     453                break;
     454            }
     455
     456            pKey2 += strlen(pKey2)+1; // next key
     457        }
     458
     459        free(pszKeysList);
     460    }
     461
     462    return fExists;
     463
     464    /* old code V0.9.20 (2002-07-03) [umoeller]
    422465    // check in OS2SYS.INI's scheme list whether that
    423466    // scheme exists already
     
    433476
    434477    return (FALSE);
     478    */
     479
    435480}
    436481
     
    453498
    454499APIRET sndCreateSoundScheme(HINI hiniMMPM,      // in: MMPM.INI handle (from sndOpenMmpmIni)
    455                             PSZ pszNewScheme)   // in: name of new scheme
     500                            PCSZ pszNewScheme)  // in: name of new scheme
    456501{
    457502    APIRET  arc = NO_ERROR;
     
    489534                // file name and append the volume...
    490535
    491                 PSZ pSoundData = prfhQueryProfileData(hiniMMPM,
     536                PSZ pSoundData;
     537                if (pSoundData = prfhQueryProfileData(hiniMMPM,
    492538                                                      MMINIKEY_SYSSOUNDS, // "MMPM2_AlarmSounds"
    493539                                                      pKey2,
    494                                                       NULL);
    495                 if (pSoundData)
     540                                                      NULL))
    496541                {
    497542                    sndParseSoundData(pSoundData,
     
    521566            PrfWriteProfileString(HINI_SYSTEM,
    522567                                  MMINIKEY_SOUNDSCHEMES,  // "PM_SOUND_SCHEMES_LIST"
    523                                   pszNewScheme,      // key is scheme name
     568                                  (PSZ)pszNewScheme,      // key is scheme name
    524569                                  szNewAppName);    // data is new OS2SYS.INI application
    525570        }
     
    562607
    563608APIRET sndLoadSoundScheme(HINI hiniMMPM,      // in: HINI of ?:\MMOS2\MMPM.INI (PrfOpenProfile)
    564                           PSZ pszScheme)      // in: scheme name
     609                          PCSZ pszScheme)     // in: scheme name
    565610{
    566611    APIRET arc = NO_ERROR;
     
    702747 */
    703748
    704 APIRET sndDestroySoundScheme(PSZ pszScheme)
     749APIRET sndDestroySoundScheme(PCSZ pszScheme)
    705750{
    706751    APIRET arc = NO_ERROR;
    707752
    708753    // check in OS2SYS.INI's scheme list whether that
    709     // scheme exists already
    710     PSZ pszExisting = prfhQueryProfileData(HINI_SYSTEM,
     754    // scheme exists
     755    PSZ pszExisting;
     756    if (pszExisting = prfhQueryProfileData(HINI_SYSTEM,
    711757                                           MMINIKEY_SOUNDSCHEMES,  // "PM_SOUND_SCHEMES_LIST"
    712758                                           pszScheme,
    713                                            NULL);
    714     if (pszExisting)
     759                                           NULL))
    715760    {
    716761        // delete whole existing PM_SOUNDS_BLAHBLAH application
     
    722767        PrfWriteProfileString(HINI_SYSTEM,
    723768                              MMINIKEY_SOUNDSCHEMES,  // "PM_SOUND_SCHEMES_LIST"
    724                               pszScheme,
     769                              (PSZ)pszScheme,
    725770                              NULL);
    726771        free(pszExisting);
Note: See TracChangeset for help on using the changeset viewer.