summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2021-09-05 00:08:16 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2021-09-05 00:08:16 +0000
commit614f9cb33043442fbbbb74604080e6703843338f (patch)
treee537240b46d630579c9c583d39aa006757d1386c /Build
parent284fd1dbd028dca7d04c670f08ff0862bacde814 (diff)
mplibdir: sync with the upstream
git-svn-id: svn://tug.org/texlive/trunk@60425 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r--Build/source/texk/web2c/mplibdir/lmplib.c10
-rw-r--r--Build/source/texk/web2c/mplibdir/mp.w32
-rw-r--r--Build/source/texk/web2c/mplibdir/mpxout.w2
3 files changed, 21 insertions, 23 deletions
diff --git a/Build/source/texk/web2c/mplibdir/lmplib.c b/Build/source/texk/web2c/mplibdir/lmplib.c
index 59b747c66dd..625072dd5e2 100644
--- a/Build/source/texk/web2c/mplibdir/lmplib.c
+++ b/Build/source/texk/web2c/mplibdir/lmplib.c
@@ -405,7 +405,7 @@ static int mplib_script_error_function(lua_State * L)
return 0;
}
-static char *mplib_run_script(MP mp, const char *str)
+static char *mplib_run_script(MP mp, const char *str, size_t len)
{
lua_State *L = (lua_State *)mp_userdata(mp);
lua_checkstack(L, 1);
@@ -413,7 +413,7 @@ static char *mplib_run_script(MP mp, const char *str)
if (lua_isfunction(L, -1)) {
char *s = NULL;
const char *x = NULL;
- lua_pushstring(L, str);
+ lua_pushlstring(L, str, len);
if (lua_pcall(L, 1, 1, 0) != 0) {
fprintf(stdout,"mplib warning: error in script: %s\n",lua_tostring(L, -1));
return NULL;
@@ -441,7 +441,7 @@ static int mplib_run_script_function(lua_State * L)
return 0;
}
-static char *mplib_make_text(MP mp, const char *str, int mode)
+static char *mplib_make_text(MP mp, const char *str, size_t len, int mode)
{
lua_State *L = (lua_State *)mp_userdata(mp);
lua_checkstack(L, 1);
@@ -449,7 +449,7 @@ static char *mplib_make_text(MP mp, const char *str, int mode)
if (lua_isfunction(L, -1)) {
char *s = NULL;
const char *x = NULL;
- lua_pushstring(L, str);
+ lua_pushlstring(L, str, len);
lua_pushinteger(L, mode);
if (lua_pcall(L, 2, 1, 0) != 0) {
mplib_script_error(mp, lua_tostring(L, -1));
@@ -1869,7 +1869,7 @@ static void mplib_stroked(lua_State * L, struct mp_stroked_object *h)
static void mplib_text(lua_State * L, struct mp_text_object *h)
{
if (FIELD(text)) {
- lua_pushstring(L, h->text_p);
+ lua_pushlstring(L, h->text_p, h->text_l);
} else if (FIELD(dsize)) {
mplib_push_number(L, (h->font_dsize / 16));
} else if (FIELD(font)) {
diff --git a/Build/source/texk/web2c/mplibdir/mp.w b/Build/source/texk/web2c/mplibdir/mp.w
index 469218c692b..58f3c5983cf 100644
--- a/Build/source/texk/web2c/mplibdir/mp.w
+++ b/Build/source/texk/web2c/mplibdir/mp.w
@@ -922,8 +922,8 @@ enum mp_filetype {
mp_filetype_text /* first text file for readfrom and writeto primitives */
};
typedef char *(*mp_file_finder) (MP, const char *, const char *, int);
-typedef char *(*mp_script_runner) (MP, const char *);
-typedef char *(*mp_text_maker) (MP, const char *, int mode);
+typedef char *(*mp_script_runner) (MP, const char *, size_t);
+typedef char *(*mp_text_maker) (MP, const char *, size_t, int);
typedef void *(*mp_file_opener) (MP, const char *, const char *, int);
typedef char *(*mp_file_reader) (MP, void *, size_t *);
typedef void (*mp_binfile_reader) (MP, void *, void **, size_t *);
@@ -960,25 +960,23 @@ static char *mp_find_file (MP mp, const char *fname, const char *fmode,
}
@ @c
-static char *mp_run_script (MP mp, const char *str) {
+static char *mp_run_script (MP mp, const char *str, size_t len) {
(void) mp;
- return mp_strdup (str);
+ return mp_strldup (str, len);
}
@ @c
-static char *mp_make_text (MP mp, const char *str, int mode) {
+static char *mp_make_text (MP mp, const char *str, size_t len, int mode) {
(void) mp;
- return mp_strdup (str);
+ return mp_strldup (str, len);
}
@ Because |mp_find_file| is used so early, it has to be in the helpers
section.
@<Declarations@>=
-static char *mp_find_file (MP mp, const char *fname, const char *fmode,
- int ftype);
-static void *mp_open_file (MP mp, const char *fname, const char *fmode,
- int ftype);
+static char *mp_find_file (MP mp, const char *fname, const char *fmode, int ftype);
+static void *mp_open_file (MP mp, const char *fname, const char *fmode, int ftype);
static char *mp_read_ascii_file (MP mp, void *f, size_t * size);
static void mp_read_binary_file (MP mp, void *f, void **d, size_t * size);
static void mp_close_file (MP mp, void *f);
@@ -986,8 +984,8 @@ static int mp_eof_file (MP mp, void *f);
static void mp_flush_file (MP mp, void *f);
static void mp_write_ascii_file (MP mp, void *f, const char *s);
static void mp_write_binary_file (MP mp, void *f, void *s, size_t t);
-static char *mp_run_script (MP mp, const char *str);
-static char *mp_make_text (MP mp, const char *str, int mode);
+static char *mp_run_script (MP mp, const char *str, size_t len);
+static char *mp_make_text (MP mp, const char *str, size_t len, int mode);
@ The function to open files can now be very short.
@@ -15855,7 +15853,7 @@ CONTINUE:
set_number_from_scaled (mp->cur_tt, 1);
goto NOT_FOUND;
}
-
+
if (number_to_scaled (mp->delx) - mp->tol <=
number_to_scaled (stack_max (x_packet (mp->xy))) - number_to_scaled (stack_min (u_packet (mp->uv))))
if (number_to_scaled (mp->delx) + mp->tol >=
@@ -18136,7 +18134,7 @@ new level (having, initially, the same properties as the old).
@d push_input { /* enter a new input level, save the old */
if ( mp->input_ptr>mp->max_in_stack ) {
mp->max_in_stack=mp->input_ptr;
- if ( mp->input_ptr==mp->stack_size ) {
+ if ( mp->input_ptr==mp->stack_size ) {
int l = (mp->stack_size+(mp->stack_size/4));
/* The mp->stack_size < 1001 condition is necessary to prevent C stack overflow due infinite recursion. */
if (l>1000) {fprintf(stderr, "input stack overflow\n");exit(EXIT_FAILURE);}
@@ -20004,7 +20002,7 @@ if (s != NULL) {
} else {
mp_back_input (mp);
if (cur_exp_str ()->len > 0) {
- char *s = mp->run_script(mp,(const char*) cur_exp_str()->str) ;
+ char *s = mp->run_script(mp,(const char*) cur_exp_str()->str, cur_exp_str()->len) ;
@<Run a script@>
free(s);
}
@@ -20150,7 +20148,7 @@ line and preceded by a space or at the beginning of a line.
}
/* action */
{
- char *s = mp->make_text(mp,ptr,verb) ;
+ char *s = mp->make_text(mp,ptr,size,verb) ;
@<Run a script@>
free(s);
}
@@ -20201,7 +20199,7 @@ line and preceded by a space or at the beginning of a line.
} else {
mp_back_input (mp);
if (cur_exp_str ()->len > 0) {
- char *s = mp->make_text(mp,(const char*) cur_exp_str()->str,0) ;
+ char *s = mp->make_text(mp,(const char*) cur_exp_str()->str,cur_exp_str()->len,0) ;
@<Run a script@>
free(s);
}
diff --git a/Build/source/texk/web2c/mplibdir/mpxout.w b/Build/source/texk/web2c/mplibdir/mpxout.w
index 96a1f3d776e..a54c3d8b6b5 100644
--- a/Build/source/texk/web2c/mplibdir/mpxout.w
+++ b/Build/source/texk/web2c/mplibdir/mpxout.w
@@ -3869,7 +3869,7 @@ static void mpx_cleandir(MPX mpx, char *cur_path) {
char *wrk, *p;
#ifdef _WIN32
struct _finddata_t c_file;
- long hFile;
+ intptr_t hFile;
#else
struct dirent *entry;
DIR *d;