예제 #1
0
fz_obj *
fz_new_name(fz_context *ctx, char *str)
{
	fz_obj *obj;
	obj = Memento_label(fz_malloc(ctx, offsetof(fz_obj, u.n) + strlen(str) + 1), "fz_obj(name)");
	obj->ctx = ctx;
	obj->refs = 1;
	obj->kind = FZ_NAME;
	strcpy(obj->u.n, str);
	return obj;
}
예제 #2
0
pdf_obj *
pdf_new_null(fz_context *ctx)
{
	pdf_obj *obj;
	obj = Memento_label(fz_malloc(ctx, sizeof(pdf_obj)), "pdf_obj(null)");
	obj->ctx = ctx;
	obj->refs = 1;
	obj->kind = PDF_NULL;
	obj->marked = 0;
	return obj;
}
예제 #3
0
fz_obj *
fz_new_bool(fz_context *ctx, int b)
{
	fz_obj *obj;
	obj = Memento_label(fz_malloc(ctx, sizeof(fz_obj)), "fz_obj(bool)");
	obj->ctx = ctx;
	obj->refs = 1;
	obj->kind = FZ_BOOL;
	obj->u.b = b;
	return obj;
}
예제 #4
0
pdf_obj *
pdf_new_int(fz_context *ctx, int i)
{
	pdf_obj *obj;
	obj = Memento_label(fz_malloc(ctx, sizeof(pdf_obj)), "pdf_obj(int)");
	obj->ctx = ctx;
	obj->refs = 1;
	obj->kind = PDF_INT;
	obj->u.i = i;
	return obj;
}
예제 #5
0
pdf_obj *
pdf_new_real(fz_context *ctx, float f)
{
	pdf_obj *obj;
	obj = Memento_label(fz_malloc(ctx, sizeof(pdf_obj)), "pdf_obj(real)");
	obj->ctx = ctx;
	obj->refs = 1;
	obj->kind = PDF_REAL;
	obj->u.f = f;
	return obj;
}
예제 #6
0
pdf_obj *
pdf_new_real(fz_context *ctx, pdf_document *doc, float f)
{
	pdf_obj_num *obj;
	obj = Memento_label(fz_malloc(ctx, sizeof(pdf_obj_num)), "pdf_obj(real)");
	obj->super.refs = 1;
	obj->super.kind = PDF_REAL;
	obj->super.flags = 0;
	obj->u.f = f;
	return &obj->super;
}
예제 #7
0
pdf_obj *
pdf_new_int_offset(fz_context *ctx, pdf_document *doc, fz_off_t i)
{
	pdf_obj_num *obj;
	obj = Memento_label(fz_malloc(ctx, sizeof(pdf_obj_num)), "pdf_obj(offset)");
	obj->super.refs = 1;
	obj->super.kind = PDF_INT;
	obj->super.flags = 0;
	obj->u.i = i;
	return &obj->super;
}
예제 #8
0
파일: pdf-object.c 프로젝트: muennich/mupdf
pdf_obj *
pdf_new_int(fz_context *ctx, int64_t i)
{
	pdf_obj_num *obj;
	obj = Memento_label(fz_malloc(ctx, sizeof(pdf_obj_num)), "pdf_obj(int)");
	obj->super.refs = 1;
	obj->super.kind = PDF_INT;
	obj->super.flags = 0;
	obj->u.i = i;
	return &obj->super;
}
예제 #9
0
pdf_obj *
pdf_new_null(fz_context *ctx, pdf_document *doc)
{
	pdf_obj *obj;
	obj = Memento_label(fz_malloc(ctx, sizeof(pdf_obj)), "pdf_obj(null)");
	obj->doc = doc;
	obj->refs = 1;
	obj->kind = PDF_NULL;
	obj->flags = 0;
	obj->parent_num = 0;
	return obj;
}
예제 #10
0
pdf_obj *
pdf_new_bool(fz_context *ctx, int b)
{
	pdf_obj *obj;
	obj = Memento_label(fz_malloc(ctx, sizeof(pdf_obj)), "pdf_obj(bool)");
	obj->ctx = ctx;
	obj->refs = 1;
	obj->kind = PDF_BOOL;
	obj->marked = 0;
	obj->u.b = b;
	return obj;
}
예제 #11
0
pdf_obj *
pdf_new_name(fz_context *ctx, const char *str)
{
	pdf_obj *obj;
	obj = Memento_label(fz_malloc(ctx, offsetof(pdf_obj, u.n) + strlen(str) + 1), "pdf_obj(name)");
	obj->ctx = ctx;
	obj->refs = 1;
	obj->kind = PDF_NAME;
	obj->marked = 0;
	strcpy(obj->u.n, str);
	return obj;
}
예제 #12
0
pdf_obj *
pdf_new_indirect(fz_context *ctx, pdf_document *doc, int num, int gen)
{
	pdf_obj_ref *obj;
	obj = Memento_label(fz_malloc(ctx, sizeof(pdf_obj_ref)), "pdf_obj(indirect)");
	obj->super.refs = 1;
	obj->super.kind = PDF_INDIRECT;
	obj->super.flags = 0;
	obj->doc = doc;
	obj->num = num;
	obj->gen = gen;
	return &obj->super;
}
예제 #13
0
pdf_obj *
pdf_new_string(fz_context *ctx, pdf_document *doc, const char *str, int len)
{
	pdf_obj_string *obj;
	obj = Memento_label(fz_malloc(ctx, offsetof(pdf_obj_string, buf) + len + 1), "pdf_obj(string)");
	obj->super.refs = 1;
	obj->super.kind = PDF_STRING;
	obj->super.flags = 0;
	obj->len = len;
	memcpy(obj->buf, str, len);
	obj->buf[len] = '\0';
	return &obj->super;
}
예제 #14
0
pdf_obj *
pdf_new_real(fz_context *ctx, pdf_document *doc, float f)
{
	pdf_obj *obj;
	obj = Memento_label(fz_malloc(ctx, sizeof(pdf_obj)), "pdf_obj(real)");
	obj->doc = doc;
	obj->refs = 1;
	obj->kind = PDF_REAL;
	obj->flags = 0;
	obj->parent_num = 0;
	obj->u.f = f;
	return obj;
}
예제 #15
0
pdf_obj *
pdf_new_indirect(fz_context *ctx, int num, int gen, void *xref)
{
	pdf_obj *obj;
	obj = Memento_label(fz_malloc(ctx, sizeof(pdf_obj)), "pdf_obj(indirect)");
	obj->ctx = ctx;
	obj->refs = 1;
	obj->kind = PDF_INDIRECT;
	obj->u.r.num = num;
	obj->u.r.gen = gen;
	obj->u.r.xref = xref;
	return obj;
}
예제 #16
0
pdf_obj *
pdf_new_int(fz_context *ctx, pdf_document *doc, int i)
{
	pdf_obj *obj;
	obj = Memento_label(fz_malloc(ctx, sizeof(pdf_obj)), "pdf_obj(int)");
	obj->doc = doc;
	obj->refs = 1;
	obj->kind = PDF_INT;
	obj->flags = 0;
	obj->parent_num = 0;
	obj->u.i = i;
	return obj;
}
예제 #17
0
pdf_obj *
pdf_new_string(fz_context *ctx, char *str, int len)
{
	pdf_obj *obj;
	obj = Memento_label(fz_malloc(ctx, offsetof(pdf_obj, u.s.buf) + len + 1), "pdf_obj(string)");
	obj->ctx = ctx;
	obj->refs = 1;
	obj->kind = PDF_STRING;
	obj->u.s.len = len;
	memcpy(obj->u.s.buf, str, len);
	obj->u.s.buf[len] = '\0';
	return obj;
}
예제 #18
0
pdf_obj *
pdf_new_bool(fz_context *ctx, pdf_document *doc, int b)
{
	pdf_obj *obj;
	obj = Memento_label(fz_malloc(ctx, sizeof(pdf_obj)), "pdf_obj(bool)");
	obj->doc = doc;
	obj->refs = 1;
	obj->kind = PDF_BOOL;
	obj->flags = 0;
	obj->parent_num = 0;
	obj->u.b = b;
	return obj;
}
예제 #19
0
pdf_obj *
pdf_new_name(fz_context *ctx, pdf_document *doc, const char *str)
{
	pdf_obj *obj;
	obj = Memento_label(fz_malloc(ctx, offsetof(pdf_obj, u.n) + strlen(str) + 1), "pdf_obj(name)");
	obj->doc = doc;
	obj->refs = 1;
	obj->kind = PDF_NAME;
	obj->flags = 0;
	obj->parent_num = 0;
	strcpy(obj->u.n, str);
	return obj;
}
예제 #20
0
pdf_obj *
pdf_new_indirect(fz_context *ctx, pdf_document *doc, int num, int gen)
{
	pdf_obj *obj;
	obj = Memento_label(fz_malloc(ctx, sizeof(pdf_obj)), "pdf_obj(indirect)");
	obj->doc = doc;
	obj->refs = 1;
	obj->kind = PDF_INDIRECT;
	obj->flags = 0;
	obj->parent_num = 0;
	obj->u.r.num = num;
	obj->u.r.gen = gen;
	return obj;
}
예제 #21
0
pdf_obj *
pdf_new_string(fz_context *ctx, pdf_document *doc, const char *str, int len)
{
	pdf_obj *obj;
	obj = Memento_label(fz_malloc(ctx, offsetof(pdf_obj, u.s.buf) + len + 1), "pdf_obj(string)");
	obj->doc = doc;
	obj->refs = 1;
	obj->kind = PDF_STRING;
	obj->flags = 0;
	obj->parent_num = 0;
	obj->u.s.len = len;
	memcpy(obj->u.s.buf, str, len);
	obj->u.s.buf[len] = '\0';
	return obj;
}
예제 #22
0
pdf_obj *
pdf_new_name(fz_context *ctx, pdf_document *doc, const char *str)
{
	pdf_obj_name *obj;
	char **stdname;

	stdname = bsearch(str, &PDF_NAMES[1], PDF_OBJ_ENUM_NAME__LIMIT-1, sizeof(char *), namecmp);
	if (stdname != NULL)
		return (pdf_obj *)(intptr_t)(stdname - &PDF_NAMES[0]);

	obj = Memento_label(fz_malloc(ctx, offsetof(pdf_obj_name, n) + strlen(str) + 1), "pdf_obj(name)");
	obj->super.refs = 1;
	obj->super.kind = PDF_NAME;
	obj->super.flags = 0;
	strcpy(obj->n, str);
	return &obj->super;
}
예제 #23
0
pdf_obj *
pdf_new_string(fz_context *ctx, pdf_document *doc, const char *str, size_t len)
{
	pdf_obj_string *obj;
	unsigned int l = (unsigned int)len;

	if ((size_t)l != len)
		fz_throw(ctx, FZ_ERROR_GENERIC, "Overflow in pdf string");

	obj = Memento_label(fz_malloc(ctx, offsetof(pdf_obj_string, buf) + len + 1), "pdf_obj(string)");
	obj->super.refs = 1;
	obj->super.kind = PDF_STRING;
	obj->super.flags = 0;
	obj->len = l;
	memcpy(obj->buf, str, len);
	obj->buf[len] = '\0';
	return &obj->super;
}
예제 #24
0
파일: path.c 프로젝트: haggl/mupdf
fz_stroke_state *
fz_new_stroke_state_with_len(fz_context *ctx, int len)
{
    fz_stroke_state *state;

    len -= nelem(state->dash_list);
    if (len < 0)
        len = 0;

    state = Memento_label(fz_malloc(ctx, sizeof(*state) + sizeof(state->dash_list[0]) * len), "fz_stroke_state");
    state->refs = 1;
    state->start_cap = FZ_LINECAP_BUTT;
    state->dash_cap = FZ_LINECAP_BUTT;
    state->end_cap = FZ_LINECAP_BUTT;
    state->linejoin = FZ_LINEJOIN_MITER;
    state->linewidth = 1;
    state->miterlimit = 10;
    state->dash_phase = 0;
    state->dash_len = 0;
    memset(state->dash_list, 0, sizeof(state->dash_list[0]) * (len + nelem(state->dash_list)));

    return state;
}
예제 #25
0
void *
pdf_new_processor(fz_context *ctx, int size)
{
	return Memento_label(fz_calloc(ctx, 1, size), "pdf_processor");
}