build on msvs2010

This commit is contained in:
David Rose 2011-09-29 16:39:54 +00:00
parent f2a2422094
commit 255b1ffffa
5 changed files with 19 additions and 19 deletions

View File

@ -798,7 +798,7 @@ copy_file(const string &from_filename, const string &to_filename) {
char buffer[buffer_size]; char buffer[buffer_size];
in.read(buffer, buffer_size); in.read(buffer, buffer_size);
size_t count = in.gcount(); streamsize count = in.gcount();
while (count != 0) { while (count != 0) {
out.write(buffer, count); out.write(buffer, count);
if (out.fail()) { if (out.fail()) {

View File

@ -149,7 +149,7 @@ set_property(const string &property, bool needs_response, P3D_object *value) {
// First, we set the property locally. // First, we set the property locally.
if (value != NULL) { if (value != NULL) {
Properties::iterator pi; Properties::iterator pi;
pi = _properties.insert(Properties::value_type(property, NULL)).first; pi = _properties.insert(Properties::value_type(property, (P3D_object *)NULL)).first;
assert(pi != _properties.end()); assert(pi != _properties.end());
P3D_object *orig_value = (*pi).second; P3D_object *orig_value = (*pi).second;
if (orig_value != value) { if (orig_value != value) {
@ -673,7 +673,7 @@ read_log_file(const string &log_pathname,
if (full_bytes > 0) { if (full_bytes > 0) {
log.seekg(0, ios::beg); log.seekg(0, ios::beg);
log.read(buffer, full_bytes); log.read(buffer, full_bytes);
size_t read_bytes = log.gcount(); streamsize read_bytes = log.gcount();
assert(read_bytes < buffer_bytes); assert(read_bytes < buffer_bytes);
buffer[read_bytes] = '\0'; buffer[read_bytes] = '\0';
log_data << "== PandaLog-" << "Full Start"; log_data << "== PandaLog-" << "Full Start";
@ -687,7 +687,7 @@ read_log_file(const string &log_pathname,
if (head_bytes > 0) { if (head_bytes > 0) {
log.seekg(0, ios::beg); log.seekg(0, ios::beg);
log.read(buffer, head_bytes); log.read(buffer, head_bytes);
size_t read_bytes = log.gcount(); streamsize read_bytes = log.gcount();
assert(read_bytes < buffer_bytes); assert(read_bytes < buffer_bytes);
buffer[read_bytes] = '\0'; buffer[read_bytes] = '\0';
log_data << "== PandaLog-" << "Head Start"; log_data << "== PandaLog-" << "Head Start";
@ -707,7 +707,7 @@ read_log_file(const string &log_pathname,
if (tail_bytes > 0) { if (tail_bytes > 0) {
log.seekg(file_size - tail_bytes, ios::beg); log.seekg(file_size - tail_bytes, ios::beg);
log.read(buffer, tail_bytes); log.read(buffer, tail_bytes);
size_t read_bytes = log.gcount(); streamsize read_bytes = log.gcount();
assert(read_bytes < buffer_bytes); assert(read_bytes < buffer_bytes);
buffer[read_bytes] = '\0'; buffer[read_bytes] = '\0';
log_data << "== PandaLog-" << "Tail Start"; log_data << "== PandaLog-" << "Tail Start";

View File

@ -375,12 +375,12 @@ bool P3DMultifileReader::
extract_subfile(ostream &out, const Subfile &s) { extract_subfile(ostream &out, const Subfile &s) {
_in.seekg(s._data_start + _read_offset); _in.seekg(s._data_start + _read_offset);
static const size_t buffer_size = 4096; static const streamsize buffer_size = 4096;
char buffer[buffer_size]; char buffer[buffer_size];
size_t remaining_data = s._data_length; streamsize remaining_data = s._data_length;
_in.read(buffer, min(buffer_size, remaining_data)); _in.read(buffer, min(buffer_size, remaining_data));
size_t count = _in.gcount(); streamsize count = _in.gcount();
while (count != 0) { while (count != 0) {
remaining_data -= count; remaining_data -= count;
out.write(buffer, count); out.write(buffer, count);
@ -485,13 +485,13 @@ check_signatures() {
// _last_data_byte. // _last_data_byte.
_in.seekg(_read_offset); _in.seekg(_read_offset);
streampos bytes_remaining = (streampos)_last_data_byte; streampos bytes_remaining = (streampos)_last_data_byte;
static const size_t buffer_size = 4096; static const streamsize buffer_size = 4096;
char buffer[buffer_size]; char buffer[buffer_size];
_in.read(buffer, min((streampos)buffer_size, bytes_remaining)); _in.read(buffer, min((streampos)buffer_size, bytes_remaining));
size_t count = _in.gcount(); streamsize count = _in.gcount();
while (count != 0) { while (count != 0) {
assert(count <= buffer_size); assert(count <= buffer_size);
EVP_VerifyUpdate(md_ctx, buffer, count); EVP_VerifyUpdate(md_ctx, buffer, (size_t)count);
bytes_remaining -= count; bytes_remaining -= count;
_in.read(buffer, min((streampos)buffer_size, bytes_remaining)); _in.read(buffer, min((streampos)buffer_size, bytes_remaining));
count = _in.gcount(); count = _in.gcount();

View File

@ -1903,11 +1903,11 @@ thread_step() {
int flush = 0; int flush = 0;
source.read(decompress_buffer, decompress_buffer_size); source.read(decompress_buffer, decompress_buffer_size);
size_t read_count = source.gcount(); streamsize read_count = source.gcount();
eof = (read_count == 0 || source.eof() || source.fail()); eof = (read_count == 0 || source.eof() || source.fail());
z.next_in = (Bytef *)decompress_buffer; z.next_in = (Bytef *)decompress_buffer;
z.avail_in = read_count; z.avail_in = (size_t)read_count;
int result = inflateInit(&z); int result = inflateInit(&z);
if (result < 0) { if (result < 0) {
@ -1918,11 +1918,11 @@ thread_step() {
while (true) { while (true) {
if (z.avail_in == 0 && !eof) { if (z.avail_in == 0 && !eof) {
source.read(decompress_buffer, decompress_buffer_size); source.read(decompress_buffer, decompress_buffer_size);
size_t read_count = source.gcount(); streamsize read_count = source.gcount();
eof = (read_count == 0 || source.eof() || source.fail()); eof = (read_count == 0 || source.eof() || source.fail());
z.next_in = (Bytef *)decompress_buffer; z.next_in = (Bytef *)decompress_buffer;
z.avail_in = read_count; z.avail_in = (size_t)read_count;
} }
z.next_out = (Bytef *)write_buffer; z.next_out = (Bytef *)write_buffer;

View File

@ -271,12 +271,12 @@ copy_bytes(istream &in, size_t copy_byte_count) {
static const size_t buffer_size = 8192; static const size_t buffer_size = 8192;
char buffer[buffer_size]; char buffer[buffer_size];
size_t read_size = min(copy_byte_count, buffer_size); streamsize read_size = min(copy_byte_count, buffer_size);
in.read(buffer, read_size); in.read(buffer, read_size);
size_t count = in.gcount(); streamsize count = in.gcount();
while (count != 0) { while (count != 0) {
_target_out.write(buffer, count); _target_out.write(buffer, count);
_bytes_written += count; _bytes_written += (size_t)count;
if (_bytes_written > _target_length) { if (_bytes_written > _target_length) {
nout << "Runaway patchfile.\n"; nout << "Runaway patchfile.\n";
return false; return false;
@ -284,7 +284,7 @@ copy_bytes(istream &in, size_t copy_byte_count) {
if (count != read_size) { if (count != read_size) {
return false; return false;
} }
copy_byte_count -= count; copy_byte_count -= (size_t)count;
count = 0; count = 0;
if (copy_byte_count != 0) { if (copy_byte_count != 0) {
read_size = min(copy_byte_count, buffer_size); read_size = min(copy_byte_count, buffer_size);