mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-14 10:09:48 +00:00
Removed unused code: fixes compiler warning with CC=gcc46
error: parameter 'fd' set but not used Approved by: cperciva MFC after: 1 week
This commit is contained in:
parent
097cd85002
commit
4001564661
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=231816
@ -462,89 +462,6 @@ MCParse(int fd)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MCReadCat(int fd)
|
||||
{
|
||||
fd = 0;
|
||||
#if 0
|
||||
MCHeaderT mcHead;
|
||||
MCMsgT mcMsg;
|
||||
MCSetT mcSet;
|
||||
msgT *msg;
|
||||
setT *set;
|
||||
int i;
|
||||
char *data;
|
||||
|
||||
/* XXX init sethead? */
|
||||
|
||||
if (read(fd, &mcHead, sizeof(mcHead)) != sizeof(mcHead))
|
||||
CORRUPT();
|
||||
if (strncmp(mcHead.magic, MCMagic, MCMagicLen) != 0)
|
||||
CORRUPT();
|
||||
if (mcHead.majorVer != MCMajorVer)
|
||||
error("unrecognized catalog version");
|
||||
if ((mcHead.flags & MCGetByteOrder()) == 0)
|
||||
error("wrong byte order");
|
||||
|
||||
if (lseek(fd, mcHead.firstSet, SEEK_SET) == -1)
|
||||
CORRUPT();
|
||||
|
||||
for (;;) {
|
||||
if (read(fd, &mcSet, sizeof(mcSet)) != sizeof(mcSet))
|
||||
CORRUPT();
|
||||
if (mcSet.invalid)
|
||||
continue;
|
||||
|
||||
set = xmalloc(sizeof(setT));
|
||||
memset(set, '\0', sizeof(*set));
|
||||
if (cat->first) {
|
||||
cat->last->next = set;
|
||||
set->prev = cat->last;
|
||||
cat->last = set;
|
||||
} else
|
||||
cat->first = cat->last = set;
|
||||
|
||||
set->setId = mcSet.setId;
|
||||
|
||||
/* Get the data */
|
||||
if (mcSet.dataLen) {
|
||||
data = xmalloc(mcSet.dataLen);
|
||||
if (lseek(fd, mcSet.data.off, SEEK_SET) == -1)
|
||||
CORRUPT();
|
||||
if (read(fd, data, mcSet.dataLen) != mcSet.dataLen)
|
||||
CORRUPT();
|
||||
if (lseek(fd, mcSet.u.firstMsg, SEEK_SET) == -1)
|
||||
CORRUPT();
|
||||
|
||||
for (i = 0; i < mcSet.numMsgs; ++i) {
|
||||
if (read(fd, &mcMsg, sizeof(mcMsg)) != sizeof(mcMsg))
|
||||
CORRUPT();
|
||||
if (mcMsg.invalid) {
|
||||
--i;
|
||||
continue;
|
||||
}
|
||||
msg = xmalloc(sizeof(msgT));
|
||||
memset(msg, '\0', sizeof(*msg));
|
||||
if (set->first) {
|
||||
set->last->next = msg;
|
||||
msg->prev = set->last;
|
||||
set->last = msg;
|
||||
} else
|
||||
set->first = set->last = msg;
|
||||
|
||||
msg->msgId = mcMsg.msgId;
|
||||
msg->str = xstrdup((char *) (data + mcMsg.msg.off));
|
||||
}
|
||||
free(data);
|
||||
}
|
||||
if (!mcSet.nextSet)
|
||||
break;
|
||||
if (lseek(fd, mcSet.nextSet, SEEK_SET) == -1)
|
||||
CORRUPT();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Write message catalog.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user