Skip to content

Commit 1a36060

Browse files
committed
FIX: some of xcode warnings
1 parent 9f0b072 commit 1a36060

File tree

6 files changed

+28
-25
lines changed

6 files changed

+28
-25
lines changed

src/core/t-time.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
REBINT part1, part2, part3 = -1;
8181
REBINT part4 = -1;
8282

83-
if (*cp == '-') cp++, neg = TRUE;
83+
if (*cp == '-') {cp++; neg = TRUE;}
8484
else if (*cp == '+') cp++;
8585

8686
if (*cp == '-' || *cp == '+') return 0; // small hole: --1:23

src/core/u-bincode.c

+12-10
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ static REBCNT EncodedU32_Size(u32 value) {
525525

526526
case SYM_ENCODEDU32:
527527
if (IS_INTEGER(next)) {
528-
count += EncodedU32_Size(VAL_INT64(next));
528+
count += EncodedU32_Size(VAL_UNT32(next));
529529
continue;
530530
}
531531
goto error;
@@ -902,12 +902,12 @@ static REBCNT EncodedU32_Size(u32 value) {
902902

903903
case SYM_ENCODEDU32:
904904
ASSERT_U32_RANGE(next);
905-
ulong = (u32)VAL_INT64(next);
905+
ulong = VAL_UNT32(next);
906906
if (ulong == 0) {
907907
n = 1;
908908
cp[0] = 0;
909909
} else {
910-
n = EncodedU32_Size(VAL_INT64(next));
910+
n = EncodedU32_Size(VAL_UNT32(next));
911911
for (u = 0; u < n-1; u++) {
912912
cp[u] = (char)(128 + ((ulong >> (u * 7)) & 127));
913913
}
@@ -1019,7 +1019,7 @@ static REBCNT EncodedU32_Size(u32 value) {
10191019
inBit = IS_OBJECT(val_ctx) ? VAL_INT32(VAL_OBJ_VALUE(val_ctx, BINCODE_READ_BITMASK)): 0;
10201020

10211021
if (IS_INTEGER(val_read)) {
1022-
n = VAL_INT64(val_read);
1022+
n = (REBCNT)VAL_INT64(val_read);
10231023
ASSERT_READ_SIZE(val_read, cp, ep, n);
10241024
if(ref_into) {
10251025
Trap0(RE_FEATURE_NA);
@@ -1376,7 +1376,7 @@ static REBCNT EncodedU32_Size(u32 value) {
13761376
VAL_SERIES(temp) = bin_new;
13771377
VAL_INDEX(temp) = 0;
13781378
if (cmd == SYM_STRING_BYTES) {
1379-
VAL_TAIL(temp) = strnlen(cs_cast(VAL_BIN(temp)), n);
1379+
VAL_TAIL(temp) = (REBCNT)strnlen(cs_cast(VAL_BIN(temp)), n);
13801380
}
13811381
}
13821382
break;
@@ -1387,7 +1387,7 @@ static REBCNT EncodedU32_Size(u32 value) {
13871387
if(bp == ep) Trap1(RE_OUT_OF_RANGE, value);
13881388
bp++;
13891389
}
1390-
n = bp - cp;
1390+
n = (REBCNT)(bp - cp);
13911391
VAL_SET(temp, REB_STRING);
13921392
bin_new = Copy_Series_Part(bin, VAL_INDEX(buffer_read), n);
13931393
SET_STR_END(bin_new, n);
@@ -1436,20 +1436,22 @@ static REBCNT EncodedU32_Size(u32 value) {
14361436
goto readNBytes;
14371437
case SYM_UI32BYTES:
14381438
ASSERT_READ_SIZE(value, cp, ep, 4);
1439-
n = ((u64)cp[3] ) |
1439+
n = (REBCNT)(
1440+
((u64)cp[3] ) |
14401441
((u64)cp[2] << 8 ) |
14411442
((u64)cp[1] << 16) |
1442-
((u64)cp[0] << 24) ;
1443+
((u64)cp[0] << 24));
14431444
ASSERT_READ_SIZE(value, cp, ep, n);
14441445
cp += 4;
14451446
VAL_INDEX(buffer_read) += 4;
14461447
goto readNBytes;
14471448
case SYM_UI32LEBYTES:
14481449
ASSERT_READ_SIZE(value, cp, ep, 4);
1449-
n = ((u64)cp[0] ) |
1450+
n = (REBCNT)(
1451+
((u64)cp[0] ) |
14501452
((u64)cp[1] << 8 ) |
14511453
((u64)cp[2] << 16) |
1452-
((u64)cp[3] << 24) ;
1454+
((u64)cp[3] << 24));
14531455
ASSERT_READ_SIZE(value, cp, ep, n);
14541456
cp += 4;
14551457
VAL_INDEX(buffer_read) += 4;

src/core/u-chacha20.c

-1
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,6 @@ static inline void chacha_nonce(chacha20_ctx *ctx, u8 *nonce) {
243243

244244
static inline int poly1305_generate_key(u8 *key256, u8 *nonce, u32 noncelen, u8 *poly_key, u32 counter) {
245245
struct chacha20_ctx ctx;
246-
u64 ctr;
247246
u64 sequence = 0;
248247
u32 state[16];
249248
int i = 10;

src/core/u-iconv.c

+12-11
Original file line numberDiff line numberDiff line change
@@ -527,13 +527,13 @@ static REBINT get_codepage_id(REBVAL *cp)
527527
if (_stricmp(cs_cast(name), codepage_alias[i].name) == 0)
528528
return codepage_alias[i].codepage;
529529
#else
530-
if (strncasecmp(name, "cp", 2) == 0)
531-
return atoi(name + 2); /* CP123 */
530+
if (strncasecmp(cs_cast(name), "cp", 2) == 0)
531+
return atoi(cs_cast(name) + 2); /* CP123 */
532532
else if ('0' <= name[0] && name[0] <= '9')
533-
return atoi(name); /* 123 */
533+
return atoi(cs_cast(name)); /* 123 */
534534

535535
for (i = 0; codepage_alias[i].name != NULL; ++i)
536-
if (strcasecmp(name, codepage_alias[i].name) == 0)
536+
if (strcasecmp(cs_cast(name), codepage_alias[i].name) == 0)
537537
return codepage_alias[i].codepage;
538538
#endif
539539
return -1;
@@ -596,11 +596,12 @@ static REBYTE* get_codepage_name(REBVAL *cp)
596596
REBVAL *val_to = D_ARG(4);
597597

598598
REBCNT src_len = VAL_LEN(data);
599-
REBINT dst_len = 0;
600599
REBSER *dst_wide;
601-
REBSER *dest;
600+
602601

603602
#ifdef TO_WINDOWS
603+
REBINT dst_len = 0;
604+
REBSER *dest;
604605
REBINT cp, tp;
605606
BOOL default_char_used;
606607

@@ -717,13 +718,13 @@ static REBYTE* get_codepage_name(REBVAL *cp)
717718
size_t dst_size;
718719
size_t nread;
719720
REBCNT tail;
720-
const char *fromcode = get_codepage_name(val_from);
721+
const char *fromcode = cs_cast(get_codepage_name(val_from));
721722
const char *tocode;
722723
int wide;
723724

724725
if (!fromcode) Trap1(RE_INVALID_ARG, val_from);
725726
if (ref_to) {
726-
tocode = get_codepage_name(val_to);
727+
tocode = cs_cast(get_codepage_name(val_to));
727728
if (!tocode) Trap1(RE_INVALID_ARG, val_to);
728729
wide = 1; // result is raw binary series
729730
} else {
@@ -756,7 +757,7 @@ static REBYTE* get_codepage_name(REBVAL *cp)
756757
// There is not sufficient room at destination
757758
if (SERIES_SPACE(dst_wide) < (4 * src_len)) {
758759
// expand the destination series; maximum 4x of the source
759-
tail = ((REBYTE*)dst - BIN_HEAD(dst_wide)) / wide;
760+
tail = (REBCNT)((REBYTE*)dst - BIN_HEAD(dst_wide)) / wide;
760761
SERIES_TAIL(dst_wide) = tail;
761762
//printf("\n---expand delta: %d\n", src_len);
762763
Expand_Series(dst_wide, tail, src_len / 2);
@@ -782,7 +783,7 @@ static REBYTE* get_codepage_name(REBVAL *cp)
782783
}
783784
if (src_size == 0) break;
784785
}
785-
SERIES_TAIL(dst_wide) = ((REBYTE*)dst - BIN_HEAD(dst_wide)) / wide;
786+
SERIES_TAIL(dst_wide) = (REBCNT)((REBYTE*)dst - BIN_HEAD(dst_wide)) / wide;
786787
if (ref_to) {
787788
SET_BINARY(D_RET, dst_wide);
788789
}
@@ -796,4 +797,4 @@ static REBYTE* get_codepage_name(REBVAL *cp)
796797
return R_RET;
797798
#endif
798799

799-
}
800+
}

src/include/reb-c.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ enum {
237237
typedef long (__stdcall *FUNCPTR)();
238238
typedef void(__cdecl *CFUNC)(void *);
239239
#else
240-
typedef long (*FUNCPTR)();
240+
typedef long (*FUNCPTR)(void);
241241
typedef void(*CFUNC)(void *);
242242
#endif
243243

src/include/sys-value.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,8 @@ typedef struct Reb_Type {
135135
#define NONE_VALUE ROOT_NONEVAL
136136

137137
#define VAL_INT32(v) (REBINT)((v)->data.integer)
138-
#define VAL_INT64(v) ((v)->data.integer)
138+
#define VAL_INT64(v) ((v)->data.integer)
139+
#define VAL_UNT32(v) (REBCNT)((v)->data.integer)
139140
#define VAL_UNT64(v) ((v)->data.unteger)
140141
#define SET_INTEGER(v,n) VAL_SET(v, REB_INTEGER), ((v)->data.integer) = (n)
141142
#define SET_INT32(v,n) ((v)->data.integer) = (REBINT)(n)

0 commit comments

Comments
 (0)