static int needs_dbentry (a_inode *aino) { const TCHAR *nn_begin; if (aino->deleted) return 0; if (! fsdb_mode_representable_p (aino, aino->amigaos_mode) || aino->comment != 0) return 1; nn_begin = nname_begin (aino->nname); return _tcscmp (nn_begin, aino->aname) != 0; }
static int needs_dbentry (a_inode *aino) { const char *an_begin, *nn_begin; if (aino->deleted) return 0; if (! fsdb_mode_representable_p (aino) || aino->comment != 0) return 1; nn_begin = nname_begin (aino->nname); return strcmp (nn_begin, aino->aname) != 0; }
static void write_aino (FILE *f, a_inode *aino) { char buf[1 + 4 + 257 + 257 + 81]; buf[0] = aino->needs_dbentry; do_put_mem_long ((uae_u32 *)(buf + 1), aino->amigaos_mode); strncpy (buf + 5, aino->aname, 256); buf[5 + 256] = '\0'; strncpy (buf + 5 + 257, nname_begin (aino->nname), 256); buf[5 + 257 + 256] = '\0'; strncpy (buf + 5 + 2*257, aino->comment ? aino->comment : "", 80); buf[5 + 2 * 257 + 80] = '\0'; fwrite (buf, 1, sizeof buf, f); aino->has_dbentry = aino->needs_dbentry; }
static void write_aino (FILE *f, a_inode *aino) { uae_u8 buf[1 + 4 + 257 + 257 + 81] = { 0 }; buf[0] = aino->needs_dbentry; do_put_mem_long ((uae_u32 *)(buf + 1), aino->amigaos_mode); strncpy ((char*)buf + 5, aino->aname, 256); buf[5 + 256] = '\0'; strncpy ((char*)buf + 5 + 257, nname_begin (aino->nname), 256); buf[5 + 257 + 256] = '\0'; strncpy ((char*)buf + 5 + 2 * 257, aino->comment ? aino->comment : _T(""), 80); buf[5 + 2 * 257 + 80] = '\0'; aino->db_offset = ftell (f); fwrite (buf, 1, sizeof buf, f); aino->has_dbentry = aino->needs_dbentry; TRACE ((_T("%d '%s' '%s' written\n"), aino->db_offset, aino->aname, aino->nname)); }
static void write_aino (FILE *f, a_inode *aino) { uae_u8 buf[1 + 4 + 257 + 257 + 81] = { 0 }; buf[0] = aino->needs_dbentry ? 1 : 0; do_put_mem_long ((uae_u32 *)(buf + 1), aino->amigaos_mode); ua_copy ((char*)buf + 5, 256, aino->aname); buf[5 + 256] = '\0'; ua_copy ((char*)buf + 5 + 257, 256, nname_begin (aino->nname)); buf[5 + 257 + 256] = '\0'; ua_copy ((char*)buf + 5 + 2 * 257, 80, aino->comment ? aino->comment : _T("")); buf[5 + 2 * 257 + 80] = '\0'; aino->db_offset = ftell (f); size_t isWritten = fwrite (buf, 1, sizeof buf, f); if (isWritten < sizeof(buf)) write_log("%s:%d [%s] - Failed to write %ld bytes (%ld/%ld)", __FILE__, __LINE__, __FUNCTION__, sizeof(buf) - isWritten, isWritten, sizeof(buf)); aino->has_dbentry = aino->needs_dbentry; TRACE ((_T("%d '%s' '%s' written\n"), aino->db_offset, aino->aname, aino->nname)); }
static void create_uaefsdb (a_inode *aino, uae_u8 *buf, int winmode) { TCHAR *nn; char *s; buf[0] = 1; do_put_mem_long ((uae_u32 *)(buf + 1), aino->amigaos_mode); s = ua_fs (aino->aname, -1); strncpy ((char*)buf + 5, s, 256); buf[5 + 256] = '\0'; xfree (s); nn = nname_begin (aino->nname); s = ua_fs (nn, -1); strncpy ((char*)buf + 5 + 257, s, 256); buf[5 + 257 + 256] = '\0'; xfree (s); s = ua_fs (aino->comment ? aino->comment : _T(""), -1); strncpy ((char*)buf + 5 + 2 * 257, s, 80); buf[5 + 2 * 257 + 80] = '\0'; xfree (s); do_put_mem_long ((uae_u32 *)(buf + 5 + 2 * 257 + 81), winmode); _tcsncpy ((TCHAR*)(buf + 604), aino->aname, 256); _tcsncpy ((TCHAR*)(buf + 1118), nn, 256); aino->has_dbentry = 0; }