cmd: Get rid of unused parameter in WCMD_ReadFile.

This commit is contained in:
Frédéric Delanoy 2011-09-28 14:41:22 +02:00 committed by Alexandre Julliard
parent d6f4f7308a
commit 29b57ca82d
4 changed files with 17 additions and 28 deletions

View File

@ -197,7 +197,7 @@ WCHAR *WCMD_fgets(WCHAR *s, int noChars, HANDLE h, BOOL is_console_handle)
/* TODO: More intelligent buffering for reading lines from files */
do {
status = WCMD_ReadFile (h, s, 1, &bytes, NULL);
status = WCMD_ReadFile(h, s, 1, &bytes);
if ((status == 0) || ((bytes == 0) && (s == p))) return NULL;
if (*s == '\n') bytes = 0;
else if (*s != '\r') {

View File

@ -115,8 +115,7 @@ static BOOL WCMD_ask_confirm (const WCHAR *message, BOOL showSureText,
WCMD_output_asis (Abuffer);
}
WCMD_output_asis (endBkt);
WCMD_ReadFile (GetStdHandle(STD_INPUT_HANDLE), answer,
sizeof(answer)/sizeof(WCHAR), &count, NULL);
WCMD_ReadFile(GetStdHandle(STD_INPUT_HANDLE), answer, sizeof(answer)/sizeof(WCHAR), &count);
answer[0] = toupperW(answer[0]);
}
@ -306,7 +305,7 @@ void WCMD_choice (const WCHAR * command) {
while (TRUE) {
/* FIXME: Add support for option /T */
WCMD_ReadFile(GetStdHandle(STD_INPUT_HANDLE), answer, 1, &count, NULL);
WCMD_ReadFile(GetStdHandle(STD_INPUT_HANDLE), answer, 1, &count);
if (!opt_s)
answer[0] = toupperW(answer[0]);
@ -1697,8 +1696,7 @@ void WCMD_pause (void) {
WCHAR string[32];
WCMD_output (anykey);
WCMD_ReadFile (GetStdHandle(STD_INPUT_HANDLE), string,
sizeof(string)/sizeof(WCHAR), &count, NULL);
WCMD_ReadFile(GetStdHandle(STD_INPUT_HANDLE), string, sizeof(string)/sizeof(WCHAR), &count);
}
/****************************************************************************
@ -2146,8 +2144,7 @@ void WCMD_setshow_date (void) {
WCMD_output (WCMD_LoadMessage(WCMD_CURRENTDATE), curdate);
if (strstrW (quals, parmT) == NULL) {
WCMD_output (WCMD_LoadMessage(WCMD_NEWDATE));
WCMD_ReadFile (GetStdHandle(STD_INPUT_HANDLE),
buffer, sizeof(buffer)/sizeof(WCHAR), &count, NULL);
WCMD_ReadFile(GetStdHandle(STD_INPUT_HANDLE), buffer, sizeof(buffer)/sizeof(WCHAR), &count);
if (count > 2) {
WCMD_output (WCMD_LoadMessage(WCMD_NYI));
}
@ -2265,8 +2262,7 @@ void WCMD_setshow_env (WCHAR *s) {
if (strlenW(p) != 0) WCMD_output(p);
/* Read the reply */
WCMD_ReadFile (GetStdHandle(STD_INPUT_HANDLE), string,
sizeof(string)/sizeof(WCHAR), &count, NULL);
WCMD_ReadFile(GetStdHandle(STD_INPUT_HANDLE), string, sizeof(string)/sizeof(WCHAR), &count);
if (count > 1) {
string[count-1] = '\0'; /* ReadFile output is not null-terminated! */
if (string[count-2] == '\r') string[count-2] = '\0'; /* Under Windoze we get CRLF! */
@ -2376,8 +2372,7 @@ void WCMD_setshow_time (void) {
WCMD_output (WCMD_LoadMessage(WCMD_CURRENTTIME), curtime);
if (strstrW (quals, parmT) == NULL) {
WCMD_output (WCMD_LoadMessage(WCMD_NEWTIME));
WCMD_ReadFile (GetStdHandle(STD_INPUT_HANDLE), buffer,
sizeof(buffer)/sizeof(WCHAR), &count, NULL);
WCMD_ReadFile(GetStdHandle(STD_INPUT_HANDLE), buffer, sizeof(buffer)/sizeof(WCHAR), &count);
if (count > 2) {
WCMD_output (WCMD_LoadMessage(WCMD_NYI));
}
@ -2474,7 +2469,7 @@ void WCMD_type (WCHAR *command) {
static const WCHAR fmt[] = {'\n','%','s','\n','\n','\0'};
WCMD_output(fmt, thisArg);
}
while (WCMD_ReadFile (h, buffer, sizeof(buffer)/sizeof(WCHAR) - 1, &count, NULL)) {
while (WCMD_ReadFile(h, buffer, sizeof(buffer)/sizeof(WCHAR) - 1, &count)) {
if (count == 0) break; /* ReadFile reports success on EOF! */
buffer[count] = 0;
WCMD_output_asis (buffer);
@ -2528,7 +2523,7 @@ void WCMD_more (WCHAR *command) {
wsprintfW(moreStrPage, moreFmt, moreStr);
WCMD_enter_paged_mode(moreStrPage);
while (WCMD_ReadFile (hstdin, buffer, (sizeof(buffer)/sizeof(WCHAR))-1, &count, NULL)) {
while (WCMD_ReadFile(hstdin, buffer, (sizeof(buffer)/sizeof(WCHAR))-1, &count)) {
if (count == 0) break; /* ReadFile reports success on EOF! */
buffer[count] = 0;
WCMD_output_asis (buffer);
@ -2559,8 +2554,7 @@ void WCMD_more (WCHAR *command) {
wsprintfW(moreStrPage, moreFmt2, moreStr, 100);
WCMD_leave_paged_mode();
WCMD_output_asis(moreStrPage);
WCMD_ReadFile (GetStdHandle(STD_INPUT_HANDLE), buffer,
sizeof(buffer)/sizeof(WCHAR), &count, NULL);
WCMD_ReadFile(GetStdHandle(STD_INPUT_HANDLE), buffer, sizeof(buffer)/sizeof(WCHAR), &count);
WCMD_enter_paged_mode(moreStrPage);
}
@ -2582,7 +2576,7 @@ void WCMD_more (WCHAR *command) {
fileLen = (((ULONG64)fileInfo.nFileSizeHigh) << 32) + fileInfo.nFileSizeLow;
needsPause = TRUE;
while (WCMD_ReadFile (h, buffer, (sizeof(buffer)/sizeof(WCHAR))-1, &count, NULL)) {
while (WCMD_ReadFile(h, buffer, (sizeof(buffer)/sizeof(WCHAR))-1, &count)) {
if (count == 0) break; /* ReadFile reports success on EOF! */
buffer[count] = 0;
curPos += count;
@ -2683,8 +2677,7 @@ int WCMD_volume(BOOL set_label, const WCHAR *path)
curdir[0], label, HIWORD(serial), LOWORD(serial));
if (set_label) {
WCMD_output (WCMD_LoadMessage(WCMD_VOLUMEPROMPT));
WCMD_ReadFile (GetStdHandle(STD_INPUT_HANDLE), string,
sizeof(string)/sizeof(WCHAR), &count, NULL);
WCMD_ReadFile(GetStdHandle(STD_INPUT_HANDLE), string, sizeof(string)/sizeof(WCHAR), &count);
if (count > 1) {
string[count-1] = '\0'; /* ReadFile output is not null-terminated! */
if (string[count-2] == '\r') string[count-2] = '\0'; /* Under Windoze we get CRLF! */

View File

@ -108,8 +108,7 @@ void WCMD_opt_s_strip_quotes(WCHAR *cmd);
WCHAR *WCMD_LoadMessage(UINT id);
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);
BOOL WCMD_ReadFile(const HANDLE hIn, WCHAR *intoBuf, const DWORD maxChars, LPDWORD charsRead);
WCHAR *WCMD_ReadAndParseLine(const WCHAR *initialcmd, CMD_LIST **output,
HANDLE readFrom, const BOOL is_console_handle);

View File

@ -237,11 +237,9 @@ void WCMD_leave_paged_mode(void)
* WCMD_Readfile
*
* Read characters in from a console/file, returning result in Unicode
* with signature identical to ReadFile
*/
BOOL WCMD_ReadFile(const HANDLE hIn, WCHAR *intoBuf, const DWORD maxChars,
LPDWORD charsRead, const LPOVERLAPPED unused) {
BOOL WCMD_ReadFile(const HANDLE hIn, WCHAR *intoBuf, const DWORD maxChars, LPDWORD charsRead)
{
BOOL res;
/* Try to read from console as Unicode */
@ -258,7 +256,7 @@ BOOL WCMD_ReadFile(const HANDLE hIn, WCHAR *intoBuf, const DWORD maxChars,
return FALSE;
/* Read from file (assume OEM codepage) */
res = ReadFile(hIn, buffer, maxChars, &numRead, unused);
res = ReadFile(hIn, buffer, maxChars, &numRead, NULL);
/* Convert from OEM */
*charsRead = MultiByteToWideChar(GetConsoleCP(), 0, buffer, numRead,
@ -293,8 +291,7 @@ static void WCMD_output_asis_handle (DWORD std_handle, const WCHAR *message) {
if (++line_count >= max_height - 1) {
line_count = 0;
WCMD_output_asis_len(pagedMessage, strlenW(pagedMessage), handle);
WCMD_ReadFile (GetStdHandle(STD_INPUT_HANDLE), string,
sizeof(string)/sizeof(WCHAR), &count, NULL);
WCMD_ReadFile(GetStdHandle(STD_INPUT_HANDLE), string, sizeof(string)/sizeof(WCHAR), &count);
}
}
} while (((message = ptr) != NULL) && (*ptr));