on master help sign in
Squash a few VS warnings about size conversion
b7f31e9Neil Mitchell
cbits/hexml.c+6−6
@@ -63,8 +63,8 @@ struct document
63 attr_buffer attrs;
63 attr_buffer attrs;
64};
64};
65
65
66−int static inline doc_length(document* d) { return d->end - 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 d->cursor - d->body; }
67+int static inline doc_position(document* d) { return (int) (d->cursor - d->body); }
68
68
69
69
70/////////////////////////////////////////////////////////////////////
70/////////////////////////////////////////////////////////////////////
@@ -194,7 +194,7 @@ attr* node_attributes(document* d, node* n, int* res)
194
194
195attr* node_attributeBy(document* d, node* n, char* s, int slen)
195attr* node_attributeBy(document* d, node* n, char* s, int slen)
196{
196{
197− if (slen == -1) slen = strlen(s);
197+ if (slen == -1) slen = (int) strlen(s);
198 const int limit = end(n->attrs);
198 const int limit = end(n->attrs);
199 for (int i = n->attrs.start; i < limit; i++)
199 for (int i = n->attrs.start; i < limit; i++)
200 {
200 {
@@ -208,8 +208,8 @@ attr* node_attributeBy(document* d, node* n, char* s, int slen)
208// Search for given strings within a node
208// Search for given strings within a node
209node* node_childBy(document* d, node* parent, node* prev, char* s, int slen)
209node* node_childBy(document* d, node* parent, node* prev, char* s, int slen)
210{
210{
211− if (slen == -1) slen = strlen(s);
211+ if (slen == -1) slen = (int) strlen(s);
212− int i = prev == NULL ? parent->nodes.start : prev + 1 - d->nodes.nodes;
212+ int i = prev == NULL ? parent->nodes.start : (int) (prev + 1 - d->nodes.nodes);
213 const int limit = end(parent->nodes);
213 const int limit = end(parent->nodes);
214 for (; i < limit; i++)
214 for (; i < limit; i++)
215 {
215 {
@@ -508,7 +508,7 @@ typedef struct
508
508
509document* document_parse(char* s, int slen)
509document* document_parse(char* s, int slen)
510{
510{
511− if (slen == -1) slen = strlen(s);
511+ if (slen == -1) slen = (int) strlen(s);
512 assert(s[slen] == 0);
512 assert(s[slen] == 0);
513 init_parse_table();
513 init_parse_table();
514
514
vs/main.c+1−1
@@ -13,7 +13,7 @@ char* readFile(char* file)
13 fseek(f, 0, SEEK_SET);
13 fseek(f, 0, SEEK_SET);
14 char* res = malloc(len + 1);
14 char* res = malloc(len + 1);
15 res[len] = 0;
15 res[len] = 0;
16− int n = fread(res, 1, len, f);
16+ size_t n = fread(res, 1, len, f);
17 assert(n == len);
17 assert(n == len);
18 fclose(f);
18 fclose(f);
19 return res;
19 return res;