projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
rnd-19990315-1-src
[rocksndiamonds.git]
/
src
/
files.c
diff --git
a/src/files.c
b/src/files.c
index a7238908437ca22db1bd06af9266af1ce6b4e600..000992012cb38657d255a7f4e9bdd9f6d34644fb 100644
(file)
--- a/
src/files.c
+++ b/
src/files.c
@@
-827,15
+827,15
@@
void LoadScore(int level_nr)
fscanf(file, "%d", &highscore[i].Score);
fgets(line, MAX_LINE_LEN, file);
fscanf(file, "%d", &highscore[i].Score);
fgets(line, MAX_LINE_LEN, file);
- if (line[strlen(line)
-
1] == '\n')
- line[strlen(line)
-
1] = '\0';
+ if (line[strlen(line)
-
1] == '\n')
+ line[strlen(line)
-
1] = '\0';
for (line_ptr = line; *line_ptr; line_ptr++)
{
if (*line_ptr != ' ' && *line_ptr != '\t' && *line_ptr != '\0')
{
for (line_ptr = line; *line_ptr; line_ptr++)
{
if (*line_ptr != ' ' && *line_ptr != '\t' && *line_ptr != '\0')
{
- strncpy(highscore[i].Name, line_ptr, MAX_
NAMELEN - 1
);
- highscore[i].Name[MAX_
NAMELEN - 1
] = '\0';
+ strncpy(highscore[i].Name, line_ptr, MAX_
PLAYER_NAME_LEN
);
+ highscore[i].Name[MAX_
PLAYER_NAME_LEN
] = '\0';
break;
}
}
break;
}
}
@@
-1572,11
+1572,11
@@
void LoadSetup()
freeSetupFileList(setup_file_list);
/* needed to work around problems with fixed length strings */
freeSetupFileList(setup_file_list);
/* needed to work around problems with fixed length strings */
- if (strlen(setup.player_name) >
= MAX_NAME
LEN)
- setup.player_name[MAX_
NAMELEN - 1
] = '\0';
- else if (strlen(setup.player_name) < MAX_
NAMELEN - 1
)
+ if (strlen(setup.player_name) >
MAX_PLAYER_NAME_
LEN)
+ setup.player_name[MAX_
PLAYER_NAME_LEN
] = '\0';
+ else if (strlen(setup.player_name) < MAX_
PLAYER_NAME_LEN
)
{
{
- char *new_name = checked_malloc(MAX_
NAMELEN
);
+ char *new_name = checked_malloc(MAX_
PLAYER_NAME_LEN + 1
);
strcpy(new_name, setup.player_name);
free(setup.player_name);
strcpy(new_name, setup.player_name);
free(setup.player_name);