Skip to content

Commit

Permalink
vi: correct mistake in strings assignment
Browse files Browse the repository at this point in the history
remove some useless code
  • Loading branch information
jmalak committed Aug 5, 2024
1 parent 924f609 commit b3545fc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
6 changes: 4 additions & 2 deletions bld/vi/win/ctl/setfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,12 @@ static void fs_set( void *dlg, ctl_elt *ctl, void *data )
((dlg_data *)dlg)->ShowMatch = *(bool *)data;
break;
case SETFS_TAGS_FILENAME:
((dlg_data *)dlg)->TagFileName = *(char **)data;
strncpy( ((dlg_data *)dlg)->TagFileName, *(char **)data, TAGFILENAMEWIDTH - 1 );
((dlg_data *)dlg)->TagFileName[TAGFILENAMEWIDTH - 1] = '\0';
break;
case SETFS_MISC_GREP:
((dlg_data *)dlg)->GrepDefault = *(char **)data;
strncpy( ((dlg_data *)dlg)->GrepDefault, *(char **)data, GREPDEFAULTWIDTH - 1 );
((dlg_data *)dlg)->GrepDefault[GREPDEFAULTWIDTH - 1] = '\0';
break;
}
}
Expand Down
5 changes: 2 additions & 3 deletions bld/vi/win/linedlg.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
*
* Open Watcom Project
*
* Copyright (c) 2002-2019 The Open Watcom Contributors. All Rights Reserved.
* Copyright (c) 2002-2024 The Open Watcom Contributors. All Rights Reserved.
* Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
*
* ========================================================================
Expand Down Expand Up @@ -40,7 +40,6 @@
WINEXPORT INT_PTR CALLBACK GotoLineDlgProc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam );

static char lineStr[20];
static char lineLen = sizeof( lineStr ) - 1;
static linenum *lineVal;

/*
Expand All @@ -63,7 +62,7 @@ WINEXPORT INT_PTR CALLBACK GotoLineDlgProc( HWND hwnd, UINT msg, WPARAM wparam,
EndDialog( hwnd, FALSE );
break;
case IDOK:
GetDlgItemText( hwnd, GOTOLINE_EDIT, lineStr, lineLen );
GetDlgItemText( hwnd, GOTOLINE_EDIT, lineStr, sizeof( lineStr ) );
*lineVal = atol( lineStr );
if( *lineVal > 0 ) {
EndDialog( hwnd, TRUE );
Expand Down
10 changes: 5 additions & 5 deletions bld/vi/win/snoop.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
*
* Open Watcom Project
*
* Copyright (c) 2002-2021 The Open Watcom Contributors. All Rights Reserved.
* Copyright (c) 2002-2024 The Open Watcom Contributors. All Rights Reserved.
* Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
*
* ========================================================================
Expand Down Expand Up @@ -142,7 +142,7 @@ WINEXPORT INT_PTR CALLBACK SnoopDlgProc( HWND hwnd, UINT msg, WPARAM wparam, LPA
bi.lpszTitle = buffer1;
bi.ulFlags = BIF_RETURNONLYFSDIRS;
bi.lpfn = BrowseCallbackProc;
GetDlgItemText( hwnd, SNOOP_PATH, buffer2, MAX_PATH );
GetDlgItemText( hwnd, SNOOP_PATH, buffer2, sizeof( buffer2 ) );
bi.lParam = (LPARAM)buffer2;
if( (pidl = pfnSHBrowseForFolder( &bi )) != NULL ) {
if( pfnSHGetPathFromIDList( pidl, buffer1 ) ) {
Expand All @@ -156,11 +156,11 @@ WINEXPORT INT_PTR CALLBACK SnoopDlgProc( HWND hwnd, UINT msg, WPARAM wparam, LPA
EndDialog( hwnd, FALSE );
break;
case IDOK:
GetDlgItemText( hwnd, SNOOP_STRING, snoop, MAX_INPUT_LINE );
GetDlgItemText( hwnd, SNOOP_STRING, snoop, sizeof( snoop ) );
ReplaceString( &snoopData.find, snoop );
GetDlgItemText( hwnd, SNOOP_EXT, snoop, MAX_INPUT_LINE );
GetDlgItemText( hwnd, SNOOP_EXT, snoop, sizeof( snoop ) );
ReplaceString( &snoopData.ext, snoop );
GetDlgItemText( hwnd, SNOOP_PATH, snoop, MAX_INPUT_LINE );
GetDlgItemText( hwnd, SNOOP_PATH, snoop, sizeof( snoop ) );
ReplaceString( &snoopData.path, snoop );
snoopData.case_ignore = IsDlgButtonChecked( hwnd, SNOOP_IGNORE_CASE );
snoopData.use_regexp = IsDlgButtonChecked( hwnd, SNOOP_REGULAR_EXPRESSIONS );
Expand Down

0 comments on commit b3545fc

Please sign in to comment.