@@ -1854,46 +1854,6 @@ void GLUT_DISPLAY_REQUEST();
1854
1854
1855
1855
extern qbs *WHATISMYIP();
1856
1856
1857
- // directory access defines
1858
- #define EPERM 1
1859
- #define ENOENT 2
1860
- #define ESRCH 3
1861
- #define EINTR 4
1862
- #define EIO 5
1863
- #define ENXIO 6
1864
- #define E2BIG 7
1865
- #define ENOEXEC 8
1866
- #define EBADF 9
1867
- #define ECHILD 10
1868
- #define EAGAIN 11
1869
- #define ENOMEM 12
1870
- #define EACCES 13
1871
- #define EFAULT 14
1872
- #define EBUSY 16
1873
- #define EEXIST 17
1874
- #define EXDEV 18
1875
- #define ENODEV 19
1876
- #define ENOTDIR 20
1877
- #define EISDIR 21
1878
- #define EINVAL 22
1879
- #define ENFILE 23
1880
- #define EMFILE 24
1881
- #define ENOTTY 25
1882
- #define EFBIG 27
1883
- #define ENOSPC 28
1884
- #define ESPIPE 29
1885
- #define EROFS 30
1886
- #define EMLINK 31
1887
- #define EPIPE 32
1888
- #define EDOM 33
1889
- #define ERANGE 34
1890
- #define EDEADLK 36
1891
- #define ENAMETOOint32 38
1892
- #define ENOLCK 39
1893
- #define ENOSYS 40
1894
- #define ENOTEMPTY 41
1895
- #define EILSEQ 42
1896
-
1897
1857
int32 lprint = 0; // set to 1 during LPRINT operations
1898
1858
int32 lprint_image = 0;
1899
1859
double lprint_last = 0; // TIMER(0.001) value at last time LPRINT was used
@@ -3550,7 +3510,7 @@ void convert_text_to_utf16(int32 fonthandle, void *buf, int32 size) {
3550
3510
unicode16_buf = (uint16 *)malloc(unicode16_buf_size);
3551
3511
}
3552
3512
// convert text
3553
- if ((fontflags[fonthandle] & FONT_LOAD_UNICODE) && ( fonthandle != NULL) ) { // unicode font
3513
+ if ((fontflags[fonthandle] & FONT_LOAD_UNICODE) && fonthandle) { // unicode font
3554
3514
if (size == 1)
3555
3515
size = 4;
3556
3516
convert_unicode(32, buf, size, 16, unicode16_buf);
@@ -13192,17 +13152,9 @@ void qbs_input(int32 numvariables, uint8 newline) {
13192
13152
c->chr[0] = 0;
13193
13153
qbs_set(qbs_input_arguements[argn], qbs_add(qbs_input_arguements[argn], c));
13194
13154
if (qbs_input_variabletypes[argn] & ISUNSIGNED) {
13195
- #ifdef QB64_WINDOWS
13196
- sscanf((char *)qbs_input_arguements[argn]->chr, "%I64u", (uint64 *)qbs_input_variableoffsets[argn]);
13197
- #else
13198
- sscanf((char *)qbs_input_arguements[argn]->chr, "%llu", (uint64 *)qbs_input_variableoffsets[argn]);
13199
- #endif
13155
+ sscanf((char *)qbs_input_arguements[argn]->chr, "%" SCNu64, (uint64_t *)qbs_input_variableoffsets[argn]);
13200
13156
} else {
13201
- #ifdef QB64_WINDOWS
13202
- sscanf((char *)qbs_input_arguements[argn]->chr, "%I64i", (int64 *)qbs_input_variableoffsets[argn]);
13203
- #else
13204
- sscanf((char *)qbs_input_arguements[argn]->chr, "%lli", (int64 *)qbs_input_variableoffsets[argn]);
13205
- #endif
13157
+ sscanf((char *)qbs_input_arguements[argn]->chr, "%" SCNd64, (int64_t *)qbs_input_variableoffsets[argn]);
13206
13158
}
13207
13159
goto typechecked;
13208
13160
}
@@ -13987,12 +13939,8 @@ finish:;
13987
13939
}
13988
13940
built_number[i] = 69;
13989
13941
i++; // E
13990
- // add exponent
13991
- #ifdef QB64_WINDOWS
13992
- i2 = sprintf((char *)&built_number[i], "%I64i", exponent_value);
13993
- #else
13994
- i2 = sprintf((char *)&built_number[i], "%lli", exponent_value);
13995
- #endif
13942
+ // add exponent
13943
+ i2 = sprintf((char *)&built_number[i], "%" PRId64, exponent_value);
13996
13944
i = i + i2;
13997
13945
} else {
13998
13946
built_number[i] = 48;
@@ -14986,11 +14934,7 @@ int32 n_float() {
14986
14934
}
14987
14935
built[i] = 69;
14988
14936
i++; // E
14989
- #ifdef QB64_WINDOWS
14990
- i2 = sprintf((char *)&built[i], "%I64i", n_exp);
14991
- #else
14992
- i2 = sprintf((char *)&built[i], "%lli", n_exp);
14993
- #endif
14937
+ i2 = sprintf((char *)&built[i], "%" PRId64, n_exp);
14994
14938
i = i + i2;
14995
14939
built[i] = 0; // NULL terminate for sscanf
14996
14940
@@ -18104,7 +18048,7 @@ void sub_bsave(qbs *filename, int32 offset, int32 size) {
18104
18048
size &= 0xFFFF;
18105
18049
qbs_set(tqbs, qbs_add(filename, nullt)); // prepare null-terminated filename
18106
18050
fh.open(filepath_fix_directory(tqbs), std::ios::binary | std::ios::out);
18107
- if (fh.is_open() == NULL ) {
18051
+ if (! fh.is_open()) {
18108
18052
error(64);
18109
18053
return;
18110
18054
} // Bad file name
@@ -18145,7 +18089,7 @@ void sub_bload(qbs *filename, int32 offset, int32 passed) {
18145
18089
}
18146
18090
qbs_set(tqbs, qbs_add(filename, nullt)); // prepare null-terminated filename
18147
18091
fh.open(filepath_fix_directory(tqbs), std::ios::binary | std::ios::in);
18148
- if (fh.is_open() == NULL ) {
18092
+ if (! fh.is_open()) {
18149
18093
error(53);
18150
18094
return;
18151
18095
} // File not found
@@ -21739,11 +21683,7 @@ int32 print_using(qbs *f, int32 s2, qbs *dest, qbs *pu_str) {
21739
21683
int32 print_using_integer64(qbs *format, int64 value, int32 start, qbs *output) {
21740
21684
if (is_error_pending())
21741
21685
return 0;
21742
- #ifdef QB64_WINDOWS
21743
- pu_ndig = sprintf((char *)pu_buf, "% I64i", value);
21744
- #else
21745
- pu_ndig = sprintf((char *)pu_buf, "% lli", value);
21746
- #endif
21686
+ pu_ndig = sprintf((char *)pu_buf, "% " PRId64, value);
21747
21687
if (pu_buf[0] == 45)
21748
21688
pu_neg = 1;
21749
21689
else
@@ -21758,11 +21698,7 @@ int32 print_using_integer64(qbs *format, int64 value, int32 start, qbs *output)
21758
21698
int32 print_using_uinteger64(qbs *format, uint64 value, int32 start, qbs *output) {
21759
21699
if (is_error_pending())
21760
21700
return 0;
21761
- #ifdef QB64_WINDOWS
21762
- pu_ndig = sprintf((char *)pu_dig, "%I64u", value);
21763
- #else
21764
- pu_ndig = sprintf((char *)pu_dig, "%llu", value);
21765
- #endif
21701
+ pu_ndig = sprintf((char *)pu_dig, "%" PRIu64, value);
21766
21702
pu_neg = 0;
21767
21703
pu_dp = 0;
21768
21704
start = print_using(format, start, output, NULL);
@@ -23141,7 +23077,7 @@ void *tcp_host_open(int64 port) {
23141
23077
int sockfd;
23142
23078
char str_port[6];
23143
23079
int yes = 1;
23144
- snprintf(str_port, 6, "%d" , port);
23080
+ snprintf(str_port, 6, "%" PRId64 , port);
23145
23081
memset(&hints, 0, sizeof(hints));
23146
23082
hints.ai_family = AF_INET;
23147
23083
hints.ai_socktype = SOCK_STREAM;
@@ -23231,7 +23167,7 @@ void *tcp_client_open(uint8 *host, int64 port) {
23231
23167
struct addrinfo hints, *servinfo, *p;
23232
23168
int sockfd;
23233
23169
char str_port[6];
23234
- snprintf(str_port, 6, "%d" , port);
23170
+ snprintf(str_port, 6, "%" PRId64 , port);
23235
23171
memset(&hints, 0, sizeof(hints));
23236
23172
hints.ai_family = AF_INET;
23237
23173
hints.ai_socktype = SOCK_STREAM;
@@ -23952,13 +23888,13 @@ void sub__allowfullscreen(int32 method, int32 smooth) {
23952
23888
fullscreen_allowedmode = method;
23953
23889
if (method == 3 || method == 5)
23954
23890
fullscreen_allowedmode = -1;
23955
- if (method == 4 || method == NULL )
23891
+ if (method == 4 || method == 0 )
23956
23892
fullscreen_allowedmode = 0;
23957
23893
23958
23894
fullscreen_allowedsmooth = smooth;
23959
23895
if (smooth == 2 || smooth == 4)
23960
23896
fullscreen_allowedsmooth = -1;
23961
- if (smooth == 3 || smooth == NULL )
23897
+ if (smooth == 3 || smooth == 0 )
23962
23898
fullscreen_allowedsmooth = 0;
23963
23899
}
23964
23900
0 commit comments