Warning under 64 Bit MSVC but none unde BCC 32 Bit

Warning under 64 Bit MSVC but none unde BCC 32 Bit

Postby Jimmy » Sun Apr 09, 2023 5:00 am

hi,

i got a Warning when compile under 64 Bit using MSVC
HB_FUNC.PRG(1597): warning C4189: "pStr": Lokale Variable ist initialisiert aber nicht referenziert

'Local variable is initialized but not referenced'
'La variable local se inicializa pero no se hace referencia'
'La variable locale est initialisée mais non référencée'
'A variável local é inicializada, mas não referenciada'
'Lokale Variable ist initialisiert aber nicht referenziert'
'La variabile locale è inizializzata ma non referenziata'


Code: Select all  Expand view
HB_FUNC( FINDREPLACEDLGGETOPTIONS )
{
   #ifndef _WIN64
      LPARAM lParam = (LPARAM) hb_parnl (1);
   #else
      LPARAM lParam = (LPARAM) hb_parnll (1);
   #endif
   FINDREPLACE *FR = (FINDREPLACE *) lParam;
1596   LONG nRet = -1;
1597   LPSTR pStr;
1598
   if ( FR->Flags & FR_DIALOGTERM )
       nRet =  0;

   if ( FR->Flags & FR_FINDNEXT )
       nRet =  1;

   if ( FR->Flags & FR_REPLACE )
       nRet =  2;

   if ( FR->Flags & FR_REPLACEALL )
       nRet =  3;

   hb_reta (6);

   hb_storvnl ( (LONG) nRet,                       -1,  1 );

   #ifndef UNICODE
      hb_storvc (  FR->lpstrFindWhat,              -1,  2 );
      hb_storvc (  FR->lpstrReplaceWith,           -1,  3 );
   #else
1619      pStr = WideToAnsi( FR->lpstrFindWhat );
1620      hb_storvc (  pStr,                           -1,  2 );
1621      pStr = WideToAnsi( FR->lpstrReplaceWith );
1622      hb_storvc (  pStr,                           -1,  3 );
   #endif

   hb_storvl  ( (BOOL) (FR->Flags & FR_DOWN),      -1,  4 );
   hb_storvl  ( (BOOL) (FR->Flags & FR_MATCHCASE), -1,  5 );
   hb_storvl  ( (BOOL) (FR->Flags & FR_WHOLEWORD), -1,  6 );
}

how can i get rid of this Warning :?:
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1725
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: Warning under 64 Bit MSVC but none unde BCC 32 Bit

Postby Antonio Linares » Sun Apr 09, 2023 6:26 am

Dear Jimmy,

Remove this line:
LPSTR pStr;

and place it here:
Code: Select all  Expand view
  #else
   {  // new
      LPSTR pStr = WideToAnsi( FR->lpstrFindWhat );  // modified
      hb_storvc (  pStr,                           -1,  2 );
      pStr = WideToAnsi( FR->lpstrReplaceWith );
      hb_storvc (  pStr,                           -1,  3 );
   }  // new
   #endif
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Warning under 64 Bit MSVC but none unde BCC 32 Bit

Postby Jimmy » Sun Apr 09, 2023 6:49 am

Antonio Linares wrote:Dear Jimmy,

Remove this line:
LPSTR pStr;

and place it here:
[code=fw]   #else

ah, understand
thx for Tip
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1725
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 65 guests