From 31be7ebd33748c6b0d80a235def178fd08a1a545 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Mon, 23 Nov 2009 09:27:08 +0000 Subject: [PATCH] 2009-11-23 10:25 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbwin/win_prn2.c ! Commented buggy code dealing with Chr( 256 ) strippage in PRINTFILERAW(). While I can imagine Chr( 26 ) may cause a little inconvenience when sent to printer, it will just be a small visual one, and it's very easy to overcome by using HB_MEMOWRIT() instead of MEMOWRIT() to create the disk file, if the file was created by other means, the Chr( 26 ) won't be there anyway. Anyhow I opted to have a clear cut behavior even if it's slightly incompatible because old implementation was buggy, and IMO such printing function shouldn't do behind-the-scenes alterations on the data to be printed. After all the function is called "RAW". INCOMPATIBLE for files which has an ending Chr( 26 ). * contrib/hbide/hbide.prg ! Removed CURDRIVE() and CURDIR() usage. Notice that on *nix platforms there is no such thing as drive letter, plus some platforms don't even have the concept of current dir. CURDRIVE() is also an XBase++ specific call, so it may not be available in Harbour core. ! Removed hard-wired Windows specific path from save dialog. (it was a template yet) * config/rules.mk ! Deleted CFLAGS from default link rule. After quick scan through the make files this shouldn't cause problems. Please test and if it does, we should add missing options to LDFLAGS. ; TODO: Clean CPPFLAGS vs. CFLAGS usage in all .mk files. They should all uniformly use CFLAGS now. --- harbour/ChangeLog | 33 +++++++++++++++++++++++++++++++- harbour/config/rules.mk | 2 +- harbour/contrib/hbide/hbide.prg | 5 ++--- harbour/contrib/hbwin/win_prn2.c | 2 ++ 4 files changed, 37 insertions(+), 5 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 2bec52feed..b25056de9f 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,37 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-11-23 10:25 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) + * contrib/hbwin/win_prn2.c + ! Commented buggy code dealing with Chr( 256 ) strippage in PRINTFILERAW(). + While I can imagine Chr( 26 ) may cause a little inconvenience + when sent to printer, it will just be a small visual one, and it's + very easy to overcome by using HB_MEMOWRIT() instead of MEMOWRIT() + to create the disk file, if the file was created by other means, + the Chr( 26 ) won't be there anyway. Anyhow I opted to have a clear cut + behavior even if it's slightly incompatible because old implementation + was buggy, and IMO such printing function shouldn't do behind-the-scenes + alterations on the data to be printed. After all the function is called + "RAW". + INCOMPATIBLE for files which has an ending Chr( 26 ). + + * contrib/hbide/hbide.prg + ! Removed CURDRIVE() and CURDIR() usage. + Notice that on *nix platforms there is no such thing as + drive letter, plus some platforms don't even have the + concept of current dir. CURDRIVE() is also an XBase++ + specific call, so it may not be available in Harbour core. + ! Removed hard-wired Windows specific path from save dialog. + (it was a template yet) + + * config/rules.mk + ! Deleted CFLAGS from default link rule. + After quick scan through the make files this shouldn't cause + problems. Please test and if it does, we should add missing + options to LDFLAGS. + ; TODO: Clean CPPFLAGS vs. CFLAGS usage in all .mk files. + They should all uniformly use CFLAGS now. + 2009-11-23 09:11 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * src/rtl/filesys.c ! Fixed leak in hb_fsCurDirBuff() report by Pritpal. @@ -261,7 +292,7 @@ strip Chr( 26 ) even from inside the file if the file is larger than read buffer, which means it will corrupt input and may cause wrong output to be printed (f.e. if that Chr( 26 ) - is part of a printer control char sequence). + is part of a printer control char sequence). [DONE] * INSTALL + Added linux/clang to the target mix. diff --git a/harbour/config/rules.mk b/harbour/config/rules.mk index 12b39083bb..4bb0b4282a 100644 --- a/harbour/config/rules.mk +++ b/harbour/config/rules.mk @@ -63,7 +63,7 @@ endif # The rule to link an executable. ifeq ($(LD_RULE),) - LD_RULE = $(LD) $(CFLAGS) $(LDFLAGS) $(HB_LDFLAGS) $(HB_USER_LDFLAGS) $(LD_OUT)$(subst /,$(DIRSEP),$(BIN_DIR)/$@) $(^F) $(LDLIBS) $(LDSTRIP) + LD_RULE = $(LD) $(LDFLAGS) $(HB_LDFLAGS) $(HB_USER_LDFLAGS) $(LD_OUT)$(subst /,$(DIRSEP),$(BIN_DIR)/$@) $(^F) $(LDLIBS) $(LDSTRIP) endif # Eliminate these rules. diff --git a/harbour/contrib/hbide/hbide.prg b/harbour/contrib/hbide/hbide.prg index f412fe92ec..40f08cba2c 100644 --- a/harbour/contrib/hbide/hbide.prg +++ b/harbour/contrib/hbide/hbide.prg @@ -542,12 +542,12 @@ METHOD HbIde:selectSource( cMode ) oDlg:fileFilters := { { "PRG Sources", "*.prg" }, { "C Sources", "*.c" }, { "CPP Sources", "*.cpp" }, ; { "H Headers", "*.h" }, { "CH Headers", "*.ch" } } - cFile := oDlg:open( CurDrive() +":\"+ CurDir(), , .f. ) + cFile := oDlg:open( , , .f. ) ELSE oDlg:title := "Save this Database" oDlg:fileFilters := { { "Database Files", "*.dbf" } } oDlg:quit := {|| MsgBox( "Quitting the Dialog" ), 1 } - cFile := oDlg:saveAs( "c:\temp\myfile.dbf" ) + cFile := oDlg:saveAs( "myfile.dbf" ) IF !empty( cFile ) HBXBP_DEBUG( cFile ) ENDIF @@ -958,4 +958,3 @@ METHOD HbIde:fetchNewProject() RETURN self /*----------------------------------------------------------------------*/ - diff --git a/harbour/contrib/hbwin/win_prn2.c b/harbour/contrib/hbwin/win_prn2.c index d0a42f4edb..d47cc26cb5 100644 --- a/harbour/contrib/hbwin/win_prn2.c +++ b/harbour/contrib/hbwin/win_prn2.c @@ -429,12 +429,14 @@ HB_FUNC( PRINTFILERAW ) while( ( nRead = hb_fsRead( fhnd, pbyBuffer, sizeof( pbyBuffer ) ) ) > 0 ) { +#if 0 /* TOFIX: This check seems wrong for any input files larger than our read buffer, in such case it will strip Chr( 26 ) from inside the file, which means it will corrupt it. [vszakats] */ if( pbyBuffer[ nRead - 1 ] == 26 ) nRead--; /* Skip the EOF() character */ +#endif WritePrinter( hPrinter, pbyBuffer, nRead, &dwWritten ); }