From 2c4d86c39251936fa10eb7b1cc0757b8ff0d65d7 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Wed, 7 Nov 2012 03:19:49 +0000 Subject: [PATCH] 2012-11-07 04:18 UTC+0100 Viktor Szakats (harbour syenar.net) * extras/httpsrv/cgifunc.prg * extras/httpsrv/modules/tableservletdb.prg * extras/httpsrv/session.prg * extras/httpsrv/uhttpd.hbp * extras/httpsrv/uhttpd.prg * extras/httpsrv/uhttpdgd.hbp * extras/rddado/adordd.prg * formatted ! some commented code converted to #if 0/#endif block --- harbour/ChangeLog | 11 +++ harbour/extras/httpsrv/cgifunc.prg | 64 ++----------- .../extras/httpsrv/modules/tableservletdb.prg | 8 +- harbour/extras/httpsrv/session.prg | 47 +--------- harbour/extras/httpsrv/uhttpd.hbp | 3 +- harbour/extras/httpsrv/uhttpd.prg | 94 +++++++++---------- harbour/extras/httpsrv/uhttpdgd.hbp | 2 +- harbour/extras/rddado/adordd.prg | 24 +++-- 8 files changed, 91 insertions(+), 162 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index b4a6414854..be4e9cc325 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,17 @@ The license applies to all entries newer than 2009-04-28. */ +2012-11-07 04:18 UTC+0100 Viktor Szakats (harbour syenar.net) + * extras/httpsrv/cgifunc.prg + * extras/httpsrv/modules/tableservletdb.prg + * extras/httpsrv/session.prg + * extras/httpsrv/uhttpd.hbp + * extras/httpsrv/uhttpd.prg + * extras/httpsrv/uhttpdgd.hbp + * extras/rddado/adordd.prg + * formatted + ! some commented code converted to #if 0/#endif block + 2012-11-07 03:28 UTC+0100 Viktor Szakats (harbour syenar.net) * contrib/hbnf/hbnf.hbx * contrib/hbodbc/hbodbc.hbx diff --git a/harbour/extras/httpsrv/cgifunc.prg b/harbour/extras/httpsrv/cgifunc.prg index 1692fcb2af..5c76fd3f67 100644 --- a/harbour/extras/httpsrv/cgifunc.prg +++ b/harbour/extras/httpsrv/cgifunc.prg @@ -473,7 +473,7 @@ FUNCTION uhttpd_TimeDiffAsSeconds( dDateStart, dDateEnd, cTimeStart, cTimeEnd ) __defaultNIL( @dDateEnd, Date() ) __defaultNIL( @cTimeEnd, Time() ) - aRetVal := FT_ELAPSED( dDateStart, dDateEnd, cTimeStart, cTimeEnd ) + aRetVal := ft_Elapsed( dDateStart, dDateEnd, cTimeStart, cTimeEnd ) RETURN aRetVal[ 4, 2 ] @@ -497,8 +497,8 @@ FUNCTION uhttpd_OutputString( cString, aTranslate, lProtected ) FUNCTION uhttpd_HtmlSpecialChars( cString, cQuote_style ) LOCAL aTranslations := { ; - { '&', '&' },; - { '<', '<' },; + { '&', '&' }, ; + { '<', '<' }, ; { '>', '>' } ; } @@ -693,50 +693,6 @@ PROCEDURE uhttpd_Die( cError ) FUNCTION uhttpd_HTMLSpace( n ) RETURN Replicate( " ", n ) // " " -/* FROM FT LIB */ -STATIC FUNCTION FT_ELAPSED( dStart, dEnd, cTimeStart, cTimeEnd ) - - LOCAL nTotalSec, nCtr, nConstant, nTemp, aRetVal[ 4, 2 ] - - IF HB_ISSTRING( dStart ) - cTimeStart := dStart - dStart := Date() - ELSEIF ! HB_ISDATE( dStart ) - dStart := Date() - ENDIF - - IF HB_ISSTRING( dEnd ) - cTimeEnd := dEnd - dEnd := Date() - ELSEIF ! HB_ISDATE( dEnd ) - dEnd := Date() - ENDIF - - iif( ! HB_ISSTRING( cTimeStart ), cTimeStart := '00:00:00', ) - iif( ! HB_ISSTRING( cTimeEnd ), cTimeEnd := '00:00:00', ) - - nTotalSec := ; - ( dEnd - dStart ) * 86400 + ; - Val( cTimeEnd ) * 3600 + ; - Val( SubStr( cTimeEnd, At( ':', cTimeEnd ) + 1, 2 ) ) * 60 + ; - iif( RAt( ':', cTimeEnd ) == At( ':', cTimeEnd ), 0, ; - Val( SubStr( cTimeEnd, RAt( ':', cTimeEnd ) + 1 ) ) ) - ; - Val( cTimeStart ) * 3600 - ; - Val( SubStr( cTimeStart, At( ':', cTimeStart ) + 1, 2 ) ) * 60 - ; - iif( RAt( ':', cTimeStart ) == At( ':', cTimeStart ), 0, ; - Val( SubStr( cTimeStart, RAt( ':', cTimeStart ) + 1 ) ) ) - - nTemp := nTotalSec - - FOR nCtr := 1 TO 4 - nConstant := iif( nCtr == 1, 86400, iif( nCtr == 2, 3600, iif( nCtr == 3, 60, 1 ) ) ) - aRetVal[ nCtr, 1 ] := Int( nTemp / nConstant ) - aRetval[ nCtr, 2 ] := nTotalSec / nConstant - nTemp -= aRetVal[ nCtr, 1 ] * nConstant - NEXT - - RETURN aRetVal - PROCEDURE uhttpd_WriteToLogFile( cString, cLog, lCreate ) LOCAL nHandle, cSep @@ -777,13 +733,13 @@ FUNCTION uhttpd_SplitFileName( cFile ) hb_FNameSplit( cFile, @cPath, @cName, @cExt, @cDrive ) hFile := { ; - "FILE" => cFile,; - "DRIVE" => cDrive,; - "PATH" => cPath,; - "NAME" => cName,; - "EXT" => cExt,; - "FULLPATH" => NIL,; - "FULLNAME" => cName + cExt,; + "FILE" => cFile, ; + "DRIVE" => cDrive, ; + "PATH" => cPath, ; + "NAME" => cName, ; + "EXT" => cExt, ; + "FULLPATH" => NIL, ; + "FULLNAME" => cName + cExt, ; "UNC" => NIL ; } diff --git a/harbour/extras/httpsrv/modules/tableservletdb.prg b/harbour/extras/httpsrv/modules/tableservletdb.prg index 7568df9e16..4a428cce0a 100644 --- a/harbour/extras/httpsrv/modules/tableservletdb.prg +++ b/harbour/extras/httpsrv/modules/tableservletdb.prg @@ -368,9 +368,11 @@ METHOD xmlEncode( input ) CLASS TableManager CASE '>' out += ">" EXIT -// CASE ' ' -// out += " " -// EXIT +#if 0 + CASE ' ' + out += " " + EXIT +#endif CASE Chr( 9 ) // E'\t' CASE Chr( 13 ) // E'\r' CASE Chr( 10 ) // E'\n' diff --git a/harbour/extras/httpsrv/session.prg b/harbour/extras/httpsrv/session.prg index b60e91bf05..1b1e52d3e7 100644 --- a/harbour/extras/httpsrv/session.prg +++ b/harbour/extras/httpsrv/session.prg @@ -779,55 +779,10 @@ STATIC FUNCTION TimeDiffAsSeconds( dDateStart, dDateEnd, cTimeStart, cTimeEnd ) __defaultNIL( @dDateEnd, Date() ) __defaultNIL( @cTimeEnd, Time() ) - aRetVal := FT_ELAPSED( dDateStart, dDateEnd, cTimeStart, cTimeEnd ) + aRetVal := ft_Elapsed( dDateStart, dDateEnd, cTimeStart, cTimeEnd ) RETURN aRetVal[ 4, 2 ] - -// Nanforum ELAPSED -STATIC FUNCTION FT_ELAPSED( dStart, dEnd, cTimeStart, cTimeEnd ) - - LOCAL nTotalSec, nCtr, nConstant, nTemp, aRetVal[ 4, 2 ] - - IF HB_ISSTRING( dStart ) - cTimeStart := dStart - dStart := Date() - ELSEIF ! HB_ISDATE( dStart ) - dStart := Date() - ENDIF - - IF HB_ISSTRING( dEnd ) - cTimeEnd := dEnd - dEnd := Date() - ELSEIF ! HB_ISDATE( dEnd ) - dEnd := Date() - ENDIF - - iif( ! HB_ISSTRING( cTimeStart ), cTimeStart := '00:00:00', ) - iif( ! HB_ISSTRING( cTimeEnd ), cTimeEnd := '00:00:00', ) - - nTotalSec := ; - ( dEnd - dStart ) * 86400 + ; - Val( cTimeEnd ) * 3600 + ; - Val( SubStr( cTimeEnd, At( ':', cTimeEnd ) + 1, 2 ) ) * 60 + ; - iif( RAt( ':', cTimeEnd ) == At( ':', cTimeEnd ), 0, ; - Val( SubStr( cTimeEnd, RAt( ':', cTimeEnd ) + 1 ) ) ) - ; - Val( cTimeStart ) * 3600 - ; - Val( SubStr( cTimeStart, At( ':', cTimeStart ) + 1, 2 ) ) * 60 - ; - iif( RAt( ':', cTimeStart ) == At( ':', cTimeStart ), 0, ; - Val( SubStr( cTimeStart, RAt( ':', cTimeStart ) + 1 ) ) ) - - nTemp := nTotalSec - - FOR nCtr := 1 TO 4 - nConstant := iif( nCtr == 1, 86400, iif( nCtr == 2, 3600, iif( nCtr == 3, 60, 1 ) ) ) - aRetVal[ nCtr, 1 ] := Int( nTemp / nConstant ) - aRetval[ nCtr, 2 ] := nTotalSec / nConstant - nTemp -= aRetVal[ nCtr, 1 ] * nConstant - NEXT - - RETURN aRetVal - // ------------------------------ METHOD Encode() CLASS uhttpd_Session diff --git a/harbour/extras/httpsrv/uhttpd.hbp b/harbour/extras/httpsrv/uhttpd.hbp index 9f4c7f21f0..7a330a528b 100644 --- a/harbour/extras/httpsrv/uhttpd.hbp +++ b/harbour/extras/httpsrv/uhttpd.hbp @@ -4,4 +4,5 @@ -mt -gui uhttpd.prg cgifunc.prg cookie.prg session.prg --l{win}hbwin +hbwin.hbc +hbnf.hbc diff --git a/harbour/extras/httpsrv/uhttpd.prg b/harbour/extras/httpsrv/uhttpd.prg index eb37e001c9..d6bbae36c4 100644 --- a/harbour/extras/httpsrv/uhttpd.prg +++ b/harbour/extras/httpsrv/uhttpd.prg @@ -569,7 +569,7 @@ PROCEDURE Main( ... ) #ifdef __PLATFORM__WINDOWS // windows resource releasing - 1 millisecond wait - IF WIN_SYSREFRESH( 1 ) != 0 + IF win_SysRefresh( 1 ) != 0 EXIT ENDIF #endif @@ -694,7 +694,7 @@ STATIC FUNCTION AcceptConnections() #ifdef __PLATFORM__WINDOWS // releasing resources - IF WIN_SYSREFRESH( 1 ) != 0 + IF win_SysRefresh( 1 ) != 0 lQuitRequest := .T. ENDIF #endif @@ -849,7 +849,7 @@ STATIC FUNCTION ProcessConnection() #ifdef __PLATFORM__WINDOWS // releasing resources - IF WIN_SYSREFRESH( 1 ) != 0 + IF win_SysRefresh( 1 ) != 0 lQuitRequest := .T. EXIT ENDIF @@ -1010,7 +1010,7 @@ STATIC FUNCTION ServiceConnection() #ifdef __PLATFORM__WINDOWS // releasing resources - IF WIN_SYSREFRESH( 1 ) != 0 + IF win_SysRefresh( 1 ) != 0 lQuitRequest := .T. EXIT ENDIF @@ -2838,49 +2838,49 @@ STATIC FUNCTION LoadMimeTypes() // TODO: load mime types from file RETURN { ; - "css" => "text/css",; - "htm" => "text/html",; - "html" => "text/html",; - "txt" => "text/plain",; - "text" => "text/plain",; - "asc" => "text/plain",; - "c" => "text/plain",; - "h" => "text/plain",; - "cpp" => "text/plain",; - "hpp" => "text/plain",; - "log" => "text/plain",; - "rtf" => "text/rtf",; - "xml" => "text/xml",; - "xsl" => "text/xsl",; - "bmp" => "image/bmp",; - "gif" => "image/gif",; - "jpg" => "image/jpeg",; - "jpe" => "image/jpeg",; - "jpeg" => "image/jpeg",; - "png" => "image/png",; - "tif" => "image/tiff",; - "tiff" => "image/tiff",; - "djv" => "image/vnd.djvu",; - "djvu" => "image/vnd.djvu",; - "ico" => "image/x-icon",; - "xls" => "application/excel",; - "doc" => "application/msword",; - "pdf" => "application/pdf",; - "ps" => "application/postscript",; - "eps" => "application/postscript",; - "ppt" => "application/powerpoint",; - "bz2" => "application/x-bzip2",; - "gz" => "application/x-gzip",; - "tgz" => "application/x-gtar",; - "js" => "application/x-javascript",; - "tar" => "application/x-tar",; - "tex" => "application/x-tex",; - "zip" => "application/zip",; - "midi" => "audio/midi",; - "mp3" => "audio/mpeg",; - "wav" => "audio/x-wav",; - "qt" => "video/quicktime",; - "mov" => "video/quicktime",; + "css" => "text/css", ; + "htm" => "text/html", ; + "html" => "text/html", ; + "txt" => "text/plain", ; + "text" => "text/plain", ; + "asc" => "text/plain", ; + "c" => "text/plain", ; + "h" => "text/plain", ; + "cpp" => "text/plain", ; + "hpp" => "text/plain", ; + "log" => "text/plain", ; + "rtf" => "text/rtf", ; + "xml" => "text/xml", ; + "xsl" => "text/xsl", ; + "bmp" => "image/bmp", ; + "gif" => "image/gif", ; + "jpg" => "image/jpeg", ; + "jpe" => "image/jpeg", ; + "jpeg" => "image/jpeg", ; + "png" => "image/png", ; + "tif" => "image/tiff", ; + "tiff" => "image/tiff", ; + "djv" => "image/vnd.djvu", ; + "djvu" => "image/vnd.djvu", ; + "ico" => "image/x-icon", ; + "xls" => "application/excel", ; + "doc" => "application/msword", ; + "pdf" => "application/pdf", ; + "ps" => "application/postscript", ; + "eps" => "application/postscript", ; + "ppt" => "application/powerpoint", ; + "bz2" => "application/x-bzip2", ; + "gz" => "application/x-gzip", ; + "tgz" => "application/x-gtar", ; + "js" => "application/x-javascript", ; + "tar" => "application/x-tar", ; + "tex" => "application/x-tex", ; + "zip" => "application/zip", ; + "midi" => "audio/midi", ; + "mp3" => "audio/mpeg", ; + "wav" => "audio/x-wav", ; + "qt" => "video/quicktime", ; + "mov" => "video/quicktime", ; "avi" => "video/x-msvideo" } STATIC FUNCTION GT_notifier( nEvent, xParams ) diff --git a/harbour/extras/httpsrv/uhttpdgd.hbp b/harbour/extras/httpsrv/uhttpdgd.hbp index 3c62a4a3d7..bb11d68969 100644 --- a/harbour/extras/httpsrv/uhttpdgd.hbp +++ b/harbour/extras/httpsrv/uhttpdgd.hbp @@ -3,5 +3,5 @@ # @uhttpd.hbp + hbgd.hbc -DGD_SUPPORT -hbct.hbc diff --git a/harbour/extras/rddado/adordd.prg b/harbour/extras/rddado/adordd.prg index 349c770f87..c2e0b28ca3 100644 --- a/harbour/extras/rddado/adordd.prg +++ b/harbour/extras/rddado/adordd.prg @@ -144,8 +144,8 @@ STATIC FUNCTION ADO_CREATE( nWA, aOpenInfo ) LOCAL cUserName := hb_tokenGet( aOpenInfo[ UR_OI_NAME ], 5, ";" ) LOCAL cPassword := hb_tokenGet( aOpenInfo[ UR_OI_NAME ], 6, ";" ) - LOCAL oConnection := win_OleCreateObject( "ADODB.Connection" ) - LOCAL oCatalog := win_OleCreateObject( "ADOX.Catalog" ) + LOCAL oConnection := win_oleCreateObject( "ADODB.Connection" ) + LOCAL oCatalog := win_oleCreateObject( "ADOX.Catalog" ) LOCAL aWAData := USRRDD_AREADATA( nWA ) LOCAL oError, n @@ -279,7 +279,7 @@ STATIC FUNCTION ADO_OPEN( nWA, aOpenInfo ) ENDIF IF Empty( aOpenInfo[ UR_OI_CONNECT ] ) - aWAData[ WA_CONNECTION ] := win_OleCreateObject( "ADODB.Connection" ) + aWAData[ WA_CONNECTION ] := win_oleCreateObject( "ADODB.Connection" ) aWAData[ WA_TABLENAME ] := t_cTableName aWAData[ WA_QUERY ] := t_cQuery aWAData[ WA_USERNAME ] := t_cUserName @@ -335,7 +335,7 @@ STATIC FUNCTION ADO_OPEN( nWA, aOpenInfo ) ";DbName=" + aOpenInfo[ UR_OI_NAME ] ) ENDCASE ELSE - aWAData[ WA_CONNECTION ] := win_OleAuto() + aWAData[ WA_CONNECTION ] := win_oleAuto() aWAData[ WA_CONNECTION ]:__hObj := aOpenInfo[ UR_OI_CONNECT ] /* "ADODB.Connection" */ aWAData[ WA_TABLENAME ] := t_cTableName aWAData[ WA_QUERY ] := t_cQuery @@ -353,7 +353,7 @@ STATIC FUNCTION ADO_OPEN( nWA, aOpenInfo ) aWAData[ WA_QUERY ] := "SELECT * FROM " ENDIF - oRecordSet := win_OleCreateObject( "ADODB.Recordset" ) + oRecordSet := win_oleCreateObject( "ADODB.Recordset" ) IF oRecordSet == NIL oError := ErrorNew() @@ -377,7 +377,7 @@ STATIC FUNCTION ADO_OPEN( nWA, aOpenInfo ) ENDIF BEGIN SEQUENCE WITH {| oErr | Break( oErr ) } - aWAData[ WA_CATALOG ] := win_OleCreateObject( "ADOX.Catalog" ) + aWAData[ WA_CATALOG ] := win_oleCreateObject( "ADOX.Catalog" ) aWAData[ WA_CATALOG ]:ActiveConnection := aWAData[ WA_CONNECTION ] RECOVER END SEQUENCE @@ -1158,7 +1158,7 @@ STATIC FUNCTION ADO_ORDCREATE( nWA, aOrderCreateInfo ) BEGIN SEQUENCE WITH {| oErr | Break( oErr ) } IF aWAData[ WA_CATALOG ]:Tables( aWAData[ WA_TABLENAME ] ):Indexes == NIL .OR. ! lFound - oIndex := win_OleCreateObject( "ADOX.Index" ) + oIndex := win_oleCreateObject( "ADOX.Index" ) oIndex:Name := iif( ! Empty( aOrderCreateInfo[ UR_ORCR_TAGNAME ] ), aOrderCreateInfo[ UR_ORCR_TAGNAME ], aOrderCreateInfo[ UR_ORCR_CKEY ] ) oIndex:PrimaryKey := .F. oIndex:Unique := aOrderCreateInfo[ UR_ORCR_UNIQUE ] @@ -1213,7 +1213,8 @@ STATIC FUNCTION ADO_EVALBLOCK( nArea, bBlock, uResult ) RETURN HB_SUCCESS STATIC FUNCTION ADO_EXISTS( nRdd, cTable, cIndex, ulConnect ) -// LOCAL n + + // LOCAL n LOCAL lRet := HB_FAILURE LOCAL aRData := USRRDD_RDDDATA( nRDD ) @@ -1237,7 +1238,8 @@ STATIC FUNCTION ADO_EXISTS( nRdd, cTable, cIndex, ulConnect ) RETURN lRet STATIC FUNCTION ADO_DROP( nRdd, cTable, cIndex, ulConnect ) -// LOCAL n + + // LOCAL n LOCAL lRet := HB_FAILURE LOCAL aRData := USRRDD_RDDDATA( nRDD ) @@ -1491,7 +1493,9 @@ STATIC FUNCTION ADO_GETFIELDTYPE( nADOFieldType ) CASE nADOFieldType == adChapter CASE nADOFieldType == adVarNumeric -/* CASE nADOFieldType == adArray */ +#if 0 + CASE nADOFieldType == adArray +#endif CASE nADOFieldType == adBoolean nDBFFieldType := HB_FT_LOGICAL