diff options
author | Vladislav Vaintroub <wlad@mariadb.com> | 2018-02-06 12:55:58 +0000 |
---|---|---|
committer | Vladislav Vaintroub <wlad@mariadb.com> | 2018-02-06 12:55:58 +0000 |
commit | 6c279ad6a71c63cb595fde7c951aadb31c3dbebc (patch) | |
tree | 3603f88e1b3bd1e622edb182cccd882dd31ddc8a /storage/archive | |
parent | f271100836d8a91a775894ec36b869a66a3145e5 (diff) | |
download | mariadb-git-6c279ad6a71c63cb595fde7c951aadb31c3dbebc.tar.gz |
MDEV-15091 : Windows, 64bit: reenable and fix warning C4267 (conversion from 'size_t' to 'type', possible loss of data)
Handle string length as size_t, consistently (almost always:))
Change function prototypes to accept size_t, where in the past
ulong or uint were used. change local/member variables to size_t
when appropriate.
This fix excludes rocksdb, spider,spider, sphinx and connect for now.
Diffstat (limited to 'storage/archive')
-rw-r--r-- | storage/archive/azio.c | 14 | ||||
-rw-r--r-- | storage/archive/azlib.h | 4 | ||||
-rw-r--r-- | storage/archive/ha_archive.cc | 2 |
3 files changed, 10 insertions, 10 deletions
diff --git a/storage/archive/azio.c b/storage/archive/azio.c index 8bf90e700d4..0f66b999c94 100644 --- a/storage/archive/azio.c +++ b/storage/archive/azio.c @@ -479,7 +479,7 @@ unsigned int ZEXPORT azread ( azio_stream *s, voidp buf, size_t len, int *error) next_out = (Byte*)buf; s->stream.next_out = (Bytef*)buf; - s->stream.avail_out = len; + s->stream.avail_out = (uInt)len; if (s->stream.avail_out && s->back != EOF) { *next_out++ = s->back; @@ -521,7 +521,7 @@ unsigned int ZEXPORT azread ( azio_stream *s, voidp buf, size_t len, int *error) s->out += len; if (len == 0) s->z_eof = 1; { - return len; + return (uint)len; } } if (s->stream.avail_in == 0 && !s->z_eof) { @@ -574,7 +574,7 @@ unsigned int ZEXPORT azread ( azio_stream *s, voidp buf, size_t len, int *error) return 0; } - return (len - s->stream.avail_out); + return (uint)(len - s->stream.avail_out); } @@ -882,7 +882,7 @@ int azclose (azio_stream *s) Though this was added to support MySQL's FRM file, anything can be stored in this location. */ -int azwrite_frm(azio_stream *s, const uchar *blob, unsigned int length) +int azwrite_frm(azio_stream *s, const uchar *blob, size_t length) { if (s->mode == 'r') return 1; @@ -891,7 +891,7 @@ int azwrite_frm(azio_stream *s, const uchar *blob, unsigned int length) return 1; s->frm_start_pos= (uint) s->start; - s->frm_length= length; + s->frm_length= (uint)length; s->start+= length; if (my_pwrite(s->file, blob, s->frm_length, @@ -913,7 +913,7 @@ int azread_frm(azio_stream *s, uchar *blob) /* Simple comment field */ -int azwrite_comment(azio_stream *s, const char *blob, unsigned int length) +int azwrite_comment(azio_stream *s, const char *blob, size_t length) { if (s->mode == 'r') return 1; @@ -922,7 +922,7 @@ int azwrite_comment(azio_stream *s, const char *blob, unsigned int length) return 1; s->comment_start_pos= (uint) s->start; - s->comment_length= length; + s->comment_length= (uint)length; s->start+= length; my_pwrite(s->file, (uchar*) blob, s->comment_length, s->comment_start_pos, diff --git a/storage/archive/azlib.h b/storage/archive/azlib.h index d9318002901..20725aac304 100644 --- a/storage/archive/azlib.h +++ b/storage/archive/azlib.h @@ -334,10 +334,10 @@ extern int azclose(azio_stream *file); error number (see function gzerror below). */ -extern int azwrite_frm (azio_stream *s, const uchar *blob, unsigned int length); +extern int azwrite_frm (azio_stream *s, const uchar *blob,size_t length); extern int azread_frm (azio_stream *s, uchar *blob); extern int azwrite_comment (azio_stream *s, const char *blob, - unsigned int length); + size_t length); extern int azread_comment (azio_stream *s, char *blob); #ifdef __cplusplus diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc index e478058c7fd..08d5220cfca 100644 --- a/storage/archive/ha_archive.cc +++ b/storage/archive/ha_archive.cc @@ -1361,7 +1361,7 @@ int ha_archive::get_row_version2(azio_stream *file_to_read, uchar *buf) if ((size_t) read != size) DBUG_RETURN(HA_ERR_END_OF_FILE); - ((Field_blob*) table->field[*ptr])->set_ptr(size, (uchar*) last); + ((Field_blob*) table->field[*ptr])->set_ptr(read, (uchar*) last); last += size; } else |