on master help sign in
Squash a few VS warnings about size conversion
commitb7f31e9d919d5d2ef64ce03eb5c274a9177e9e52 authorNeil Mitchell <ndmitchell@gmail.com> dateWed 30 Nov 2016, 19:08 (10 years ago) parent571201c
2 files changed+7−7
cbits/hexml.c+6−6 vs/main.c+1−1
cbits/hexml.c+6−6
@@ -63,8 +63,8 @@ struct document
6363 attr_buffer attrs;
6464};
6565
66−int static inline doc_length(document* d) { return d->end - d->body; }
67−int static inline doc_position(document* d) { return d->cursor - d->body; }
66+int static inline doc_length(document* d) { return (int) (d->end - d->body); }
67+int static inline doc_position(document* d) { return (int) (d->cursor - d->body); }
6868
6969
7070/////////////////////////////////////////////////////////////////////
@@ -194,7 +194,7 @@ attr* node_attributes(document* d, node* n, int* res)
194194
195195attr* node_attributeBy(document* d, node* n, char* s, int slen)
196196{
197− if (slen == -1) slen = strlen(s);
197+ if (slen == -1) slen = (int) strlen(s);
198198 const int limit = end(n->attrs);
199199 for (int i = n->attrs.start; i < limit; i++)
200200 {
@@ -208,8 +208,8 @@ attr* node_attributeBy(document* d, node* n, char* s, int slen)
208208// Search for given strings within a node
209209node* node_childBy(document* d, node* parent, node* prev, char* s, int slen)
210210{
211− if (slen == -1) slen = strlen(s);
212− int i = prev == NULL ? parent->nodes.start : prev + 1 - d->nodes.nodes;
211+ if (slen == -1) slen = (int) strlen(s);
212+ int i = prev == NULL ? parent->nodes.start : (int) (prev + 1 - d->nodes.nodes);
213213 const int limit = end(parent->nodes);
214214 for (; i < limit; i++)
215215 {
@@ -508,7 +508,7 @@ typedef struct
508508
509509document* document_parse(char* s, int slen)
510510{
511− if (slen == -1) slen = strlen(s);
511+ if (slen == -1) slen = (int) strlen(s);
512512 assert(s[slen] == 0);
513513 init_parse_table();
514514
vs/main.c+1−1
@@ -13,7 +13,7 @@ char* readFile(char* file)
1313 fseek(f, 0, SEEK_SET);
1414 char* res = malloc(len + 1);
1515 res[len] = 0;
16− int n = fread(res, 1, len, f);
16+ size_t n = fread(res, 1, len, f);
1717 assert(n == len);
1818 fclose(f);
1919 return res;