diff --git a/harbour/ChangeLog b/harbour/ChangeLog index ab37eae814..e6654f8cd2 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,11 @@ The license applies to all entries newer than 2009-04-28. */ +2012-05-04 09:31 UTC+0200 Viktor Szakats (harbour syenar.net) + * contrib/hbtip/sessid.prg + * contrib/hbtip/encqp.prg + * formatting + 2012-05-04 03:18 UTC+0200 Viktor Szakats (harbour syenar.net) * contrib/hbct/getsecrt.prg * use hb_keyCode() instead of Asc() to form numeric key value. @@ -29,7 +34,7 @@ * contrib/hbtip/mail.prg ! Q-encoding fixed to use FOR/NEXT loop instead of FOR/EACH and HB_B*() string functions to - operate on binary data regardless of HVM CP + operate on binary data regardless of HVM CP. 2012-05-04 01:51 UTC+0200 Viktor Szakats (harbour syenar.net) * include/harbour.hbx diff --git a/harbour/contrib/hbtip/encqp.prg b/harbour/contrib/hbtip/encqp.prg index 8afa517ed6..c24aa1eec9 100644 --- a/harbour/contrib/hbtip/encqp.prg +++ b/harbour/contrib/hbtip/encqp.prg @@ -94,7 +94,7 @@ METHOD Encode( cData ) CLASS TIPEncoderQP RETURN cString METHOD Decode( cData ) CLASS TIPEncoderQP - LOCAL tmp + LOCAL nPos LOCAL c LOCAL nLen LOCAL cString := "" @@ -104,11 +104,11 @@ METHOD Decode( cData ) CLASS TIPEncoderQP cData := StrTran( cData, "=" + Chr( 10 ) ) /* also delete non-standard line breaks */ nLen := hb_BLen( cData ) - FOR tmp := 1 TO nLen - c := hb_BSubStr( cData, tmp, 1 ) - IF c == "=" .AND. hb_BLen( hb_BSubStr( cData, tmp + 1, 2 ) ) == 2 - cString += Chr( hb_HexToNum( hb_BSubStr( cData, tmp + 1, 2 ) ) ) - tmp += 2 + FOR nPos := 1 TO nLen + c := hb_BSubStr( cData, nPos, 1 ) + IF c == "=" .AND. hb_BLen( hb_BSubStr( cData, nPos + 1, 2 ) ) == 2 + cString += Chr( hb_HexToNum( hb_BSubStr( cData, nPos + 1, 2 ) ) ) + nPos += 2 ELSE cString += c ENDIF diff --git a/harbour/contrib/hbtip/sessid.prg b/harbour/contrib/hbtip/sessid.prg index fa4a47f790..f73f89b110 100644 --- a/harbour/contrib/hbtip/sessid.prg +++ b/harbour/contrib/hbtip/sessid.prg @@ -81,18 +81,18 @@ FUNCTION TIP_GENERATESID( cCRCKey ) /* Let's generate the sequence */ cSID := Space( nLenSID ) - for n := 1 TO nLenSID + FOR n := 1 TO nLenSID nRand := hb_RandomInt( 1, nLenKeys ) cSID := Stuff( cSID, n, 1, SubStr( cBaseKeys, nRand, 1 ) ) nKey += nRand - next + NEXT nSIDCRC := nKey * 51 // Max Value is 99603 a 5 chars number cTemp := StrZero( nSIDCRC, 5 ) cSIDCRC := "" - for n := 1 to Len( cTemp ) + FOR n := 1 TO Len( cTemp ) cSIDCRC += SubStr( cCRCKey, Val( SubStr( cTemp, n, 1 ) ) + 1, 1 ) - next + NEXT cRet := cSID + cSIDCRC @@ -110,18 +110,18 @@ FUNCTION TIP_CHECKSID( cSID, cCRCKey ) cCRCKey := Left( cCRCKey, 10 ) // Max Lenght must to be of 10 chars /* Calculate the key */ - for n := 1 to nLenSID + FOR n := 1 TO nLenSID nRand := At( SubStr( cSID, n, 1), cBaseKeys ) nKey += nRand - next + NEXT // Recalculate the CRC nSIDCRC := nKey * 51 // Max Value is 99603. a 5 chars number cTemp := StrZero( nSIDCRC, 5 ) cSIDCRC := "" - for n := 1 to Len( cTemp ) + FOR n := 1 TO Len( cTemp ) cSIDCRC += SubStr( cCRCKey, Val( SubStr( cTemp, n, 1 ) ) + 1, 1 ) - next + NEXT RETURN Right( cSID, 5 ) == cSIDCRC