diff options
author | Nils Wallménius <nils@rockbox.org> | 2009-07-14 13:57:45 +0000 |
---|---|---|
committer | Nils Wallménius <nils@rockbox.org> | 2009-07-14 13:57:45 +0000 |
commit | 3d4701a6e41616cf581a297bab1451cf2db70249 (patch) | |
tree | f845837c96ffbed7d59ddf8308f3b3e7c40cb8c9 /apps/plugins/sokoban.c | |
parent | c2900a1bacd5d98b57a0d15ea2add1bc08764057 (diff) | |
download | rockbox-3d4701a6e41616cf581a297bab1451cf2db70249.tar.gz rockbox-3d4701a6e41616cf581a297bab1451cf2db70249.zip |
FS#10080
* Move strncpy() from core to the pluginlib
* Introduce strlcpy() and use that instead in most places (use memcpy in a few) in core and some plugins
* Drop strncpy() from the codec api as no codec used it
* Bump codec and plugin api versions
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21863 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/sokoban.c')
-rw-r--r-- | apps/plugins/sokoban.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/apps/plugins/sokoban.c b/apps/plugins/sokoban.c index 8672249bdc..bfd400b408 100644 --- a/apps/plugins/sokoban.c +++ b/apps/plugins/sokoban.c | |||
@@ -689,7 +689,8 @@ static bool redo(void) | |||
689 | 689 | ||
690 | static void init_boards(void) | 690 | static void init_boards(void) |
691 | { | 691 | { |
692 | rb->strncpy(buffered_boards.filename, SOKOBAN_LEVELS_FILE, MAX_PATH); | 692 | rb->strlcpy(buffered_boards.filename, SOKOBAN_LEVELS_FILE, |
693 | sizeof(buffered_boards.filename)); | ||
693 | 694 | ||
694 | current_info.level.index = 0; | 695 | current_info.level.index = 0; |
695 | current_info.player.row = 0; | 696 | current_info.player.row = 0; |
@@ -1026,8 +1027,8 @@ static bool save(char *filename, bool solution) | |||
1026 | 1027 | ||
1027 | /* Create dir if it doesn't exist */ | 1028 | /* Create dir if it doesn't exist */ |
1028 | if ((loc = rb->strrchr(filename, '/')) != NULL) { | 1029 | if ((loc = rb->strrchr(filename, '/')) != NULL) { |
1029 | rb->strncpy(dirname, filename, loc - filename); | 1030 | rb->strlcpy(dirname, filename, loc - filename + 1); |
1030 | dirname[loc - filename] = '\0'; | 1031 | |
1031 | if(!(dir = rb->opendir(dirname))) | 1032 | if(!(dir = rb->opendir(dirname))) |
1032 | rb->mkdir(dirname); | 1033 | rb->mkdir(dirname); |
1033 | else | 1034 | else |
@@ -1082,7 +1083,9 @@ static bool load(char *filename, bool silent) | |||
1082 | if (rb->strncmp(buf, "Sokoban", 7) != 0) { | 1083 | if (rb->strncmp(buf, "Sokoban", 7) != 0) { |
1083 | rb->close(fd); | 1084 | rb->close(fd); |
1084 | 1085 | ||
1085 | rb->strncpy(buffered_boards.filename, filename, MAX_PATH); | 1086 | rb->strlcpy(buffered_boards.filename, filename, |
1087 | sizeof(buffered_boards.filename)); | ||
1088 | |||
1086 | if (!read_levels(true)) | 1089 | if (!read_levels(true)) |
1087 | return false; | 1090 | return false; |
1088 | 1091 | ||