From 6969aa63c260c18d8fe4584b1c80e898faaf5093 Mon Sep 17 00:00:00 2001 From: "Alexander S.Kresin" Date: Fri, 12 Jun 2009 09:27:24 +0000 Subject: [PATCH] 2009-06-12 13:30 UTC+0300 Alexander Kresin * utils/hbformat/hbformat.prg ! EOL handling fixed * utils/hbformat/hbformac.c * EOF dropped now --- harbour/ChangeLog | 6 ++++++ harbour/utils/hbformat/hbformac.c | 9 +++++++++ harbour/utils/hbformat/hbformat.prg | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 0fa921d0c4..96d64491d4 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,12 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-06-12 13:30 UTC+0300 Alexander Kresin + * utils/hbformat/hbformat.prg + ! EOL handling fixed + * utils/hbformat/hbformac.c + * EOF dropped now + 2009-06-12 11:09 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * utils/hbmk2/hbmk2.prg ! Fixed to autodetect special *nix dir layout in case diff --git a/harbour/utils/hbformat/hbformac.c b/harbour/utils/hbformat/hbformac.c index 4f2a7d368c..8ffc46396c 100644 --- a/harbour/utils/hbformat/hbformac.c +++ b/harbour/utils/hbformat/hbformac.c @@ -76,6 +76,11 @@ HB_FUNC( RF_FILEREAD ) } ulLines ++; } + else if( (unsigned int)(*ptr) < 9 ) + { + hb_ret(); + return; + } ptr ++; } ptr --; @@ -102,7 +107,11 @@ HB_FUNC( RF_FILEREAD ) } if( ul == ulLines ) + { + if( *(ptr-1) == 0x1A ) + ptr --; hb_arraySetCL( arr, ul, ptr1, ptr - ptr1 ); + } hb_itemReturnRelease( arr ); } diff --git a/harbour/utils/hbformat/hbformat.prg b/harbour/utils/hbformat/hbformat.prg index 9eb57ad155..f077a31f03 100644 --- a/harbour/utils/hbformat/hbformat.prg +++ b/harbour/utils/hbformat/hbformat.prg @@ -926,7 +926,7 @@ METHOD File2Array( cFileName ) CLASS CODEFORMAT IF hb_FileExists( cFileName ) aFile := rf_FileRead( MemoRead( cFileName ), @cEol ) - IF ::nEol <= 0 + IF ::nEol < 0 ::cEol := cEol ENDIF ENDIF