Lines Matching refs:state
57 typedef struct State_s /* method state */
74 State_t* state;
78 if (!ar || !(state = (State_t*)ar->data))
83 if (state->touch && state->patch >= 0)
85 if (lseek(ar->fd, state->patch, SEEK_SET) != state->patch)
94 free(state);
107 State_t* state;
114 if (!(state = newof(0, State_t, 1, 0)))
116 ar->data = (void*)state;
117 state->patch = offsetof(Header_t, ar_date);
118 state->offset = sizeof(Header_t) + swapget(0, hdr->ar_syms, sizeof(hdr->ar_syms)) * sizeof(Symbol_t);
130 State_t* state = (State_t*)ar->data;
133 state->current = state->offset;
134 if (lseek(ar->fd, state->offset, SEEK_SET) != state->offset)
139 if (read(ar->fd, (char*)&state->member, sizeof(state->member)) != sizeof(state->member))
141 if ((z = read(ar->fd, (char*)&state->member, 1)) < 0)
148 ar->dirent.name = state->member.arf_name;
149 ar->dirent.mtime = swapget(0, (char*)&state->member.arf_date, sizeof(state->member.arf_date));
150 ar->dirent.uid = swapget(0, (char*)&state->member.arf_uid, sizeof(state->member.arf_uid));
151 ar->dirent.gid = swapget(0, (char*)&state->member.arf_gid, sizeof(state->member.arf_gid));
152 ar->dirent.mode = swapget(0, (char*)&state->member.arf_mode, sizeof(state->member.arf_mode));
153 ar->dirent.offset = state->offset += sizeof(state->member);
154 ar->dirent.size = swapget(0, (char*)&state->member.arf_size, sizeof(state->member.arf_size));
155 state->offset += ar->dirent.size + (ar->dirent.size & 01);
166 State_t* state = (State_t*)ar->data;
169 o = state->current + offsetof(Member_t, arf_date);
175 swapput(0, (char*)&state->member.arf_date, sizeof(state->member.arf_date), (intmax_t)ent->mtime);
176 if (write(ar->fd, &state->member.arf_date, sizeof(state->member.arf_date)) != sizeof(state->member.arf_date))
181 state->touch = 1;