Mercurial > dwindows
comparison dwtest.c @ 2855:86286f528adf
Fix new safety warnings reported by the new GCC on Linux.
The semaphore code is used on other platforms... make sure
all platforms using this code are the same.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Tue, 15 Nov 2022 03:50:00 +0000 |
parents | 8a5131cbbe93 |
children | 4b075e64536c |
comparison
equal
deleted
inserted
replaced
2854:8a5131cbbe93 | 2855:86286f528adf |
---|---|
342 | 342 |
343 /* When hpma is not NULL we are printing.. so handle things differently */ | 343 /* When hpma is not NULL we are printing.. so handle things differently */ |
344 void draw_file(int row, int col, int nrows, int fheight, HPIXMAP hpma) | 344 void draw_file(int row, int col, int nrows, int fheight, HPIXMAP hpma) |
345 { | 345 { |
346 HPIXMAP hpm = hpma ? hpma : text2pm; | 346 HPIXMAP hpm = hpma ? hpma : text2pm; |
347 char buf[10]; | 347 char buf[15] = {0}; |
348 int i,y,fileline; | 348 int i,y,fileline; |
349 char *pLine; | 349 char *pLine; |
350 | 350 |
351 if(current_file) | 351 if(current_file) |
352 { | 352 { |
357 | 357 |
358 for(i = 0;(i < nrows) && (i+row < num_lines); i++) | 358 for(i = 0;(i < nrows) && (i+row < num_lines); i++) |
359 { | 359 { |
360 fileline = i + row - 1; | 360 fileline = i + row - 1; |
361 y = i*fheight; | 361 y = i*fheight; |
362 dw_color_background_set(1 + (fileline % 15) ); | 362 dw_color_background_set(1 + (fileline % 15)); |
363 dw_color_foreground_set(fileline < 0 ? DW_CLR_WHITE : fileline % 16); | 363 dw_color_foreground_set(fileline < 0 ? DW_CLR_WHITE : fileline % 16); |
364 if(!hpma) | 364 if(!hpma) |
365 { | 365 { |
366 sprintf( buf, "%6.6d", i+row ); | 366 snprintf(buf, 15, "%6.6d", i+row); |
367 dw_draw_text( 0, text1pm, 0, y, buf); | 367 dw_draw_text(0, text1pm, 0, y, buf); |
368 } | 368 } |
369 pLine = lp[i+row]; | 369 pLine = lp[i+row]; |
370 dw_draw_text(0, hpm, 0, y, pLine+col); | 370 dw_draw_text(0, hpm, 0, y, pLine+col); |
371 } | 371 } |
372 } | 372 } |