mirror of
https://github.com/reactos/wine.git
synced 2024-11-29 06:30:37 +00:00
cmd: Constify some function parameters.
This commit is contained in:
parent
bb47576f59
commit
ff501904a7
@ -291,7 +291,8 @@ void WCMD_splitpath(const WCHAR* path, WCHAR* drv, WCHAR* dir, WCHAR* name, WCHA
|
||||
* Hence search forwards until find an invalid modifier, and then
|
||||
* backwards until find for variable or 0-9
|
||||
*/
|
||||
void WCMD_HandleTildaModifiers(WCHAR **start, WCHAR *forVariable, WCHAR *forValue, BOOL justFors) {
|
||||
void WCMD_HandleTildaModifiers(WCHAR **start, const WCHAR *forVariable,
|
||||
const WCHAR *forValue, BOOL justFors) {
|
||||
|
||||
#define NUMMODIFIERS 11
|
||||
static const WCHAR validmodifiers[NUMMODIFIERS] = {
|
||||
|
@ -41,8 +41,9 @@
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(cmd);
|
||||
|
||||
static void WCMD_part_execute(CMD_LIST **commands, WCHAR *firstcmd, WCHAR *variable,
|
||||
WCHAR *value, BOOL isIF, BOOL conditionTRUE);
|
||||
static void WCMD_part_execute(CMD_LIST **commands, const WCHAR *firstcmd,
|
||||
const WCHAR *variable, const WCHAR *value,
|
||||
BOOL isIF, BOOL conditionTRUE);
|
||||
|
||||
struct env_stack *saved_environment;
|
||||
struct env_stack *pushd_directories;
|
||||
@ -77,7 +78,8 @@ static const WCHAR nullW[] = {'\0'};
|
||||
* set to TRUE
|
||||
*
|
||||
*/
|
||||
static BOOL WCMD_ask_confirm (WCHAR *message, BOOL showSureText, BOOL *optionAll) {
|
||||
static BOOL WCMD_ask_confirm (const WCHAR *message, BOOL showSureText,
|
||||
const BOOL *optionAll) {
|
||||
|
||||
WCHAR msgbuffer[MAXSTRING];
|
||||
WCHAR Ybuffer[MAXSTRING];
|
||||
@ -164,7 +166,7 @@ void WCMD_change_tty (void) {
|
||||
*
|
||||
*/
|
||||
|
||||
void WCMD_choice (WCHAR * command) {
|
||||
void WCMD_choice (const WCHAR * command) {
|
||||
|
||||
static const WCHAR bellW[] = {7,0};
|
||||
static const WCHAR commaW[] = {',',0};
|
||||
@ -186,7 +188,7 @@ void WCMD_choice (WCHAR * command) {
|
||||
have_console = GetConsoleMode(GetStdHandle(STD_INPUT_HANDLE), &oldmode);
|
||||
errorlevel = 0;
|
||||
|
||||
my_command = WCMD_strdupW(WCMD_skip_leading_spaces(command));
|
||||
my_command = WCMD_strdupW(WCMD_skip_leading_spaces((WCHAR*) command));
|
||||
if (!my_command)
|
||||
return;
|
||||
|
||||
@ -587,7 +589,7 @@ static void WCMD_delete_parse_attributes(DWORD *wantSet, DWORD *wantClear) {
|
||||
* *pPrompted is set to TRUE if the user is prompted.
|
||||
* (If /P supplied, del will prompt for individual files later.)
|
||||
*/
|
||||
static BOOL WCMD_delete_confirm_wildcard(WCHAR *filename, BOOL *pPrompted) {
|
||||
static BOOL WCMD_delete_confirm_wildcard(const WCHAR *filename, BOOL *pPrompted) {
|
||||
static const WCHAR parmP[] = {'/','P','\0'};
|
||||
static const WCHAR parmQ[] = {'/','Q','\0'};
|
||||
|
||||
@ -627,7 +629,7 @@ static BOOL WCMD_delete_confirm_wildcard(WCHAR *filename, BOOL *pPrompted) {
|
||||
* If /S was given, does it recursively.
|
||||
* Returns TRUE if a file was deleted.
|
||||
*/
|
||||
static BOOL WCMD_delete_one (WCHAR *thisArg) {
|
||||
static BOOL WCMD_delete_one (const WCHAR *thisArg) {
|
||||
|
||||
static const WCHAR parmP[] = {'/','P','\0'};
|
||||
static const WCHAR parmS[] = {'/','S','\0'};
|
||||
@ -1215,8 +1217,9 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
|
||||
* first command to be executed may not be at the front of the
|
||||
* commands->thiscommand string (eg. it may point after a DO or ELSE)
|
||||
*/
|
||||
void WCMD_part_execute(CMD_LIST **cmdList, WCHAR *firstcmd, WCHAR *variable,
|
||||
WCHAR *value, BOOL isIF, BOOL conditionTRUE) {
|
||||
static void WCMD_part_execute(CMD_LIST **cmdList, const WCHAR *firstcmd,
|
||||
const WCHAR *variable, const WCHAR *value,
|
||||
BOOL isIF, BOOL conditionTRUE) {
|
||||
|
||||
CMD_LIST *curPosition = *cmdList;
|
||||
int myDepth = (*cmdList)->bracketDepth;
|
||||
@ -1311,11 +1314,11 @@ void WCMD_part_execute(CMD_LIST **cmdList, WCHAR *firstcmd, WCHAR *variable,
|
||||
* Simple on-line help. Help text is stored in the resource file.
|
||||
*/
|
||||
|
||||
void WCMD_give_help (WCHAR *command) {
|
||||
void WCMD_give_help (const WCHAR *command) {
|
||||
|
||||
int i;
|
||||
|
||||
command = WCMD_skip_leading_spaces(command);
|
||||
command = WCMD_skip_leading_spaces((WCHAR*) command);
|
||||
if (strlenW(command) == 0) {
|
||||
WCMD_output_asis (WCMD_LoadMessage(WCMD_ALLHELP));
|
||||
}
|
||||
@ -2077,7 +2080,7 @@ void WCMD_setshow_attrib (void) {
|
||||
* Set/Show the current default directory
|
||||
*/
|
||||
|
||||
void WCMD_setshow_default (WCHAR *command) {
|
||||
void WCMD_setshow_default (const WCHAR *command) {
|
||||
|
||||
BOOL status;
|
||||
WCHAR string[1024];
|
||||
@ -2361,7 +2364,7 @@ void WCMD_setshow_env (WCHAR *s) {
|
||||
* Set/Show the path environment variable
|
||||
*/
|
||||
|
||||
void WCMD_setshow_path (WCHAR *command) {
|
||||
void WCMD_setshow_path (const WCHAR *command) {
|
||||
|
||||
WCHAR string[1024];
|
||||
DWORD status;
|
||||
@ -2452,7 +2455,7 @@ void WCMD_setshow_time (void) {
|
||||
* Optional /n says where to start shifting (n=0-8)
|
||||
*/
|
||||
|
||||
void WCMD_shift (WCHAR *command) {
|
||||
void WCMD_shift (const WCHAR *command) {
|
||||
int start;
|
||||
|
||||
if (context != NULL) {
|
||||
@ -2483,7 +2486,7 @@ void WCMD_shift (WCHAR *command) {
|
||||
*
|
||||
* Set the console title
|
||||
*/
|
||||
void WCMD_title (WCHAR *command) {
|
||||
void WCMD_title (const WCHAR *command) {
|
||||
SetConsoleTitleW(command);
|
||||
}
|
||||
|
||||
@ -2663,7 +2666,7 @@ void WCMD_more (WCHAR *command) {
|
||||
* it...
|
||||
*/
|
||||
|
||||
void WCMD_verify (WCHAR *command) {
|
||||
void WCMD_verify (const WCHAR *command) {
|
||||
|
||||
int count;
|
||||
|
||||
@ -2702,7 +2705,7 @@ void WCMD_version (void) {
|
||||
* Display volume info and/or set volume label. Returns 0 if error.
|
||||
*/
|
||||
|
||||
int WCMD_volume (int mode, WCHAR *path) {
|
||||
int WCMD_volume (int mode, const WCHAR *path) {
|
||||
|
||||
DWORD count, serial;
|
||||
WCHAR string[MAX_PATH], label[MAX_PATH], curdir[MAX_PATH];
|
||||
@ -2780,7 +2783,7 @@ void WCMD_exit (CMD_LIST **cmdList) {
|
||||
* Lists or sets file associations (assoc = TRUE)
|
||||
* Lists or sets file types (assoc = FALSE)
|
||||
*/
|
||||
void WCMD_assoc (WCHAR *command, BOOL assoc) {
|
||||
void WCMD_assoc (const WCHAR *command, BOOL assoc) {
|
||||
|
||||
HKEY key;
|
||||
DWORD accessOptions = KEY_READ;
|
||||
|
@ -283,7 +283,7 @@ cleanup:
|
||||
HeapFree(GetProcessHeap(), 0, (LPVOID)actual_cmd_data);
|
||||
}
|
||||
|
||||
static void run_from_file(char *file_name)
|
||||
static void run_from_file(const char *file_name)
|
||||
{
|
||||
char out_name[MAX_PATH];
|
||||
const char *test_data, *out_data;
|
||||
|
@ -48,11 +48,11 @@ typedef struct _CMD_LIST {
|
||||
WCHAR pipeFile[MAX_PATH]; /* Where to get input from for pipes */
|
||||
} CMD_LIST;
|
||||
|
||||
void WCMD_assoc (WCHAR *, BOOL);
|
||||
void WCMD_assoc (const WCHAR *, BOOL);
|
||||
void WCMD_batch (WCHAR *, WCHAR *, int, WCHAR *, HANDLE);
|
||||
void WCMD_call (WCHAR *command);
|
||||
void WCMD_change_tty (void);
|
||||
void WCMD_choice (WCHAR *);
|
||||
void WCMD_choice (const WCHAR *);
|
||||
void WCMD_clear_screen (void);
|
||||
void WCMD_color (void);
|
||||
void WCMD_copy (void);
|
||||
@ -64,7 +64,7 @@ void WCMD_endlocal (void);
|
||||
void WCMD_enter_paged_mode(const WCHAR *);
|
||||
void WCMD_exit (CMD_LIST **cmdList);
|
||||
void WCMD_for (WCHAR *, CMD_LIST **cmdList);
|
||||
void WCMD_give_help (WCHAR *command);
|
||||
void WCMD_give_help (const WCHAR *command);
|
||||
void WCMD_goto (CMD_LIST **cmdList);
|
||||
void WCMD_if (WCHAR *, CMD_LIST **cmdList);
|
||||
void WCMD_leave_paged_mode(void);
|
||||
@ -82,36 +82,38 @@ void WCMD_run_program (WCHAR *command, int called);
|
||||
void WCMD_setlocal (const WCHAR *command);
|
||||
void WCMD_setshow_attrib (void);
|
||||
void WCMD_setshow_date (void);
|
||||
void WCMD_setshow_default (WCHAR *command);
|
||||
void WCMD_setshow_default (const WCHAR *command);
|
||||
void WCMD_setshow_env (WCHAR *command);
|
||||
void WCMD_setshow_path (WCHAR *command);
|
||||
void WCMD_setshow_path (const WCHAR *command);
|
||||
void WCMD_setshow_prompt (void);
|
||||
void WCMD_setshow_time (void);
|
||||
void WCMD_shift (WCHAR *command);
|
||||
void WCMD_title (WCHAR *);
|
||||
void WCMD_shift (const WCHAR *command);
|
||||
void WCMD_title (const WCHAR *);
|
||||
void WCMD_type (WCHAR *);
|
||||
void WCMD_verify (WCHAR *command);
|
||||
void WCMD_verify (const WCHAR *command);
|
||||
void WCMD_version (void);
|
||||
int WCMD_volume (int mode, WCHAR *command);
|
||||
int WCMD_volume (int mode, const WCHAR *command);
|
||||
|
||||
WCHAR *WCMD_fgets (WCHAR *s, int n, HANDLE stream);
|
||||
WCHAR *WCMD_parameter (WCHAR *s, int n, WCHAR **where);
|
||||
WCHAR *WCMD_skip_leading_spaces (WCHAR *string);
|
||||
void WCMD_HandleTildaModifiers(WCHAR **start, WCHAR *forVariable, WCHAR *forValue, BOOL justFors);
|
||||
void WCMD_HandleTildaModifiers(WCHAR **start, const WCHAR *forVariable, const WCHAR *forValue, BOOL justFors);
|
||||
|
||||
void WCMD_splitpath(const WCHAR* path, WCHAR* drv, WCHAR* dir, WCHAR* name, WCHAR* ext);
|
||||
void WCMD_opt_s_strip_quotes(WCHAR *cmd);
|
||||
WCHAR *WCMD_LoadMessage(UINT id);
|
||||
WCHAR *WCMD_strdupW(WCHAR *input);
|
||||
void WCMD_strsubstW(WCHAR *start, WCHAR* next, WCHAR* insert, int len);
|
||||
WCHAR *WCMD_strdupW(const WCHAR *input);
|
||||
void WCMD_strsubstW(WCHAR *start, const WCHAR* next, const WCHAR* insert, int len);
|
||||
BOOL WCMD_ReadFile(const HANDLE hIn, WCHAR *intoBuf, const DWORD maxChars,
|
||||
LPDWORD charsRead, const LPOVERLAPPED unused);
|
||||
|
||||
WCHAR *WCMD_ReadAndParseLine(WCHAR *initialcmd, CMD_LIST **output, HANDLE readFrom);
|
||||
CMD_LIST *WCMD_process_commands(CMD_LIST *thisCmd, BOOL oneBracket, WCHAR *var, WCHAR *val);
|
||||
WCHAR *WCMD_ReadAndParseLine(const WCHAR *initialcmd, CMD_LIST **output, HANDLE readFrom);
|
||||
CMD_LIST *WCMD_process_commands(CMD_LIST *thisCmd, BOOL oneBracket,
|
||||
const WCHAR *var, const WCHAR *val);
|
||||
void WCMD_free_commands(CMD_LIST *cmds);
|
||||
void WCMD_execute (WCHAR *orig_command, WCHAR *redirects, WCHAR *parameter,
|
||||
WCHAR *substitution, CMD_LIST **cmdList);
|
||||
void WCMD_execute (const WCHAR *orig_command, const WCHAR *redirects,
|
||||
const WCHAR *parameter, const WCHAR *substitution,
|
||||
CMD_LIST **cmdList);
|
||||
|
||||
/* Data structure to hold context when executing batch files */
|
||||
|
||||
|
@ -417,7 +417,7 @@ static void WCMD_show_prompt (void) {
|
||||
* WCMD_strdupW
|
||||
* A wide version of strdup as its missing from unicode.h
|
||||
*/
|
||||
WCHAR *WCMD_strdupW(WCHAR *input) {
|
||||
WCHAR *WCMD_strdupW(const WCHAR *input) {
|
||||
int len=strlenW(input)+1;
|
||||
WCHAR *result = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
|
||||
memcpy(result, input, len * sizeof(WCHAR));
|
||||
@ -430,7 +430,7 @@ WCHAR *WCMD_strdupW(WCHAR *input) {
|
||||
* It's up to the caller to ensure there is enough space in the
|
||||
* destination buffer.
|
||||
*/
|
||||
void WCMD_strsubstW(WCHAR* start, WCHAR* next, WCHAR* insert, int len) {
|
||||
void WCMD_strsubstW(WCHAR *start, const WCHAR *next, const WCHAR *insert, int len) {
|
||||
|
||||
if (len < 0)
|
||||
len=insert ? lstrlenW(insert) : 0;
|
||||
@ -511,7 +511,8 @@ static inline BOOL WCMD_is_magic_envvar(const WCHAR *s, const WCHAR *magicvar)
|
||||
*
|
||||
* Expands environment variables, allowing for WCHARacter substitution
|
||||
*/
|
||||
static WCHAR *WCMD_expand_envvar(WCHAR *start, WCHAR *forVar, WCHAR *forVal) {
|
||||
static WCHAR *WCMD_expand_envvar(WCHAR *start,
|
||||
const WCHAR *forVar, const WCHAR *forVal) {
|
||||
WCHAR *endOfVar = NULL, *s;
|
||||
WCHAR *colonpos = NULL;
|
||||
WCHAR thisVar[MAXSTRING];
|
||||
@ -765,7 +766,8 @@ static WCHAR *WCMD_expand_envvar(WCHAR *start, WCHAR *forVar, WCHAR *forVal) {
|
||||
* read in and not again, except for 'for' variable substitution.
|
||||
* eg. As evidence, "echo %1 && shift && echo %1" or "echo %%path%%"
|
||||
*/
|
||||
static void handleExpansion(WCHAR *cmd, BOOL justFors, WCHAR *forVariable, WCHAR *forValue) {
|
||||
static void handleExpansion(WCHAR *cmd, BOOL justFors,
|
||||
const WCHAR *forVariable, const WCHAR *forValue) {
|
||||
|
||||
/* For commands in a context (batch program): */
|
||||
/* Expand environment variables in a batch file %{0-9} first */
|
||||
@ -841,7 +843,7 @@ static void handleExpansion(WCHAR *cmd, BOOL justFors, WCHAR *forVariable, WCHAR
|
||||
* second in p2. Any subsequent non-qualifier strings are lost.
|
||||
* Parameters in quotes are handled.
|
||||
*/
|
||||
static void WCMD_parse (WCHAR *s, WCHAR *q, WCHAR *p1, WCHAR *p2)
|
||||
static void WCMD_parse (const WCHAR *s, WCHAR *q, WCHAR *p1, WCHAR *p2)
|
||||
{
|
||||
int p = 0;
|
||||
|
||||
@ -1191,8 +1193,8 @@ void WCMD_run_program (WCHAR *command, int called) {
|
||||
* Process one command. If the command is EXIT this routine does not return.
|
||||
* We will recurse through here executing batch files.
|
||||
*/
|
||||
void WCMD_execute (WCHAR *command, WCHAR *redirects,
|
||||
WCHAR *forVariable, WCHAR *forValue,
|
||||
void WCMD_execute (const WCHAR *command, const WCHAR *redirects,
|
||||
const WCHAR *forVariable, const WCHAR *forValue,
|
||||
CMD_LIST **cmdList)
|
||||
{
|
||||
WCHAR *cmd, *p, *redir;
|
||||
@ -1673,7 +1675,7 @@ static void WCMD_addCommand(WCHAR *command, int *commandLen,
|
||||
* Returns TRUE if this is an end quote, and FALSE if it is not.
|
||||
*
|
||||
*/
|
||||
static BOOL WCMD_IsEndQuote(WCHAR *quote, int quoteIndex)
|
||||
static BOOL WCMD_IsEndQuote(const WCHAR *quote, int quoteIndex)
|
||||
{
|
||||
int quoteCount = quoteIndex;
|
||||
int i;
|
||||
@ -1725,7 +1727,7 @@ static BOOL WCMD_IsEndQuote(WCHAR *quote, int quoteIndex)
|
||||
* - Anything else gets put into the command string (including
|
||||
* redirects)
|
||||
*/
|
||||
WCHAR *WCMD_ReadAndParseLine(WCHAR *optionalcmd, CMD_LIST **output, HANDLE readFrom) {
|
||||
WCHAR *WCMD_ReadAndParseLine(const WCHAR *optionalcmd, CMD_LIST **output, HANDLE readFrom) {
|
||||
|
||||
WCHAR *curPos;
|
||||
int inQuotes = 0;
|
||||
@ -2156,7 +2158,7 @@ WCHAR *WCMD_ReadAndParseLine(WCHAR *optionalcmd, CMD_LIST **output, HANDLE readF
|
||||
* Process all the commands read in so far
|
||||
*/
|
||||
CMD_LIST *WCMD_process_commands(CMD_LIST *thisCmd, BOOL oneBracket,
|
||||
WCHAR *var, WCHAR *val) {
|
||||
const WCHAR *var, const WCHAR *val) {
|
||||
|
||||
int bdepth = -1;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user