Changeset 328 for trunk/dll/viewer.c


Ignore:
Timestamp:
Jul 25, 2006, 8:37:24 PM (19 years ago)
Author:
root
Message:

Use Runtime_Error

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/viewer.c

    r186 r328  
    77
    88  Copyright (c) 1993-97 M. Kimes
    9   Copyright (c) 2005 Steven H. Levine
     9  Copyright (c) 2005, 2006 Steven H. Levine
    1010
    1111  23 May 05 SHL Use QWL_USER
     12  17 Jul 06 SHL Use Runtime_Error
    1213
    1314***********************************************************************/
     
    1516#define INCL_DOS
    1617#define INCL_WIN
    17 
    1818#include <os2.h>
     19
    1920#include <stdlib.h>
    2021#include <stdio.h>
     
    2223#include <time.h>
    2324#include <io.h>
     25
    2426#include "fm3dll.h"
    2527#include "fm3dlg.h"
     
    2830
    2931#pragma data_seg(DATA1)
     32
     33static PSZ pszSrcFile = __FILE__;
     34
    3035#pragma alloc_text(VIEWER,MLEEditorProc,MLESubProc)
    3136#pragma alloc_text(STARTUP,StartMLEEditor)
     
    6671    return StartViewer(hwndClient,(USHORT)flags,filename,hwndRestore);
    6772
    68   vw = malloc(sizeof(XMLEWNDPTR));
    69   if(!vw) {
    70     DosBeep(50,100);
     73  vw = xmallocz(sizeof(XMLEWNDPTR),pszSrcFile,__LINE__);
     74  if(!vw)
    7175    return (HWND)0;
    72   }
    73   memset(vw,0,sizeof(XMLEWNDPTR));
    7476  vw->size = sizeof(XMLEWNDPTR);
    7577  if(flags & 1) {
     
    758760      }
    759761      switch(SHORT1FROMMP(mp1)) {
    760 /*
     762        /*
    761763        case MLE_PREVIEW:
    762764          preview_text(hwndMLE);
    763765          break;
    764 */
     766        */
    765767        case MLE_VIEWFTP:
    766768          MLEinternet(hwndMLE,TRUE);
     
    871873
    872874        case MLE_TOGGLEREADONLY:
    873           if(!vw->busy && vw->hex != 1) {  /* I dunno why I gotta reset the colors... */
    874 
     875          if (vw->busy || vw->hex == 1) {
     876            DosBeep(50,100);
     877          }
     878          else {
     879            /* I dunno why I gotta reset the colors... */
    875880            BOOL ro;
    876881            LONG fColor,bColor;
     
    914919                       MPVOID);
    915920          }
    916           else
    917             DosBeep(50,100);
    918921          break;
    919922
     
    953956                break;
    954957            }
    955             { /* zero file length instead of unlink (protects EAs from loss) */
     958            {
     959              /* zero file length instead of unlink (protects EAs from loss) */
    956960              FILE *fp;
    957961
    958               fp = fopen(vw->exportfilename,"r+");
    959               if(fp) {
     962              fp = xfopen(vw->exportfilename,"r+",pszSrcFile,__LINE__);
     963              if (fp) {
    960964                oldsize = filelength(fileno(fp));
    961965                DosSetFileSize(fileno(fp),0L);
     
    963967              }
    964968            }
    965             if(!MLEexportfile(hwndMLE,
     969            if (!MLEexportfile(hwndMLE,
    966970                              vw->exportfilename,
    967971                              vw->ExpandTabs,
     
    969973                              vw->fStripTrail)) {
    970974              FILE *fp;
    971 
    972               DosBeep(50,100);
    973               fp = fopen(vw->exportfilename,"r+");
    974               if(fp) {
     975              Runtime_Error(pszSrcFile, __LINE__, "MLEexportfile");
     976              fp = xfopen(vw->exportfilename,"r+",pszSrcFile,__LINE__);
     977              if (fp) {
    975978                DosSetFileSize(fileno(fp),oldsize);
    976979                fclose(fp);
     
    11911194            sip.title = GetPString(IDS_NVLINEJUMPTITLETEXT);
    11921195            numlines = MLEnumlines(hwndMLE);
    1193             if(numlines) {
     1196            if(!numlines)
     1197              DosBeep(50,100);
     1198            else {
    11941199              sprintf(sip.prompt,
    11951200                      GetPString(IDS_NVJUMPTEXT),
     
    12031208                        STR_FRAME,
    12041209                        &sip);
    1205               if(*s) {
     1210              if (*s) {
    12061211                linenum = atol(s);
    1207                 if(linenum > 0 && linenum <= numlines) {
     1212                if (linenum > 0 && linenum <= numlines) {
    12081213                  MLEsettopline(hwndMLE,
    12091214                                MLEstartofline(hwndMLE,
     
    12151220              }
    12161221            }
    1217             else
    1218               DosBeep(50,100);
    12191222          }
    12201223          break;
Note: See TracChangeset for help on using the changeset viewer.