mirror of
https://github.com/libexpat/libexpat.git
synced 2025-04-07 06:04:59 +00:00
benchmark.c: Address MSVC warnings C4267 and C4244
Compiler output was: > tests\benchmark\benchmark.c(102): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data > tests\benchmark\benchmark.c(117): warning C4244: 'initializing': conversion from '__int64' to 'int', possible loss of data
This commit is contained in:
parent
038040447e
commit
a55b7925b2
1 changed files with 8 additions and 4 deletions
|
@ -33,6 +33,8 @@
|
|||
*/
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <assert.h>
|
||||
#include <stddef.h> // ptrdiff_t
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
@ -62,7 +64,8 @@ main(int argc, char *argv[]) {
|
|||
char *XMLBuf, *XMLBufEnd, *XMLBufPtr;
|
||||
FILE *fd;
|
||||
struct stat fileAttr;
|
||||
int nrOfLoops, bufferSize, fileSize, i, isFinal;
|
||||
int nrOfLoops, bufferSize, i, isFinal;
|
||||
size_t fileSize;
|
||||
int j = 0, ns = 0;
|
||||
clock_t tstart, tend;
|
||||
double cpuTime = 0.0;
|
||||
|
@ -114,12 +117,13 @@ main(int argc, char *argv[]) {
|
|||
isFinal = 0;
|
||||
tstart = clock();
|
||||
do {
|
||||
int parseBufferSize = XMLBufEnd - XMLBufPtr;
|
||||
if (parseBufferSize <= bufferSize)
|
||||
ptrdiff_t parseBufferSize = XMLBufEnd - XMLBufPtr;
|
||||
if (parseBufferSize <= (ptrdiff_t)bufferSize)
|
||||
isFinal = 1;
|
||||
else
|
||||
parseBufferSize = bufferSize;
|
||||
if (! XML_Parse(parser, XMLBufPtr, parseBufferSize, isFinal)) {
|
||||
assert(parseBufferSize <= (ptrdiff_t)bufferSize);
|
||||
if (! XML_Parse(parser, XMLBufPtr, (int)parseBufferSize, isFinal)) {
|
||||
fprintf(stderr,
|
||||
"error '%" XML_FMT_STR "' at line %" XML_FMT_INT_MOD
|
||||
"u character %" XML_FMT_INT_MOD "u\n",
|
||||
|
|
Loading…
Add table
Reference in a new issue