TEST_F(IOFSTest, FilenameValid) { char v1[] = "/dev/fs/data"; char iv1[] = "data"; char iv2[] = "/dev/fs/a c"; char iv3[] = "/dev/fs/"; EXPECT_TRUE(filename_valid(v1)); EXPECT_FALSE(filename_valid(iv1)); EXPECT_FALSE(filename_valid(iv2)); EXPECT_FALSE(filename_valid(iv3)); }
static uint32_t wanted_dir_entry(const FatDirectoryEntry_t dir_entry) { uint32_t i = 0; // we may see the following. Validate all or keep looking // entry with invalid or reserved first byte // entry with a false filesize. while (known_extensions[i] != 0) { if(1 == filename_valid(dir_entry.filename[0])) { if (0 == strncmp(known_extensions[i], (const char *)&dir_entry.filename[8], 3)) { return (dir_entry.filesize) ? 1 : 0; } } i++; } return 0; }