2010-01-24 23:46 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbwin/win_prn1.c
* contrib/hbwin/win_tprn.prg
* win_CheckPrnDrvFormat(): Replaced error strings with
error codes to avoid storing fixed language messages in
low-level code.
! Fixed MSVC warning about potentially uninitialized variable.
This commit is contained in:
@@ -17,6 +17,14 @@
|
||||
past entries belonging to author(s): Viktor Szakats.
|
||||
*/
|
||||
|
||||
2010-01-24 23:46 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* contrib/hbwin/win_prn1.c
|
||||
* contrib/hbwin/win_tprn.prg
|
||||
* win_CheckPrnDrvFormat(): Replaced error strings with
|
||||
error codes to avoid storing fixed language messages in
|
||||
low-level code.
|
||||
! Fixed MSVC warning about potentially uninitialized variable.
|
||||
|
||||
2010-01-24 23:18 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* contrib/hbwin/hbwin.ch
|
||||
* contrib/hbwin/win_prn1.c
|
||||
|
||||
@@ -575,7 +575,7 @@ HB_FUNC( WIN_LOADBITMAPFILE )
|
||||
#define CHECKPNGFORMAT 4120
|
||||
#endif
|
||||
|
||||
static HB_BOOL hbwin_CheckPrnDrvFormat( HDC hDC, int iType, const void * pImgBuf, ULONG ulSize, PHB_ITEM pItmErrMsg )
|
||||
static HB_BOOL hbwin_CheckPrnDrvFormat( HDC hDC, int iType, const void * pImgBuf, ULONG ulSize, int * piErrCode )
|
||||
{
|
||||
if( hDC && iType && pImgBuf && ulSize >= sizeof( BITMAPCOREHEADER ) )
|
||||
{
|
||||
@@ -585,47 +585,56 @@ static HB_BOOL hbwin_CheckPrnDrvFormat( HDC hDC, int iType, const void * pImgBuf
|
||||
{
|
||||
int iRes = iType = ( iType == HB_WIN_BITMAP_JPEG ? CHECKJPEGFORMAT : CHECKPNGFORMAT );
|
||||
|
||||
iRes = ExtEscape( hDC, QUERYESCSUPPORT, sizeof(iRes), ( LPCSTR ) &iRes, 0, 0 );
|
||||
iRes = ExtEscape( hDC, QUERYESCSUPPORT, sizeof( iRes ), ( LPCSTR ) &iRes, 0, 0 );
|
||||
if( iRes > 0 )
|
||||
{
|
||||
if( ExtEscape( hDC, iType, ulSize, ( LPCSTR ) pImgBuf, sizeof(iRes), ( LPSTR ) &iRes ) > 0 )
|
||||
if( ExtEscape( hDC, iType, ulSize, ( LPCSTR ) pImgBuf, sizeof( iRes ), ( LPSTR ) &iRes ) > 0 )
|
||||
{
|
||||
if( pItmErrMsg && iRes != 1 )
|
||||
hb_itemPutC( pItmErrMsg, "CHECKFORMAT failure" );
|
||||
|
||||
return iRes == 1;
|
||||
if( iRes == 1 )
|
||||
return HB_TRUE;
|
||||
else
|
||||
{
|
||||
if( piErrCode )
|
||||
*piErrCode = 4;
|
||||
return HB_FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( pItmErrMsg )
|
||||
hb_itemPutC( pItmErrMsg, "Invalid source devmode for ESCSUPPORT" );
|
||||
|
||||
if( piErrCode )
|
||||
*piErrCode = 3;
|
||||
return HB_FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( pItmErrMsg )
|
||||
hb_itemPutC( pItmErrMsg, "QUERYESCSUPPORT Not Implemented" );
|
||||
|
||||
if( piErrCode )
|
||||
*piErrCode = 2;
|
||||
return HB_FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( piErrCode )
|
||||
*piErrCode = 1;
|
||||
return HB_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
HB_FUNC( WIN_CHECKPRNDRVFORMAT )
|
||||
{
|
||||
const char * pImgBuf = hb_parc( 2 );
|
||||
int iErrCode = 0;
|
||||
|
||||
hb_retl( hbwin_CheckPrnDrvFormat( hbwapi_par_HDC( 1 ), hbwin_BitmapType( pImgBuf ), pImgBuf, hb_parclen( 2 ), hb_param( 3, HB_IT_BYREF ) ) );
|
||||
hb_retl( hbwin_CheckPrnDrvFormat( hbwapi_par_HDC( 1 ), hbwin_BitmapType( pImgBuf ), pImgBuf, hb_parclen( 2 ), &iErrCode ) );
|
||||
|
||||
hb_storni( iErrCode, 3 );
|
||||
}
|
||||
|
||||
HB_FUNC( WIN_DRAWBITMAP )
|
||||
{
|
||||
BITMAPINFO * pbmi;
|
||||
BITMAPINFO * pbmi = NULL;
|
||||
BYTE * pBits = NULL;
|
||||
HDC hDC = hbwapi_par_HDC( 1 );
|
||||
ULONG ulSize = hb_parclen( 2 );
|
||||
|
||||
@@ -828,8 +828,8 @@ METHOD Draw( oPrn, aRectangle, aDimXY ) CLASS WIN_BMP // Pass a WIN_PRN object r
|
||||
ENDIF
|
||||
RETURN oPrn:DrawBitMap( Self )
|
||||
|
||||
METHOD CheckPrnDrvFormat( oPrn, cErrMsg ) CLASS WIN_BMP
|
||||
RETURN win_CheckPrnDrvFormat( oPrn:hPrinterDc, ::Bitmap, @cErrMsg )
|
||||
METHOD CheckPrnDrvFormat( oPrn, nErrCode ) CLASS WIN_BMP
|
||||
RETURN win_CheckPrnDrvFormat( oPrn:hPrinterDc, ::Bitmap, @nErrCode )
|
||||
|
||||
#ifdef HB_COMPAT_XPP
|
||||
|
||||
|
||||
Reference in New Issue
Block a user