Author: hbelusca
Date: Thu Jun 9 18:43:36 2016
New Revision: 71599
URL:
http://svn.reactos.org/svn/reactos?rev=71599&view=rev
Log:
[COMP]
- The comparison buffers contain bytes, not (T)CHARs. Pointed out by Stefan Fulea in
CORE-11060.
- Remove a now unnecessary comment header "history" line since we have SVN for
that instead.
Modified:
trunk/reactos/base/applications/cmdutils/comp/comp.c
Modified: trunk/reactos/base/applications/cmdutils/comp/comp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/cmdutils…
==============================================================================
--- trunk/reactos/base/applications/cmdutils/comp/comp.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/cmdutils/comp/comp.c [iso-8859-1] Thu Jun 9 18:43:36
2016
@@ -22,9 +22,6 @@
* FILE: base/applications/cmdutils/comp/comp.c
* PURPOSE: Compares the contents of two files
* PROGRAMMERS: Ged Murphy (gedmurphy(a)gmail.com)
- * REVISIONS:
- * GM 25/09/05 Created
- *
*/
#include <windows.h>
@@ -37,9 +34,9 @@
#define STRBUF 1024
/* getline: read a line, return length */
-INT GetBuff(char *buff, FILE *in)
-{
- return fread(buff, 1, STRBUF, in);
+INT GetBuff(PBYTE buff, FILE *in)
+{
+ return fread(buff, sizeof(BYTE), STRBUF, in);
}
INT FileSize(FILE * fd)
@@ -74,8 +71,8 @@
FILE *fp2 = NULL;
INT BufLen1, BufLen2;
- PTCHAR Buff1 = NULL;
- PTCHAR Buff2 = NULL;
+ PBYTE Buff1 = NULL;
+ PBYTE Buff2 = NULL;
TCHAR File1[_MAX_PATH + 1], // File paths
File2[_MAX_PATH + 1];
BOOL bAscii = FALSE, // /A switch
@@ -128,14 +125,15 @@
return EXIT_FAILURE;
}
- Buff1 = (TCHAR *)malloc(STRBUF * sizeof(TCHAR));
+ Buff1 = (PBYTE)malloc(STRBUF);
if (Buff1 == NULL)
{
_tprintf(_T("Can't get free memory for Buff1\n"));
- return EXIT_FAILURE;
- }
-
- Buff2 = (TCHAR *)malloc(STRBUF * sizeof(TCHAR));
+ Status = EXIT_FAILURE;
+ goto Cleanup;
+ }
+
+ Buff2 = (PBYTE)malloc(STRBUF);
if (Buff2 == NULL)
{
_tprintf(_T("Can't get free memory for Buff2\n"));
@@ -239,15 +237,15 @@
_tprintf(_T("Files compare OK\n"));
Cleanup:
+ if (fp2)
+ fclose(fp2);
if (fp1)
fclose(fp1);
- if (fp2)
- fclose(fp2);
-
+
+ if (Buff2)
+ free(Buff2);
if (Buff1)
free(Buff1);
- if (Buff2)
- free(Buff2);
return Status;
}