FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Warning under 64 Bit MSVC but none unde BCC 32 Bit
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Warning under 64 Bit MSVC but none unde BCC 32 Bit
Posted: Sun Apr 09, 2023 05: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 (fw): Select all Collapse
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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Warning under 64 Bit MSVC but none unde BCC 32 Bit
Posted: Sun Apr 09, 2023 06:26 AM
Dear Jimmy,

Remove this line:
LPSTR pStr;

and place it here:
Code (fw): Select all Collapse
   #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
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: Warning under 64 Bit MSVC but none unde BCC 32 Bit
Posted: Sun Apr 09, 2023 06: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

Continue the discussion