From a8877c1fe9c89fd1ca080bed9e39a497507fc4b4 Mon Sep 17 00:00:00 2001 From: Lorenzo Fiorini Date: Wed, 4 Apr 2007 13:29:56 +0000 Subject: [PATCH] 2007-04-04 15:30 UTC+0200 Lorenzo Fiorini (lorenzo.fiorini/at/gmail.com) * harbour/contrib/pgsql/tpostgre.prg * removed unused vars * harbour/contrib/tip/cgi.prg * used new hb_serialize/hb_deserialize * removed unused vars * harbour/contrib/tip/ftpcln.prg * harbour/contrib/tip/httpcln.prg * harbour/contrib/tip/mail.prg * harbour/contrib/tip/popcln.prg * removed unused vars --- harbour/ChangeLog | 12 +++++++++ harbour/contrib/pgsql/tpostgre.prg | 7 +---- harbour/contrib/tip/cgi.prg | 43 ++++++++---------------------- harbour/contrib/tip/ftpcln.prg | 8 ++---- harbour/contrib/tip/httpcln.prg | 12 ++++----- harbour/contrib/tip/mail.prg | 4 +-- harbour/contrib/tip/popcln.prg | 2 +- 7 files changed, 35 insertions(+), 53 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index ace7300348..883b528800 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,18 @@ 2002-12-01 13:30 UTC+0100 Foo Bar */ +2007-04-04 15:30 UTC+0200 Lorenzo Fiorini (lorenzo.fiorini/at/gmail.com) + * harbour/contrib/pgsql/tpostgre.prg + * removed unused vars + * harbour/contrib/tip/cgi.prg + * used new hb_serialize/hb_deserialize + * removed unused vars + * harbour/contrib/tip/ftpcln.prg + * harbour/contrib/tip/httpcln.prg + * harbour/contrib/tip/mail.prg + * harbour/contrib/tip/popcln.prg + * removed unused vars + 2007-04-04 12:15 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/ChangeLog ! typos diff --git a/harbour/contrib/pgsql/tpostgre.prg b/harbour/contrib/pgsql/tpostgre.prg index 0c44e594ff..9db3b7e153 100644 --- a/harbour/contrib/pgsql/tpostgre.prg +++ b/harbour/contrib/pgsql/tpostgre.prg @@ -552,10 +552,7 @@ METHOD Refresh(lQuery,lMeta) CLASS TPQquery Local aStruct := {} Local aTemp := {} Local i - Local n - Local temp - Local cQuery - Local cType, nType, nDec, nSize + Local cType, nDec, nSize Default lQuery To .T. Default lMeta To .T. @@ -962,7 +959,6 @@ RETURN ! ::lError METHOD FieldGet( nField, nRow ) CLASS TPQquery Local result - Local i Local cType Local nSize Local tmp @@ -1093,7 +1089,6 @@ METHOD SetKey() CLASS TPQquery Local i, x Local nTableId, xTableId := -1 Local nCount := 0 - Local cTable Local res Local nPos diff --git a/harbour/contrib/tip/cgi.prg b/harbour/contrib/tip/cgi.prg index 100b6526a4..194bbd069c 100644 --- a/harbour/contrib/tip/cgi.prg +++ b/harbour/contrib/tip/cgi.prg @@ -212,7 +212,7 @@ METHOD Flush() CLASS TIpCgi local cSID := ::cSID local cSession - hEval( ::hCookies, { |k,v,n| ::cCgiHeader += 'Set-Cookie: ' + k + '=' + v + ';' + _CRLF } ) + hEval( ::hCookies, { |k,v| ::cCgiHeader += 'Set-Cookie: ' + k + '=' + v + ';' + _CRLF } ) cStream := ::cCgiHeader + _CRLF + ::cHtmlPage + _CRLF @@ -250,6 +250,10 @@ METHOD DestroySession( cID ) CLASS TIpCgi local cSID := ::cSID local lRet + if !empty( cID ) + cSID := cID + endif + if !empty( cSID ) ::hSession := Hash() @@ -423,38 +427,13 @@ METHOD StartSession() CLASS TIpCgi METHOD SessionEncode() CLASS TIpCgi - local aSerial := {} - local cKey, xVal - - for each cKey in ::hSession:Keys - xVal := ::hSession[ cKey ] - if xVal != nil - aAdd( aSerial, { cKey, xVal } ) - endif - next - - RETURN HB_Serialize( aSerial ) + RETURN HB_Serialize( ::hSession ) METHOD SessionDecode( cData ) CLASS TIpCgi - local lRet := .t. - local cSerial := HB_DeserialBegin( cData ) - local xVal, cKey, aElem + ::hSession := HB_Deserialize( cData ) - do while ( xVal := HB_DeserialNext( @cSerial ) ) != nil - switch ValType( xVal ) - case 'A' // Vars are stored in array { VarName, Value } - for each aElem in xVal - ::hSession[ aElem[1] ] := aElem[2] - next - exit - otherwise - lRet := .f. - exit - end - enddo - - RETURN lRet + RETURN Valtype( ::hSession ) == "H" STATIC FUNCTION HtmlTag( xVal, cKey ) @@ -478,7 +457,7 @@ STATIC FUNCTION HtmlAllTag( hTags, cSep ) DEFAULT cSep TO ' ' - hEval( hTags, { |key,value,pos| cVal += HtmlTag( hTags, key ) + cSep } ) + hEval( hTags, { |k,v,p| cVal += HtmlTag( hTags, k, v, p ) + cSep } ) return cVal @@ -511,7 +490,7 @@ STATIC FUNCTION HtmlAllOption( hOptions, cSep ) DEFAULT cSep TO ' ' if !empty( hOptions ) - hEval( hOptions, { |key,value,pos| cVal += HtmlOption( hOptions, key,,, .t. ) + cSep } ) + hEval( hOptions, { |k| cVal += HtmlOption( hOptions, k,,, .t. ) + cSep } ) endif return cVal @@ -540,7 +519,7 @@ STATIC FUNCTION HtmlAllValue( hValues, cSep ) DEFAULT cSep TO ' ' if !empty( hValues ) - hEval( hValues, { |key,value,pos| cVal += HtmlValue( hValues, key ) + cSep } ) + hEval( hValues, { |k| cVal += HtmlValue( hValues, k ) + cSep } ) endif return cVal diff --git a/harbour/contrib/tip/ftpcln.prg b/harbour/contrib/tip/ftpcln.prg index 0036e42334..ff298c86fb 100644 --- a/harbour/contrib/tip/ftpcln.prg +++ b/harbour/contrib/tip/ftpcln.prg @@ -344,8 +344,6 @@ RETURN NIL METHOD Stor( cFile ) CLASS tIPClientFTP - LOCAL nTimeout - IF ::bUsePasv IF .not. ::Pasv() //::bUsePasv := .F. @@ -463,8 +461,7 @@ METHOD Write( cData, nLen ) CLASS tIPClientFTP RETURN ::super:Write( cData, nLen, .F. ) -METHOD Retr( cFile,cLocalFile ) CLASS tIPClientFTP - LOCAL nTimeout,cRet +METHOD Retr( cFile ) CLASS tIPClientFTP IF ::bUsePasv IF .not. ::Pasv() @@ -541,7 +538,7 @@ RETURN lRet METHOD LS( cSpec ) CLASS tIPClientFTP - LOCAL cStr,cfile,x,y + LOCAL cStr IF cSpec == nil cSpec := '' @@ -580,7 +577,6 @@ METHOD Rename( cFrom, cTo ) CLASS tIPClientFTP Return lResult METHOD DownLoadFile( cLocalFile, cRemoteFile ) CLASS tIPClientFTP - LOCAL cFileData LOCAL lRet,xRet Local nHandle diff --git a/harbour/contrib/tip/httpcln.prg b/harbour/contrib/tip/httpcln.prg index c64c177a36..78a725b7a0 100644 --- a/harbour/contrib/tip/httpcln.prg +++ b/harbour/contrib/tip/httpcln.prg @@ -51,6 +51,7 @@ * */ +#include "common.ch" #include "hbclass.ch" #include "tip.ch" @@ -92,7 +93,7 @@ HIDDEN: ENDCLASS -METHOD New(lTrace) CLASS tIPClientHTTP +METHOD New() CLASS tIPClientHTTP ::nDefaultPort := 80 ::nConnTimeout := 5000 ::bChunked := .F. @@ -219,7 +220,7 @@ RETURN .T. METHOD ReadHeaders(lClear) CLASS tIPClientHTTP LOCAL cLine, nPos, aVersion - LOCAL aHead, aCookie, cCookie + LOCAL aHead // Now reads the fields and set the content lenght cLine := ::InetRecvLine( ::SocketCon, @nPos, 500 ) @@ -376,9 +377,8 @@ METHOD ReadAll() CLASS tIPClientHTTP METHOD setCookie(cLine) CLASS tIPClientHTTP //docs from http://www.ietf.org/rfc/rfc2109.txt - local aParam,cParam - local cCookie,aCookies - local cHost,cPath,cName,cValue,hHost,hPath, aElements, cElement + local aParam + local cHost,cPath,cName,cValue,aElements, cElement local cDefaultHost:=::oUrl:cServer, cDefaultPath:=::oUrl:cPath local x,y IF empty(cDefaultPath) @@ -424,7 +424,7 @@ return NIL METHOD getcookies(cHost,cPath) CLASS tIPClientHTTP local x,y,aDomKeys:={},aKeys,z,cKey,aPathKeys,nPath - local a,b,cOut:='',cX,cY,c,d + local a,b,cOut:='',c,d IF cHost=nil cHost:=::oUrl:cServer ENDIF diff --git a/harbour/contrib/tip/mail.prg b/harbour/contrib/tip/mail.prg index ce07c7d38e..5f3670d02d 100644 --- a/harbour/contrib/tip/mail.prg +++ b/harbour/contrib/tip/mail.prg @@ -51,6 +51,7 @@ * */ +#include "common.ch" #include "hbclass.ch" CLASS TipMail @@ -273,7 +274,6 @@ RETURN ::aAttachments[ ::nAttachPos ] METHOD ToString() CLASS TipMail LOCAL cBoundary, cElem, i - LOCAL oSubPart LOCAL cRet := "" // this is a multipart message; we need a boundary IF Len( ::aAttachments ) > 0 @@ -513,4 +513,4 @@ METHOD MakeBoundary() CLASS TipMail cBound += "_TIP_" + StrTran(Dtoc( Date() ),"/","") +; "_" + StrTran(Time(), ":", "" ) -RETURN cBound \ No newline at end of file +RETURN cBound diff --git a/harbour/contrib/tip/popcln.prg b/harbour/contrib/tip/popcln.prg index 464f2c0da3..e7eac59ebb 100644 --- a/harbour/contrib/tip/popcln.prg +++ b/harbour/contrib/tip/popcln.prg @@ -278,7 +278,7 @@ RETURN cRet METHOD Retreive( nId, nLen ) CLASS tIPClientPOP LOCAL nPos - LOCAL cStr, cRet, nRetLen, cBuffer, nRead + LOCAL cRet, nRetLen, cBuffer, nRead LOCAL cEOM := ::cCRLF + "." + ::cCRLF // End Of Mail IF .not. ::bInitialized