diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 07daa37bb0..3133d44efc 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,14 @@ The license applies to all entries newer than 2009-04-28. */ +2012-05-22 18:42 UTC+0200 Viktor Szakats (harbour syenar.net) + * src/rtl/hbdoc.prg + * src/rtl/hbini.prg + * src/rtl/hbi18n2.prg + ! fixed potential bugs with UTF8 HVM CP + % using hb_FileExists() instead of File() in .ini handling code + ; build tested only, review me & test + 2012-05-22 16:50 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * harbour/src/vm/arrays.c * allow to call hb_arrayId() with NULL parameter diff --git a/harbour/src/rtl/hbdoc.prg b/harbour/src/rtl/hbdoc.prg index 4b8d55cffa..f34cd55380 100644 --- a/harbour/src/rtl/hbdoc.prg +++ b/harbour/src/rtl/hbdoc.prg @@ -357,12 +357,12 @@ FUNCTION __hbdoc_LoadHBD( cFileName ) IF fhnd != F_ERROR cBuffer := Space( _HBDOC_SIG_LEN ) - FRead( fhnd, @cBuffer, Len( cBuffer ) ) + FRead( fhnd, @cBuffer, hb_BLen( cBuffer ) ) IF cBuffer == _HBDOC_SIGNATURE cBuffer := Space( FSeek( fhnd, 0, FS_END ) - _HBDOC_SIG_LEN ) FSeek( fhnd, _HBDOC_SIG_LEN, FS_SET ) - FRead( fhnd, @cBuffer, Len( cBuffer ) ) + FRead( fhnd, @cBuffer, hb_BLen( cBuffer ) ) FClose( fhnd ) aEntry := hb_deserialize( hb_ZUncompress( cBuffer ) ) diff --git a/harbour/src/rtl/hbi18n2.prg b/harbour/src/rtl/hbi18n2.prg index 4d925b22be..f2f380a9d7 100644 --- a/harbour/src/rtl/hbi18n2.prg +++ b/harbour/src/rtl/hbi18n2.prg @@ -117,9 +117,9 @@ FUNCTION __I18N_POTARRAYLOAD( cFile, cErrorMsg ) ENDIF cValue := Space( fseek( hFile, 0, FS_END ) ) fseek( hFile, 0, FS_SET ) - n := fread( hFile, @cValue, len( cValue ) ) + n := fread( hFile, @cValue, hb_BLen( cValue ) ) fclose( hFile ) - IF n != len( cValue ) + IF n != hb_BLen( cValue ) cErrorMsg := "cannot read from file: " + cFile RETURN NIL ENDIF @@ -380,7 +380,7 @@ FUNCTION __I18N_POTARRAYSAVE( cFile, aTrans, cErrorMsg, lVersionNo, lSourceRef ) hFile := fcreate( cFile ) IF hFile == -1 cErrorMsg := "cannot create translation file: " + cFile - ELSEIF fwrite( hFile, cPOT, len( cPOT ) ) != len( cPOT ) + ELSEIF fwrite( hFile, cPOT ) != hb_BLen( cPOT ) cErrorMsg := "cannot write to file: " + cFile ELSE lRet := .T. @@ -598,7 +598,7 @@ FUNCTION HB_I18N_SAVEPOT( cFile, pI18N, cErrorMsg ) IF hFile == -1 cErrorMsg := "cannot create translation file: " + cFile lRet := .F. - ELSEIF fwrite( hFile, cPOT, len( cPOT ) ) != len( cPOT ) + ELSEIF fwrite( hFile, cPOT ) != hb_BLen( cPOT ) cErrorMsg := "cannot write to file: " + cFile lRet := .F. ENDIF diff --git a/harbour/src/rtl/hbini.prg b/harbour/src/rtl/hbini.prg index 05f6057686..9d5beed258 100644 --- a/harbour/src/rtl/hbini.prg +++ b/harbour/src/rtl/hbini.prg @@ -153,7 +153,7 @@ STATIC FUNCTION hb_IniFileLow( cFileSpec ) hFile := F_ERROR FOR EACH cFile IN aFiles - IF ! Empty( cFile ) .AND. File( cFile ) + IF ! Empty( cFile ) .AND. hb_FileExists( cFile ) IF ( hFile := FOpen( cFile ) ) != F_ERROR EXIT ENDIF @@ -167,8 +167,8 @@ STATIC FUNCTION hb_IniFileLow( cFileSpec ) /* we'll read the whole file, then we'll break it in lines. */ cData := Space( FSeek( hFile, 0, FS_END ) ) FSeek( hFile, 0, FS_SET ) - nLen := FRead( hFile, @cData, Len( cData ) ) - cData := Left( cData, nLen ) + nLen := FRead( hFile, @cData, hb_BLen( cData ) ) + cData := hb_BLeft( cData, nLen ) FClose( hFile ) RETURN cData @@ -317,7 +317,7 @@ FUNCTION hb_IniWrite( xFileName, hIni, cCommentBegin, cCommentEnd, lAutoMain ) RETURN .F. ENDIF - IF FWrite( hFile, cBuffer ) != Len( cBuffer ) + IF FWrite( hFile, cBuffer ) != hb_BLen( cBuffer ) IF lClose FClose( hFile ) ENDIF