Changeset 350 for trunk/dll/misc.c


Ignore:
Timestamp:
Jul 26, 2006, 9:01:20 PM (19 years ago)
Author:
root
Message:

Use Runtime_Error

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/misc.c

    r245 r350  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2003, 2005 Steven H. Levine
     9  Copyright (c) 2003, 2006 Steven H. Levine
    1010
    1111  11 Jun 03 SHL Add JFS and FAT32 support
     
    1515  24 Jul 05 SHL Beautify
    1616  24 Jul 05 SHL Correct longname display option
     17  17 Jul 06 SHL Use Runtime_Error
    1718
    1819***********************************************************************/
     
    2122#define INCL_WIN
    2223#define INCL_GPI
    23 
    2424#include <os2.h>
     25
    2526#include <stdarg.h>
    2627#include <stdio.h>
     
    2930#include <ctype.h>
    3031#include <share.h>
     32
    3133#include "fm3dll.h"
    3234#include "fm3dlg.h"
     
    3436
    3537#pragma data_seg(DATA1)
     38
     39static PSZ pszSrcFile = __FILE__;
     40
    3641#pragma alloc_text(MAINWND5,SetSysMenu)
    3742#pragma alloc_text(MISC1,BoxWindow,PaintRecessedWindow,PostMsg,PaintSTextWindow)
     
    165170        len = WinQueryWindowTextLength(hwnd);
    166171        if (len)
    167             s = malloc(len + 1);
     172            s = xmalloc(len + 1,pszSrcFile,__LINE__);
    168173        if (s)
    169174        {
     
    756761                    else
    757762                        ealen = sizeof(FEALIST) + 9;
    758                     if (!DosAllocMem((PPVOID) & pfealist,
    759                                      ealen + 64L,
    760                               OBJ_TILE | PAG_COMMIT | PAG_READ | PAG_WRITE))
    761                     {
     763                    rc = DosAllocMem((PPVOID) & pfealist,ealen + 64L,
     764                                     OBJ_TILE | PAG_COMMIT | PAG_READ | PAG_WRITE);
     765                    if (rc)
     766                      Dos_Error(MB_CANCEL,rc,HWND_DESKTOP,pszSrcFile,__LINE__,GetPString(IDS_OUTOFMEMORY));
     767                    else {
    762768                        memset(pfealist, 0, ealen + 1);
    763769                        pfealist -> cbList = ealen;
     
    831837                        *p = 0;
    832838                    bstrip(szData);
    833                     if (IsFullName(szData))
     839                    if (!IsFullName(szData))
     840                        Runtime_Error(pszSrcFile, __LINE__, "bad name");
     841                    else
    834842                    {
    835843                        if (DosQueryPathInfo(szData,
     
    853861                                return (MRESULT) FALSE;
    854862                            }
    855                             if (!docopyf(MOVE,
    856                                          szData,
    857                                          "%s",
    858                                          testname))
    859                             {
    860 
     863                            if (docopyf(MOVE,szData,"%s",testname))
     864                                Runtime_Error(pszSrcFile, __LINE__, "docopyf");
     865                            else {
    861866                                CHAR *filename;
    862867
    863                                 filename = strdup(testname);
     868                                filename = xstrdup(testname,pszSrcFile,__LINE__);
    864869                                if (filename)
    865870                                {
     
    876881                                            MPFROMLONG(-1),
    877882                                            MPFROMP(pci));
    878                                     filename = strdup(pci -> szFileName);
     883                                    filename = xstrdup(pci -> szFileName,pszSrcFile,__LINE__);
    879884                                    if (filename)
    880885                                    {
     
    887892                                }
    888893                            }
    889                             else
    890                                 DosBeep(100, 100);
    891894                        }
    892895                    }
    893                     else
    894                         DosBeep(250, 100);
    895896                }
    896897            }
     
    14471448{
    14481449    ULONG postcount;
    1449 
    1450     if (!DosCreateEventSem(NULL, &CompactSem, 0L, FALSE))
     1450    APIRET rc;
     1451
     1452    rc = DosCreateEventSem(NULL, &CompactSem, 0L, FALSE);
     1453    if (rc)
     1454        Dos_Error(MB_CANCEL,rc,HWND_DESKTOP,pszSrcFile,__LINE__,"DosCreateEventSem");
     1455    else
    14511456    {
    14521457        priority_normal();
     
    14581463            DosResetEventSem(CompactSem, &postcount);
    14591464        }
    1460     }
    1461     else
    1462     {
    1463         DosBeep(250, 100);
    1464         DosBeep(1000, 100);
    1465         DosBeep(500, 100);
    1466 //    DosExit(EXIT_PROCESS,1);
    14671465    }
    14681466}
     
    20782076            *var = 0;
    20792077        }
    2080         fp = fopen(configsys, "r");
     2078        fp = xfopen(configsys, "r",pszSrcFile,__LINE__);
    20812079        if (fp)
    20822080        {
     
    21182116    char *s = NULL;
    21192117
    2120     s = malloc(CCHMAXPATH);
     2118    s = xmalloc(CCHMAXPATH,pszSrcFile,__LINE__);
    21212119    if (s)
    21222120    {
     
    21432141    char *s = NULL;
    21442142
    2145     s = malloc(CCHMAXPATH);
     2143    s = xmalloc(CCHMAXPATH,pszSrcFile,__LINE__);
    21462144    if (s)
    21472145    {
     
    21632161    char *s = NULL;
    21642162
    2165     s = malloc(CCHMAXPATH * 2);
     2163    s = xmalloc(CCHMAXPATH * 2,pszSrcFile,__LINE__);
    21662164    if (s)
    21672165    {
     
    23032301            (LONG) sizeof(SWENTRY);
    23042302        /* Allocate memory for list */
    2305         if ((pswb = malloc((unsigned) ulSize)) != NULL)
    2306         {
     2303        pswb = xmalloc(ulSize,pszSrcFile,__LINE__);
     2304        if (pswb) {
    23072305            /* Put the info in the list */
    23082306            ulcEntries = WinQuerySwitchList(0, pswb,
Note: See TracChangeset for help on using the changeset viewer.