- 0 char (from P Moura);
- stack shifting - uninitialized pointers in jpl
This commit is contained in:
parent
e7535dd2ee
commit
1a6e97655b
@ -632,8 +632,8 @@ overflow:
|
||||
*pt0 = to_visit->oldv;
|
||||
}
|
||||
#endif
|
||||
reset_trail(TR0);
|
||||
pop_text_stack(lvl);
|
||||
clean_dirty_tr(TR0 PASS_REGS);
|
||||
pop_text_stack(lvl);
|
||||
return -1;
|
||||
|
||||
trail_overflow:
|
||||
|
15
C/text.c
15
C/text.c
@ -293,8 +293,11 @@ static void *codes2buf(Term t0, void *b0, bool get_codes,
|
||||
Yap_ThrowError(REPRESENTATION_ERROR_CHARACTER_CODE, hd,
|
||||
"scanning list of character codes, found %d", code);
|
||||
return NULL;
|
||||
}
|
||||
}else if (code == 0) {
|
||||
length += 2;
|
||||
} else {
|
||||
length += put_utf8(ar, code);
|
||||
}
|
||||
t = TailOfTerm(t);
|
||||
if (IsVarTerm(t)) {
|
||||
Yap_ThrowError(INSTANTIATION_ERROR, t, "scanning list of codes");
|
||||
@ -320,8 +323,11 @@ static void *codes2buf(Term t0, void *b0, bool get_codes,
|
||||
if (code < 0) {
|
||||
Yap_ThrowError(TYPE_ERROR_CHARACTER, hd, "scanning list of atoms");
|
||||
return NULL;
|
||||
} else if (code == 0) {
|
||||
length += 2;
|
||||
} else {
|
||||
length += strlen(code);
|
||||
}
|
||||
length += strlen(code);
|
||||
t = TailOfTerm(t);
|
||||
if (IsVarTerm(t)) {
|
||||
Yap_ThrowError(INSTANTIATION_ERROR, t, "scanning list of codes");
|
||||
@ -348,6 +354,11 @@ static void *codes2buf(Term t0, void *b0, bool get_codes,
|
||||
Term hd = HeadOfTerm(t);
|
||||
Int code = IntegerOfTerm(hd);
|
||||
|
||||
if (code == 0) {
|
||||
st[0] = 0xC0;
|
||||
st[1] = 0x80;
|
||||
st +=2;
|
||||
} else
|
||||
st = st + put_utf8(st, code);
|
||||
t = TailOfTerm(t);
|
||||
}
|
||||
|
@ -476,10 +476,10 @@ AtomIsSymbols(unsigned char *s) /* Is this atom just formed by symbols ? */
|
||||
static void write_quoted(wchar_t ch, wchar_t quote, wrf stream) {
|
||||
CACHE_REGS
|
||||
if (!(Yap_GetModuleEntry(CurrentModule)->flags & M_CHARESCAPE)) {
|
||||
wrputc(ch, stream);
|
||||
if (ch == '\'')
|
||||
wrputc('\'', stream); /* be careful about quotes */
|
||||
return;
|
||||
wrputc(ch, stream);
|
||||
if (ch == '\'')
|
||||
wrputc('\'', stream); /* be careful about quotes */
|
||||
return;
|
||||
}
|
||||
if (!(ch < 0xff && chtype(ch) == BS) && ch != '\'' && ch != '\\' &&
|
||||
ch != '`') {
|
||||
|
@ -43,7 +43,11 @@ INLINE_ONLY utf8proc_ssize_t get_utf8(const utf8proc_uint8_t *ptr,
|
||||
INLINE_ONLY utf8proc_ssize_t get_utf8(const utf8proc_uint8_t *ptr,
|
||||
size_t n,
|
||||
utf8proc_int32_t *valp) {
|
||||
utf8proc_ssize_t rc = utf8proc_iterate(ptr, n, valp);
|
||||
if (ptr[0] == 0xC0 && ptr[1] == 0x80) {
|
||||
*valp = 0;
|
||||
return 2;
|
||||
}
|
||||
utf8proc_ssize_t rc = utf8proc_iterate(ptr, n, valp);
|
||||
if (rc < 0) {
|
||||
// LOCAL_ActiveError->errorNo = REPRESENTATION_ERROR_IN_CHARACTER_CODE;
|
||||
}
|
||||
@ -55,9 +59,9 @@ INLINE_ONLY utf8proc_ssize_t put_utf8(utf8proc_uint8_t *ptr,
|
||||
|
||||
INLINE_ONLY utf8proc_ssize_t put_utf8(utf8proc_uint8_t *ptr,
|
||||
utf8proc_int32_t val) {
|
||||
utf8proc_ssize_t rc = utf8proc_encode_char(val, ptr);
|
||||
utf8proc_ssize_t rc = utf8proc_encode_char(val, ptr);
|
||||
if (rc < 0) {
|
||||
// LOCAL_ActiveError->errorNo = REPRESENTATION_ERROR_CHARACTER_CODE;
|
||||
// LOCAL_ActiveError->errorNo = REPRESENTATION_ERROR_CHARACTER_CODE;
|
||||
}
|
||||
return rc < 1 ? 1 : rc;
|
||||
}
|
||||
|
@ -641,18 +641,20 @@ X_API int PL_get_atom_chars(term_t ts, char **a) /* SAM check type */
|
||||
return 0;
|
||||
}
|
||||
src = (char *)RepAtom(AtomOfTerm(t))->StrOfAE;
|
||||
if (!a)
|
||||
return 0;
|
||||
if (*a && *a != src)
|
||||
strcpy(*a, src);
|
||||
else
|
||||
*a = src;
|
||||
if (!src)
|
||||
return 0;
|
||||
if ( !*a ) {
|
||||
*a = src;
|
||||
} else if (src[0] == '\0') {
|
||||
(*a)[0] = src[0];
|
||||
} else {
|
||||
strcpy(*a, src);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/** @brief *a is assigned the string representation of the atom in term ts, and
|
||||
* *len its size, or the operation fails
|
||||
*
|
||||
/** @brief *a is assigned the string representation of the atom in term ts, and
|
||||
* *len its size, or the operation fails
|
||||
*
|
||||
*/
|
||||
X_API int PL_get_atom_nchars(term_t ts, size_t *len,
|
||||
char **s) /* SAM check type */
|
||||
|
@ -2600,7 +2600,7 @@ jni_func_1_plc(
|
||||
jobject j; /* " */
|
||||
/* jlong jl; // " */
|
||||
void *p1; /* temp for converted (JVM) arg */
|
||||
char *c1; /* " */
|
||||
char *c1 = NULL; /* " */
|
||||
int i1; /* " */
|
||||
/* jlong l1; // " */
|
||||
/* double d1; // " */
|
||||
@ -2950,8 +2950,8 @@ jni_func_3_plc(
|
||||
void *p2; /* " */
|
||||
void *p3; /* " */
|
||||
/* char *c1; // " */
|
||||
char *c2; /* " */
|
||||
char *c3; /* " */
|
||||
char *c2 = NULL; /* " */
|
||||
char *c3 = NULL; /* " */
|
||||
int i1; /* " */
|
||||
/* int i2; // " */
|
||||
/* int i3; // " */
|
||||
@ -3297,7 +3297,7 @@ jpl_do_jpl_init( /* to be called once only, after PL init, before any JPL calls
|
||||
{
|
||||
jclass tc; /* temporary class ref */
|
||||
jobject ta; /* temporary array ref */
|
||||
char *msg; /* error message for exceptions thrown here */
|
||||
char *msg = NULL; /* error message for exceptions thrown here */
|
||||
int i; /* loop counter */
|
||||
jobject to; /* temporary (String) object ref */
|
||||
|
||||
|
Reference in New Issue
Block a user