зеркало из https://github.com/mozilla/gecko-dev.git
some hacks (and ifdefs) for macOS until NSPR gets fixed. This at least allows us to test out libReg and find bugs.
This commit is contained in:
Родитель
48dcd3da7a
Коммит
c2e0134749
|
@ -249,6 +249,7 @@ fail:
|
|||
static void nr_AddNode(REGFILE* pReg);
|
||||
static void nr_DeleteNode(REGFILE *pReg);
|
||||
static REGFILE* vr_findRegFile(char *filename);
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
static void nr_AddNode(REGFILE* pReg)
|
||||
|
@ -712,8 +713,22 @@ static REGERR nr_ReadHdr(REGFILE *reg)
|
|||
|
||||
static REGERR nr_WriteHdr(REGFILE *reg)
|
||||
{
|
||||
#ifdef XP_MAC
|
||||
#define HACK_WRITE_ENTIRE_RESERVE 1
|
||||
#endif
|
||||
|
||||
REGERR err;
|
||||
#if HACK_WRITE_ENTIRE_RESERVE
|
||||
/*
|
||||
* pinkerton
|
||||
* Until NSPR can be fixed to seek out past the EOF on MacOS, we need to make
|
||||
* sure that we write all 128 bytes to push out the EOF to the right location
|
||||
*/
|
||||
char hdrBuf[HDRRESERVE];
|
||||
memset(hdrBuf, NULL, HDRRESERVE);
|
||||
#else
|
||||
char hdrBuf[sizeof(REGHDR)];
|
||||
#endif
|
||||
|
||||
XP_ASSERT(reg);
|
||||
|
||||
|
@ -728,7 +743,7 @@ static REGERR nr_WriteHdr(REGFILE *reg)
|
|||
nr_WriteLong ( reg->hdr.root, hdrBuf + HDR_ROOT );
|
||||
|
||||
/* err = nr_WriteFile(reg->fh, 0, sizeof(REGHDR), ®->hdr); */
|
||||
err = nr_WriteFile(reg->fh, 0, sizeof(REGHDR), &hdrBuf);
|
||||
err = nr_WriteFile(reg->fh, 0, sizeof(hdrBuf), &hdrBuf);
|
||||
|
||||
if (err == REGERR_OK)
|
||||
reg->hdrDirty = 0;
|
||||
|
@ -764,6 +779,21 @@ static REGERR nr_CreateRoot(REGFILE *reg)
|
|||
root.valuebuf = 0;
|
||||
root.parent = 0;
|
||||
|
||||
#ifdef XP_MAC
|
||||
#define HACK_UNTIL_NSPR_DOES_SEEK_CORRECTLY 1
|
||||
#endif
|
||||
#if HACK_UNTIL_NSPR_DOES_SEEK_CORRECTLY
|
||||
/*
|
||||
* pinkerton
|
||||
* The AppendName() and AppendDesc() code that follows assumes that it can just
|
||||
* seek out past the end of the file and write a name and descriptor. However,
|
||||
* mac doesn't allow that. NSPR needs to be "fixed" somehow, but in the meantime,
|
||||
* we can just write out the header first, extending the EOF to 128 bytes where
|
||||
* the name and desc can follow w/out silently failing.
|
||||
*/
|
||||
nr_WriteHdr(reg);
|
||||
#endif
|
||||
|
||||
err = nr_AppendName(reg, ROOTKEY_STR, &root);
|
||||
if (err != REGERR_OK)
|
||||
return err;
|
||||
|
|
Загрузка…
Ссылка в новой задаче