Example #1
0
static void WriteBytesNativeString(void *addr, UInt count) {
  Obj target = TLS(SerializationObj);
  UInt size = GET_LEN_STRING(target);
  GROW_STRING(target, size + count + 1);
  memcpy(CSTR_STRING(target) + size, addr, count);
  SET_LEN_STRING(target, size + count);
}
Example #2
0
static void WriteBytesNativeString(void * addr, UInt count)
{
    Obj  target = MODULE_STATE(Serialize).obj;
    UInt size = GET_LEN_STRING(target);
    GROW_STRING(target, size + count + 1);
    memcpy(CSTR_STRING(target) + size, addr, count);
    SET_LEN_STRING(target, size + count);
}
Example #3
0
/****************************************************************************
**
*F  AppendBufToString()
**
**  Append 'bufsize' bytes from the string buffer 'buf' to the string object
**  'string'. If 'string' is 0, then a new string object is allocated first.
**
**  The string object is returned at the end, regardless of whether it was
**  given as an argument, or created from scratch.
**
*/
static Obj AppendBufToString(Obj string, const char * buf, UInt bufsize)
{
    char *s;
    if (string == 0) {
        string = NEW_STRING(bufsize);
        s = CSTR_STRING(string);
    }
    else {
        const UInt len = GET_LEN_STRING(string);
        GROW_STRING(string, len + bufsize);
        SET_LEN_STRING(string, len + bufsize);
        s = CSTR_STRING(string) + len;
    }
    memcpy(s, buf, bufsize);
    s[bufsize] = '\0';
    return string;
}
Example #4
0
static void ReserveBytesNativeString(UInt count) {
  Obj target = TLS(SerializationObj);
  UInt size = GET_LEN_STRING(target);
  GROW_STRING(target, size + count + 1);
}