mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 19:03:00 +00:00
[HHPCOMP]
Improve functionality of Windows MSVC build. Based on a WIP patch by Michael Fritscher. See CORE-10019. svn path=/trunk/; revision=68792
This commit is contained in:
parent
42df3d1b7e
commit
85a5a71d79
3 changed files with 29 additions and 6 deletions
|
@ -45,6 +45,11 @@
|
||||||
|
|
||||||
#define PACKAGE_STRING "hhpcomp development version"
|
#define PACKAGE_STRING "hhpcomp development version"
|
||||||
|
|
||||||
|
/* if O_BINARY is not defined, the system is probably not expecting any such flag */
|
||||||
|
#ifndef O_BINARY
|
||||||
|
#define O_BINARY 0
|
||||||
|
#endif
|
||||||
|
|
||||||
int chmc_section_add(struct chmcFile *chm, const char *name);
|
int chmc_section_add(struct chmcFile *chm, const char *name);
|
||||||
struct chmcSection * chmc_section_create(struct chmcFile *chm,
|
struct chmcSection * chmc_section_create(struct chmcFile *chm,
|
||||||
const char *name);
|
const char *name);
|
||||||
|
@ -133,7 +138,7 @@ int chmc_init(struct chmcFile *chm, const char *filename,
|
||||||
chm->config = config;
|
chm->config = config;
|
||||||
|
|
||||||
if (strcmp(filename, "-") != 0) {
|
if (strcmp(filename, "-") != 0) {
|
||||||
chm->fd = creat(filename, 0644);
|
chm->fd = open(filename, O_RDWR | O_CREAT | O_TRUNC | O_BINARY, 0644);
|
||||||
if (chm->fd < 0) {
|
if (chm->fd < 0) {
|
||||||
chmcerr_set(errno, strerror(errno));
|
chmcerr_set(errno, strerror(errno));
|
||||||
chmcerr_return_msg("creat file '%s'", filename);
|
chmcerr_return_msg("creat file '%s'", filename);
|
||||||
|
@ -978,7 +983,9 @@ static int _lzx_put_bytes(void *arg, int n, void *buf)
|
||||||
struct chmcLzxInfo *lzx_info = (struct chmcLzxInfo *)arg;
|
struct chmcLzxInfo *lzx_info = (struct chmcLzxInfo *)arg;
|
||||||
struct chmcSect0 *sect0 = &lzx_info->chm->sect0;
|
struct chmcSect0 *sect0 = &lzx_info->chm->sect0;
|
||||||
int wx;
|
int wx;
|
||||||
|
static int counter = 0;
|
||||||
|
|
||||||
|
counter += n;
|
||||||
wx = write(lzx_info->section->fd, buf, n);
|
wx = write(lzx_info->section->fd, buf, n);
|
||||||
sect0->file_len += wx;
|
sect0->file_len += wx;
|
||||||
lzx_info->section->len += wx;
|
lzx_info->section->len += wx;
|
||||||
|
@ -1025,7 +1032,7 @@ static int _lzx_get_bytes(void *arg, int n, void *buf)
|
||||||
// need to keep current entry file and offset trought blocks
|
// need to keep current entry file and offset trought blocks
|
||||||
// until last entry
|
// until last entry
|
||||||
while (todo) {
|
while (todo) {
|
||||||
// end of entris reached?
|
// end of entries reached?
|
||||||
if (lzx_info->pos == &chm->entries_list) {
|
if (lzx_info->pos == &chm->entries_list) {
|
||||||
lzx_info->eof = 1;
|
lzx_info->eof = 1;
|
||||||
break;
|
break;
|
||||||
|
@ -1046,7 +1053,7 @@ static int _lzx_get_bytes(void *arg, int n, void *buf)
|
||||||
else
|
else
|
||||||
if (lzx_info->fd == -1) {
|
if (lzx_info->fd == -1) {
|
||||||
// open file if it isn't
|
// open file if it isn't
|
||||||
lzx_info->fd = open(node->name, O_RDONLY);
|
lzx_info->fd = open(node->name, O_RDONLY | O_BINARY);
|
||||||
if (lzx_info->fd < 0) {
|
if (lzx_info->fd < 0) {
|
||||||
chmc_error("%s: %d: error %d: '%s' %s\n",
|
chmc_error("%s: %d: error %d: '%s' %s\n",
|
||||||
__FILE__, __LINE__,
|
__FILE__, __LINE__,
|
||||||
|
@ -1073,7 +1080,8 @@ static int _lzx_get_bytes(void *arg, int n, void *buf)
|
||||||
{
|
{
|
||||||
rx = read(lzx_info->fd, (char *)buf + (n - todo), toread);
|
rx = read(lzx_info->fd, (char *)buf + (n - todo), toread);
|
||||||
if (rx <= 0) {
|
if (rx <= 0) {
|
||||||
chmc_error("read error\n");
|
int temp = errno;
|
||||||
|
chmc_error("read error %s \n", strerror(temp));
|
||||||
lzx_info->error = 2;
|
lzx_info->error = 2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1610,18 +1618,24 @@ int chmc_write(struct chmcFile *chm)
|
||||||
|
|
||||||
assert(chm);
|
assert(chm);
|
||||||
|
|
||||||
|
chmc_dump("write itsf %d\n", _CHMC_ITSF_V3_LEN);
|
||||||
write(chm->fd, itsf, _CHMC_ITSF_V3_LEN);
|
write(chm->fd, itsf, _CHMC_ITSF_V3_LEN);
|
||||||
|
chmc_dump("write sect0 %d\n", _CHMC_SECT0_LEN);
|
||||||
write(chm->fd, sect0, _CHMC_SECT0_LEN);
|
write(chm->fd, sect0, _CHMC_SECT0_LEN);
|
||||||
|
chmc_dump("write itsp %d\n", _CHMC_ITSP_V1_LEN);
|
||||||
write(chm->fd, itsp, _CHMC_ITSP_V1_LEN);
|
write(chm->fd, itsp, _CHMC_ITSP_V1_LEN);
|
||||||
|
|
||||||
list_for_each(pos, &chm->pmgl_list) {
|
list_for_each(pos, &chm->pmgl_list) {
|
||||||
pmgl = list_entry(pos, struct chmcPmglChunkNode, list);
|
pmgl = list_entry(pos, struct chmcPmglChunkNode, list);
|
||||||
|
chmc_dump("write pmgl %d\n", _CHMC_CHUNK_LEN);
|
||||||
write(chm->fd, &pmgl->chunk, _CHMC_CHUNK_LEN);
|
write(chm->fd, &pmgl->chunk, _CHMC_CHUNK_LEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
chmc_dump("itsp->num_blocks %d", itsp->num_blocks);
|
||||||
if (itsp->num_blocks > 1) {
|
if (itsp->num_blocks > 1) {
|
||||||
list_for_each( pos, &chm->pmgi_list ) {
|
list_for_each( pos, &chm->pmgi_list ) {
|
||||||
pmgi = list_entry(pos, struct chmcPmgiChunkNode, list);
|
pmgi = list_entry(pos, struct chmcPmgiChunkNode, list);
|
||||||
|
chmc_dump("write pmgi %d\n", _CHMC_CHUNK_LEN);
|
||||||
write(chm->fd, &pmgi->chunk, _CHMC_CHUNK_LEN);
|
write(chm->fd, &pmgi->chunk, _CHMC_CHUNK_LEN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1640,7 +1654,7 @@ int chmc_appendfile(struct chmcFile *chm, const char *filename, void *buf,
|
||||||
if (stat(filename, &statbuf) < 0)
|
if (stat(filename, &statbuf) < 0)
|
||||||
return errno;
|
return errno;
|
||||||
|
|
||||||
in = open(filename, O_RDONLY);
|
in = open(filename, O_RDONLY | O_BINARY);
|
||||||
if (in >= 0) {
|
if (in >= 0) {
|
||||||
todo = statbuf.st_size;
|
todo = statbuf.st_size;
|
||||||
|
|
||||||
|
|
|
@ -62,11 +62,14 @@ int main(int argc, char** argv)
|
||||||
struct chmcFile chm;
|
struct chmcFile chm;
|
||||||
struct chmcConfig chm_config;
|
struct chmcConfig chm_config;
|
||||||
|
|
||||||
|
memset(&chm, 0, sizeof(struct chmcFile));
|
||||||
|
memset(&chm_config, 0, sizeof(struct chmcConfig));
|
||||||
chm_config.title = project_file.get_title_string().c_str();
|
chm_config.title = project_file.get_title_string().c_str();
|
||||||
chm_config.hhc = project_file.get_contents_file_string().c_str();
|
chm_config.hhc = project_file.get_contents_file_string().c_str();
|
||||||
chm_config.hhk = project_file.get_index_file_string().c_str();
|
chm_config.hhk = project_file.get_index_file_string().c_str();
|
||||||
chm_config.deftopic = project_file.get_default_topic_string().c_str();
|
chm_config.deftopic = project_file.get_default_topic_string().c_str();
|
||||||
chm_config.language = project_file.get_language_code();
|
chm_config.language = project_file.get_language_code();
|
||||||
|
chm_config.tmpdir = ".";
|
||||||
|
|
||||||
int err;
|
int err;
|
||||||
err = chmc_init(&chm, replace_backslashes(project_file.get_compiled_file_string()).c_str(), &chm_config);
|
err = chmc_init(&chm, replace_backslashes(project_file.get_compiled_file_string()).c_str(), &chm_config);
|
||||||
|
|
|
@ -46,6 +46,11 @@ typedef unsigned long gcc_uint64_t;
|
||||||
#define TMP_MAX 16384
|
#define TMP_MAX 16384
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* if O_BINARY is not defined, the system is probably not expecting any such flag */
|
||||||
|
#ifndef O_BINARY
|
||||||
|
#define O_BINARY 0
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
@deftypefn Replacement int mkstemps (char *@var{template}, int @var{suffix_len})
|
@deftypefn Replacement int mkstemps (char *@var{template}, int @var{suffix_len})
|
||||||
|
@ -87,6 +92,7 @@ mkstemps (
|
||||||
if ((int) len < 6 + suffix_len
|
if ((int) len < 6 + suffix_len
|
||||||
|| strncmp (&template[len - 6 - suffix_len], "XXXXXX", 6))
|
|| strncmp (&template[len - 6 - suffix_len], "XXXXXX", 6))
|
||||||
{
|
{
|
||||||
|
printf("wrong parameter\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,7 +127,7 @@ mkstemps (
|
||||||
#ifdef VMS
|
#ifdef VMS
|
||||||
fd = open (template, O_RDWR|O_CREAT|O_EXCL, 0600, "fop=tmd");
|
fd = open (template, O_RDWR|O_CREAT|O_EXCL, 0600, "fop=tmd");
|
||||||
#else
|
#else
|
||||||
fd = open (template, O_RDWR|O_CREAT|O_EXCL, 0600);
|
fd = open (template, O_RDWR|O_CREAT|O_EXCL|O_BINARY, 0600);
|
||||||
#endif
|
#endif
|
||||||
if (fd >= 0)
|
if (fd >= 0)
|
||||||
/* The file does not exist. */
|
/* The file does not exist. */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue