Skip to content

Commit b3eb9a3

Browse files
committed
crengine/Tools: Win32 fixes.
1 parent 5654de4 commit b3eb9a3

3 files changed

Lines changed: 39 additions & 10 deletions

File tree

crengine/Tools/blend-algo-test/blend_over_gray_test.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,11 @@ int main() {
165165
// build input test file
166166
printf("Preparing data (random)... ");
167167
fflush(stdout);
168+
#ifdef _WIN32
169+
srand(time(0));
170+
#else
168171
srandom(time(0));
172+
#endif
169173
int* test_inp_data = (int*)malloc(TEST_POINTS_COUNT*sizeof(int));
170174
int* test_alpha_data = (int*)malloc(TEST_POINTS_COUNT*sizeof(int));
171175
int* test_color_data = (int*)malloc(TEST_POINTS_COUNT*sizeof(int));
@@ -175,13 +179,19 @@ int main() {
175179
}
176180
long j;
177181
for (j = 0; j < TEST_POINTS_COUNT; j++) {
182+
#ifdef _WIN32
183+
test_inp_data[j] = (int)(300L*rand()/RAND_MAX);
184+
test_alpha_data[j] = (int)(300L*rand()/RAND_MAX);
185+
test_color_data[j] = (int)(300L*rand()/RAND_MAX);
186+
#else
178187
test_inp_data[j] = (int)(300L*random()/RAND_MAX);
188+
test_alpha_data[j] = (int)(300L*random()/RAND_MAX);
189+
test_color_data[j] = (int)(300L*random()/RAND_MAX);
190+
#endif
179191
if (test_inp_data[j] > 255)
180192
test_inp_data[j] = 255;
181-
test_alpha_data[j] = (int)(300L*random()/RAND_MAX);
182193
if (test_alpha_data[j] > 255)
183194
test_alpha_data[j] = 255;
184-
test_color_data[j] = (int)(300L*random()/RAND_MAX);
185195
if (test_color_data[j] > 255)
186196
test_color_data[j] = 255;
187197
}

crengine/Tools/blend-algo-test/blend_over_rgb_test.c

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,11 @@ int main() {
203203
// build input test file
204204
printf("Preparing data (random)... ");
205205
fflush(stdout);
206+
#ifdef _WIN32
207+
srand(time(0));
208+
#else
206209
srandom(time(0));
210+
#endif
207211
uint32_t* test_inp_data = (uint32_t*)malloc(TEST_POINTS_COUNT*sizeof(int));
208212
uint32_t* test_color_data = (uint32_t*)malloc(TEST_POINTS_COUNT*sizeof(int));
209213
int* test_alpha_r_data = (int*)malloc(TEST_POINTS_COUNT*sizeof(int));
@@ -216,34 +220,49 @@ int main() {
216220
long j;
217221
long r, g, b;
218222
for (j = 0; j < TEST_POINTS_COUNT; j++) {
223+
#ifdef _WIN32
224+
r = 300L*rand()/RAND_MAX;
225+
g = 300L*rand()/RAND_MAX;
226+
b = 300L*rand()/RAND_MAX;
227+
test_alpha_r_data[j] = (int)(300L*rand()/RAND_MAX);
228+
test_alpha_g_data[j] = (int)(300L*rand()/RAND_MAX);
229+
test_alpha_b_data[j] = (int)(300L*rand()/RAND_MAX);
230+
#else
219231
r = 300L*random()/RAND_MAX;
232+
g = 300L*random()/RAND_MAX;
233+
b = 300L*random()/RAND_MAX;
234+
test_alpha_r_data[j] = (int)(300L*random()/RAND_MAX);
235+
test_alpha_g_data[j] = (int)(300L*random()/RAND_MAX);
236+
test_alpha_b_data[j] = (int)(300L*random()/RAND_MAX);
237+
#endif
220238
if (r > 255)
221239
r = 255;
222-
g = 300L*random()/RAND_MAX;
223240
if (g > 255)
224241
g = 255;
225-
b = 300L*random()/RAND_MAX;
226242
if (b > 255)
227243
b = 255;
228244
test_inp_data[j] = (uint32_t)((r << 16) | (g << 8) | b);
229245

230-
test_alpha_r_data[j] = (int)(300L*random()/RAND_MAX);
231246
if (test_alpha_r_data[j] > 255)
232247
test_alpha_r_data[j] = 255;
233-
test_alpha_g_data[j] = (int)(300L*random()/RAND_MAX);
234248
if (test_alpha_g_data[j] > 255)
235249
test_alpha_g_data[j] = 255;
236-
test_alpha_b_data[j] = (int)(300L*random()/RAND_MAX);
237250
if (test_alpha_b_data[j] > 255)
238251
test_alpha_b_data[j] = 255;
239252

253+
#ifdef _WIN32
254+
r = 300L*rand()/RAND_MAX;
255+
g = 300L*rand()/RAND_MAX;
256+
b = 300L*rand()/RAND_MAX;
257+
#else
240258
r = 300L*random()/RAND_MAX;
259+
g = 300L*random()/RAND_MAX;
260+
b = 300L*random()/RAND_MAX;
261+
#endif
241262
if (r > 255)
242263
r = 255;
243-
g = 300L*random()/RAND_MAX;
244264
if (g > 255)
245265
g = 255;
246-
b = 300L*random()/RAND_MAX;
247266
if (b > 255)
248267
b = 255;
249268
test_color_data[j] = (uint32_t)((r << 16) | (g << 8) | b);

crengine/Tools/zip-test/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ int main(int argc, char* argv[])
3535
if ( item->IsContainer())
3636
continue;
3737
list.add( item->GetName() );
38-
list.add( lString32::itoa(item->GetSize()) );
38+
list.add( lString32::itoa((lUInt64)item->GetSize()) );
3939
}
4040
} else {
4141
printf("Failed to open archive!\n");

0 commit comments

Comments
 (0)