Revision: 6707
http://winmerge.svn.sourceforge.net/winmerge/?rev=6707&view=rev
Author: kimmov
Date: 2009-04-23 21:01:28 +0000 (Thu, 23 Apr 2009)
Log Message:
-----------
Fix couple of (64-bit) build warnings. Assume quick compare buffer size is in range of 32-bit int type.
Modified Paths:
--------------
trunk/Src/CompareEngines/ByteCompare.cpp
trunk/Src/CompareEngines/ByteCompare.h
Modified: trunk/Src/CompareEngines/ByteCompare.cpp
===================================================================
--- trunk/Src/CompareEngines/ByteCompare.cpp 2009-04-23 20:30:32 UTC (rev 6706)
+++ trunk/Src/CompareEngines/ByteCompare.cpp 2009-04-23 21:01:28 UTC (rev 6707)
@@ -120,8 +120,8 @@
UINT diffcode = 0;
// area of buffer currently holding data
- __int64 bfstart[2]; // offset into buff[i] where current data resides
- __int64 bfend[2]; // past-the-end pointer into buff[i], giving end of current data
+ INT64 bfstart[2]; // offset into buff[i] where current data resides
+ INT64 bfend[2]; // past-the-end pointer into buff[i], giving end of current data
// buff[0] has bytes to process from buff[0][bfstart[0]] to buff[0][bfend[0]-1]
bool eof[2]; // if we've finished file
@@ -154,8 +154,8 @@
}
if (!eof[i] && bfend[i]<countof(buff[i])-1)
{
- // Assume our blocks are in range of unsigned int
- int space = countof(buff[i]) - bfend[i];
+ // Assume our blocks are in range of int
+ int space = RTL_NUMBER_OF(buff[i]) - (int) bfend[i];
int rtn = read(m_inf[i].desc, &buff[i][bfend[i]], (unsigned int)space);
if (rtn == -1)
return DIFFCODE::CMPERR;
@@ -181,8 +181,8 @@
const char* end0 = &buff[0][bfend[0]];
const char* end1 = &buff[1][bfend[1]];
- __int64 offset0 = (ptr0 - &buff[0][0]);
- __int64 offset1 = (ptr1 - &buff[1][0]);
+ INT64 offset0 = (ptr0 - &buff[0][0]);
+ INT64 offset1 = (ptr1 - &buff[1][0]);
// are these two buffers the same?
result = comparator.CompareBuffers(m_textStats[0], m_textStats[1],
@@ -209,8 +209,8 @@
}
else if (result == ByteComparator::NEED_MORE_0)
{
- const int m = ptr0 - &buff[0][0];
- const int l = end0 - ptr0;
+ const int m = (int)(ptr0 - &buff[0][0]);
+ const int l = (int)(end0 - ptr0);
//move uncompared data to begin of buff0
memcpy( &buff[0][0], &buff[0][m], l );
bfstart[0] = 0;
@@ -219,8 +219,8 @@
}
else if (result == ByteComparator::NEED_MORE_1)
{
- const int m = ptr1 - &buff[1][0];
- const int l = end1 - ptr1;
+ const int m = (int)(ptr1 - &buff[1][0]);
+ const int l = (int)(end1 - ptr1);
//move uncompared data to begin of buff1
memcpy( &buff[1][0], &buff[1][m], l );
bfstart[1]=0;
@@ -240,8 +240,8 @@
{
if (ptr0 < end0)
{
- const int m = ptr0 - orig0;
- const int l = end0 - ptr0;
+ const int m = (int)(ptr0 - orig0);
+ const int l = (int)(end0 - ptr0);
//move uncompared data to begin of buff0
memcpy( &buff[0][0], &buff[0][m], l );
bfstart[0] = 0;
@@ -249,8 +249,8 @@
}
if (ptr1 < end1)
{
- const int m = ptr1 - orig1;
- const int l = end1 - ptr1;
+ const int m = (int)(ptr1 - orig1);
+ const int l = (int)(end1 - ptr1);
//move uncompared data to begin of buff1
memcpy( &buff[1][0], &buff[1][ m], l );
bfstart[1] = 0;
Modified: trunk/Src/CompareEngines/ByteCompare.h
===================================================================
--- trunk/Src/CompareEngines/ByteCompare.h 2009-04-23 20:30:32 UTC (rev 6706)
+++ trunk/Src/CompareEngines/ByteCompare.h 2009-04-23 21:01:28 UTC (rev 6707)
@@ -20,6 +20,11 @@
namespace CompareEngines
{
+/**
+ * @brief A quick compare -compare method implementation class.
+ * This compare method compares files in small blocks. Code assumes block size
+ * is in range of 32-bit int-type.
+ */
class ByteCompare
{
public:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|