Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 6eb2e96 in mainline for uspace/app/tetris/scores.c


Ignore:
Timestamp:
2009-04-10T07:53:54Z (13 years ago)
Author:
Jiri Svoboda <jirik.svoboda@…>
Branches:
lfn, master
Children:
3cc6a52
Parents:
f4b1535
Message:

str_cpy() and str_ncpy() in userspace. Nuke strcpy() and strncpy().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/tetris/scores.c

    rf4b1535 r6eb2e96  
    118118static void copyhiscore(int dest, int src)
    119119{
    120         strcpy(scores[dest].hs_name, scores[src].hs_name);
     120        str_cpy(scores[dest].hs_name, STR_BOUNDS(MAXLOGNAME) + 1,
     121            scores[src].hs_name);
    121122        scores[dest].hs_score = scores[src].hs_score;   
    122123        scores[dest].hs_level = scores[src].hs_level;
     
    132133        moveto(10 , 10);
    133134        puts("Insert your name: ");
    134         str_ncpy(scores[NUMSPOTS - 1].hs_name, "Player", MAXLOGNAME);
     135        str_cpy(scores[NUMSPOTS - 1].hs_name, STR_BOUNDS(MAXLOGNAME) + 1,
     136            "Player");
    135137        i = 6; off = 6;
    136138
     
    196198        int i;
    197199        for(i = 0; i < NUMSPOTS; i++) {
    198                 str_ncpy(scores[i].hs_name, "HelenOS Team", MAXLOGNAME);
     200                str_cpy(scores[i].hs_name, STR_BOUNDS(MAXLOGNAME) + 1, "HelenOS Team");
    199201                scores[i].hs_score = (NUMSPOTS - i) * 200;     
    200202                scores[i].hs_level = (i + 1 > MAXLEVEL?MAXLEVEL:i + 1);
Note: See TracChangeset for help on using the changeset viewer.