Changeset 400
- Timestamp:
- Jul 29, 2006, 9:51:30 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/wrappers.c
r395 r400 9 9 10 10 22 Jul 06 SHL Baseline 11 29 Jul 06 SHL Add xgets_stripped 11 12 12 13 ***********************************************************************/ … … 23 24 24 25 #pragma alloc_text(WRAPPERS1,xfree,xfopen,xfsopen,xmalloc,xrealloc) 26 27 PSZ xfgets(PSZ pszBuf, size_t cMaxBytes, FILE *fp, PCSZ pszSrcFile, UINT uiLineNumber) 28 { 29 PSZ psz = fgets(pszBuf,cMaxBytes,fp); 30 if (!psz) { 31 if (ferror(fp)) 32 Runtime_Error(pszSrcFile, uiLineNumber, "fgets"); 33 } 34 else { 35 size_t c = strlen(psz); 36 if (c + 1 > cMaxBytes) 37 Runtime_Error(pszSrcFile, uiLineNumber, "buffer overflow"); 38 else if (!c || (psz[c-1] != '\n' && psz[c-1] != '\r')) 39 Runtime_Error(pszSrcFile, uiLineNumber, "missing EOL"); 40 } 41 return psz; 42 } 43 44 PSZ xfgets_bstripcr(PSZ pszBuf, size_t cMaxBytes, FILE *fp, PCSZ pszSrcFile, UINT uiLineNumber) 45 { 46 PSZ psz = xfgets(pszBuf,cMaxBytes,fp,pszSrcFile,__LINE__); 47 if (psz) 48 bstripcr(psz); 49 return psz; 50 } 25 51 26 52 FILE *xfopen(PCSZ pszFileName, PCSZ pszMode, PCSZ pszSrcFile, UINT uiLineNumber)
Note:
See TracChangeset
for help on using the changeset viewer.