Skip to content

Commit d982e87

Browse files
committed
Eliminating more compiler warning on MSVC
1 parent 193170d commit d982e87

File tree

8 files changed

+25
-26
lines changed

8 files changed

+25
-26
lines changed

ext/odbc/CMakeLists.txt

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ ENDIF()
1111

1212
IF (HAVE_SQL_H)
1313
MESSAGE(STATUS "Sagittarius supports ODBC")
14-
1514
ADD_DEFINITIONS(-DHAVE_SQL_H)
1615
IF (HAVE_SQLEXT_H)
1716
ADD_DEFINITIONS(-DHAVE_SQLEXT_H)

ext/odbc/odbc.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ static SgObject make_blob_input_port(SQLHSTMT stmt, int index, int stringP)
507507
}
508508

509509
static SgObject read_var_data_impl(SQLHSTMT stmt, int index,
510-
int len, int stringP, int asPortP)
510+
SQLLEN len, int stringP, int asPortP)
511511
{
512512
uint8_t buf[256] = {0};
513513
SgObject port, bv;
@@ -597,7 +597,7 @@ static SgObject timestamp_to_obj(SQL_TIMESTAMP_STRUCT *data)
597597
}
598598

599599
static SgObject try_known_name_data(SgObject stmt, int index,
600-
int length, const char * name)
600+
SQLLEN length, const char * name)
601601
{
602602
/* unicode varchar is -9, but not defined in ODBC */
603603
if (strcmp(name, "VARCHAR2") == 0) {
@@ -622,7 +622,7 @@ static SgObject try_known_name_data(SgObject stmt, int index,
622622
return SG_UNDEF; /* dummy */
623623
}
624624

625-
int Sg_ColumnSize(SgObject stmt, int index)
625+
SQLLEN Sg_ColumnSize(SgObject stmt, int index)
626626
{
627627
SQLRETURN ret;
628628
SQLLEN len;
@@ -733,7 +733,7 @@ SgObject Sg_GetData(SgObject stmt, int index)
733733
return SG_UNDEF;
734734
}
735735

736-
int Sg_RowCount(SgObject stmt)
736+
SQLLEN Sg_RowCount(SgObject stmt)
737737
{
738738
SQLRETURN ret;
739739
SQLLEN len;

ext/odbc/odbc.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,10 @@ int Sg_ExecuteDirect(SgObject stmt, SgString *text);
138138
int Sg_Fetch(SgObject stmt);
139139
SgObject Sg_GetData(SgObject stmt, int index);
140140

141-
int Sg_RowCount(SgObject stmt);
141+
SQLLEN Sg_RowCount(SgObject stmt);
142142
/* returns result column names */
143143
int Sg_ColumnCount(SgObject stmt);
144-
int Sg_ColumnSize(SgObject stmt, int index);
144+
SQLLEN Sg_ColumnSize(SgObject stmt, int index);
145145
SgObject Sg_ResultColumns(SgObject stmt);
146146

147147
/* meta information */

ext/odbc/odbc_stub.stub

+4-4
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@
6464
(define-c-proc get-data (stmt::<odbc-stmt> index::<fixnum>)
6565
(result (Sg_GetData stmt index)))
6666

67-
(define-c-proc row-count (stmt::<odbc-stmt>) ::<fixnum>
68-
(result (Sg_RowCount stmt)))
67+
(define-c-proc row-count (stmt::<odbc-stmt>)
68+
(result (Sg_MakeIntegerFromS64 (Sg_RowCount stmt))))
6969

70-
(define-c-proc column-size (stmt::<odbc-stmt> index::<fixnum>) ::<fixnum>
71-
(result (Sg_ColumnSize stmt index)))
70+
(define-c-proc column-size (stmt::<odbc-stmt> index::<fixnum>)
71+
(result (Sg_MakeIntegerFromS64 (Sg_ColumnSize stmt index))))
7272

7373
(define-c-proc column-count (stmt::<odbc-stmt>) ::<fixnum>
7474
(result (Sg_ColumnCount stmt)))

src/geninsn

+2-2
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,8 @@ struct InsnInfoRec
225225
int label;
226226
};
227227
#define INSN(o) ((o) & INSN_MASK)
228-
#define INSN_VALUE1(insn) (((int)(insn)) >> INSN_VALUE1_SHIFT)
229-
#define INSN_VALUE2(insn) (((int)(insn)) >> INSN_VALUE2_SHIFT)
228+
#define INSN_VALUE1(insn) (((int)(intptr_t)(insn)) >> INSN_VALUE1_SHIFT)
229+
#define INSN_VALUE2(insn) (((int)(intptr_t)(insn)) >> INSN_VALUE2_SHIFT)
230230
#define INSN_VAL1(v, insn) ((v) = INSN_VALUE1(insn))
231231
#define INSN_VAL2(v1, v2, insn) \\
232232
do { \\

src/lib_core.stub

+11-11
Original file line numberDiff line numberDiff line change
@@ -947,7 +947,7 @@
947947
(bv-check-literal bytevector-u16-native-set! bv)
948948
(bv-check-index bytevector-u16-native-set! bv index 1)
949949
(bv-check-value bytevector-u16-native-set! value 0 #xFFFF)
950-
(Sg_ByteVectorU16NativeSet bv index value))
950+
(Sg_ByteVectorU16NativeSet bv index (cast uint16_t value)))
951951

952952
(define-c-proc bytevector-u16-ref
953953
(bv::<bytevector> index::<fixnum> endian::<symbol>) ::<fixnum> :constant
@@ -967,9 +967,9 @@
967967
(bv-check-index bytevector-u16-set! bv index 1)
968968
(bv-check-value bytevector-u16-set! value 0 #xFFFF)
969969
(cond ((SG_EQ endian 'big)
970-
(Sg_ByteVectorU16BigSet bv index value))
970+
(Sg_ByteVectorU16BigSet bv index (cast uint16_t value)))
971971
((SG_EQ endian 'little)
972-
(Sg_ByteVectorU16LittleSet bv index value))
972+
(Sg_ByteVectorU16LittleSet bv index (cast uint16_t value)))
973973
(else
974974
(assertion-violation 'bytevector-u16-set!
975975
"unsupported endianness" endian))))
@@ -987,7 +987,7 @@
987987
(bv-check-literal bytevector-s16-native-set! bv)
988988
(bv-check-index bytevector-s16-native-set! bv index 1)
989989
(bv-check-value bytevector-s16-native-set! value #x-8000 #x7FFF)
990-
(Sg_ByteVectorS16NativeSet bv index value))
990+
(Sg_ByteVectorS16NativeSet bv index (cast int16_t value)))
991991

992992
(define-c-proc bytevector-s16-ref
993993
(bv::<bytevector> index::<fixnum> endian::<symbol>) ::<fixnum> :constant
@@ -1007,9 +1007,9 @@
10071007
(bv-check-index bytevector-s16-set! bv index 1)
10081008
(bv-check-value bytevector-s16-set! value #x-8000 #x7FFF)
10091009
(cond ((SG_EQ endian 'big)
1010-
(Sg_ByteVectorS16BigSet bv index value))
1010+
(Sg_ByteVectorS16BigSet bv index (cast int16_t value)))
10111011
((SG_EQ endian 'little)
1012-
(Sg_ByteVectorS16LittleSet bv index value))
1012+
(Sg_ByteVectorS16LittleSet bv index (cast int16_t value)))
10131013
(else
10141014
(assertion-violation 'bytevector-s16-set! "unsupported endianness"
10151015
endian))))
@@ -1967,7 +1967,7 @@
19671967
(result SG_EOF))
19681968
(else
19691969
(unless (== res 512)
1970-
(set! (SG_BVECTOR_SIZE buf) res))
1970+
(set! (SG_BVECTOR_SIZE buf) (cast long res)))
19711971
(result buf)))))
19721972

19731973
(define-c-proc get-bytevector-all (p::<port> :optional (reckless #f))
@@ -1981,7 +1981,7 @@
19811981
(res::int64_t (Sg_ReadbAll p (& buf))))
19821982
(if (== res 0)
19831983
(result SG_EOF)
1984-
(let ((r (Sg_MakeByteVectorFromU8Array buf res)))
1984+
(let ((r (Sg_MakeByteVectorFromU8Array buf (cast long res))))
19851985
(set! buf NULL) ; gc friendliness
19861986
(result r)))))
19871987

@@ -2050,7 +2050,7 @@
20502050
(SG_PORT_UNLOCK_READ p)
20512051
(if (== len count)
20522052
(result buf)
2053-
(result (Sg_Substring buf 0 len))))))))
2053+
(result (Sg_Substring buf 0 (cast long len)))))))))
20542054

20552055
(define-c-proc get-string-n!
20562056
(p::<port> s::<string> start::<fixnum> count::<fixnum>)
@@ -2103,7 +2103,7 @@
21032103
((< len 1024)
21042104
(when firstP
21052105
(SG_PORT_UNLOCK_READ p)
2106-
(return (Sg_Substring buf 0 len)))
2106+
(return (Sg_Substring buf 0 (cast long len))))
21072107
(Sg_Writes out (SG_STRING_VALUE buf) len)
21082108
(break))
21092109
(else
@@ -2287,7 +2287,7 @@
22872287
(check-binary-port put-u8 p))
22882288
(check-output-port put-u8 p)
22892289
(check-fixnum-range put-u8 octet 0 255 <= <=)
2290-
(binary-port-write-u8-op p octet Sg_Putb))
2290+
(binary-port-write-u8-op p (cast uint8_t octet) Sg_Putb))
22912291

22922292
(define-c-proc put-bytevector
22932293
(p::<port> bv::<bytevector>

src/lib_fixnums.stub

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@
149149
(define-cise-stmt result-fixnum
150150
((_ ret who fx1 fx2)
151151
`(if (fixnum-fits? ,ret)
152-
(result ret)
152+
(result (cast long ret))
153153
(implementation-restriction-violation ',who "result is not a fixnum"
154154
(SG_LIST2 (SG_MAKE_INT fx1) (SG_MAKE_INT fx2))))))
155155

src/sagittarius/private/sagittariusdefs.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ typedef enum {
329329
#define SG_INT_VALUE(obj) (((long)SG_WORD(obj)) >> 2)
330330
#define SG_MAKE_INT(obj) SG_OBJ((intptr_t)((long)((unsigned long)(obj) << 2) + 1))
331331
/* Do not use this!!! */
332-
#define SG_ENSURE_INT(obj) SG_OBJ((long)(obj) | 1)
332+
#define SG_ENSURE_INT(obj) SG_OBJ((intptr_t)((long)(intptr_t)(obj) | 1))
333333
#define SG_UINTP(obj) (SG_INTP(obj)&&((long)SG_WORD(obj) >= 0))
334334
#define SG_INT_SIZE (SIZEOF_LONG * 8 - 3)
335335
#define SG_INT_MAX ((1L << SG_INT_SIZE) - 1)

0 commit comments

Comments
 (0)