From 2d51b17da005a18a51626ab9d28011be51b97ab7 Mon Sep 17 00:00:00 2001 From: Peter Breitenlohner Date: Thu, 27 Aug 2015 07:30:46 +0000 Subject: luaTeX: Drop useless casts to avoid some g++ warnings (if enabled) git-svn-id: svn://tug.org/texlive/trunk@38217 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/web2c/luatexdir/ChangeLog | 6 +++++ .../source/texk/web2c/luatexdir/image/pdftoepdf.w | 30 +++++++++++----------- Build/source/texk/web2c/luatexdir/lua/lepdflib.cc | 12 ++++----- .../texk/web2c/luatexdir/lua/lpdfscannerlib.cc | 4 +-- 4 files changed, 29 insertions(+), 23 deletions(-) diff --git a/Build/source/texk/web2c/luatexdir/ChangeLog b/Build/source/texk/web2c/luatexdir/ChangeLog index b325d0e67b0..e47388bc39a 100644 --- a/Build/source/texk/web2c/luatexdir/ChangeLog +++ b/Build/source/texk/web2c/luatexdir/ChangeLog @@ -1,3 +1,9 @@ +2015-08-27 Peter Breitenlohner + + * image/pdftoepdf.w: Drop useless casts to avoid warnings. + * lua/lpdfscannerlib.cc: Unconstify Token.string to avoid warning. + * lua/lepdflib.cc: Drop useless casts to avoid some warnings. + 2015-08-27 Akira Kakuto * tex/mlist.w: Sync with the trunk. diff --git a/Build/source/texk/web2c/luatexdir/image/pdftoepdf.w b/Build/source/texk/web2c/luatexdir/image/pdftoepdf.w index 9c09a65f645..82da2a2b012 100644 --- a/Build/source/texk/web2c/luatexdir/image/pdftoepdf.w +++ b/Build/source/texk/web2c/luatexdir/image/pdftoepdf.w @@ -1,7 +1,7 @@ % pdftoepdf.w % % Copyright 1996-2006 Han The Thanh -% Copyright 2006-2012 Taco Hoekwater +% Copyright 2006-2015 Taco Hoekwater % % This file is part of LuaTeX. % @@ -691,14 +691,14 @@ void write_epdf(PDF pdf, image_dict * idict) // Now all relevant parts of the Page dictionary are copied: // Metadata validity check (as a stream it must be indirect) - pageDict->lookupNF((char *) "Metadata", &obj1); + pageDict->lookupNF("Metadata", &obj1); if (!obj1.isNull() && !obj1.isRef()) luatex_warn("PDF inclusion: /Metadata must be indirect object"); obj1.free(); // copy selected items in Page dictionary for (i = 0; pagedictkeys[i] != NULL; i++) { - pageDict->lookupNF((char *) pagedictkeys[i], &obj1); + pageDict->lookupNF(pagedictkeys[i], &obj1); if (!obj1.isNull()) { pdf_add_name(pdf, pagedictkeys[i]); copyObject(pdf, pdf_doc, &obj1); // preserves indirection @@ -710,20 +710,20 @@ void write_epdf(PDF pdf, image_dict * idict) // try to inherit the Resources from the Pages tree of the embedded // PDF file, climbing up the tree until the Resources are found. // (This fixes a problem with Scribus 1.3.3.14.) - pageDict->lookupNF((char *) "Resources", &obj1); + pageDict->lookupNF("Resources", &obj1); if (obj1.isNull()) { op1 = &pagesobj1; op2 = &pagesobj2; - pageDict->lookup((char *) "Parent", op1); + pageDict->lookup("Parent", op1); while (op1->isDict()) { obj1.free(); - op1->dictLookupNF((char *) "Resources", &obj1); + op1->dictLookupNF("Resources", &obj1); if (!obj1.isNull()) { - pdf_add_name(pdf, (const char *) "Resources"); + pdf_add_name(pdf, "Resources"); copyObject(pdf, pdf_doc, &obj1); break; } - op1->dictLookup((char *) "Parent", op2); + op1->dictLookup("Parent", op2); optmp = op1; op1 = op2; op2 = optmp; @@ -747,24 +747,24 @@ void write_epdf(PDF pdf, image_dict * idict) // Variant B: copy stream without recompressing // - contents.streamGetDict()->lookup((char *) "F", &obj1); + contents.streamGetDict()->lookup("F", &obj1); if (!obj1.isNull()) { luatex_fail("PDF inclusion: Unsupported external stream"); } obj1.free(); - contents.streamGetDict()->lookup((char *) "Length", &obj1); + contents.streamGetDict()->lookup("Length", &obj1); assert(!obj1.isNull()); - pdf_add_name(pdf, (const char *) "Length"); + pdf_add_name(pdf, "Length"); copyObject(pdf, pdf_doc, &obj1); obj1.free(); - contents.streamGetDict()->lookup((char *) "Filter", &obj1); + contents.streamGetDict()->lookup("Filter", &obj1); if (!obj1.isNull()) { - pdf_add_name(pdf, (const char *) "Filter"); + pdf_add_name(pdf, "Filter"); copyObject(pdf, pdf_doc, &obj1); obj1.free(); - contents.streamGetDict()->lookup((char *) "DecodeParms", &obj1); + contents.streamGetDict()->lookup("DecodeParms", &obj1); if (!obj1.isNull()) { - pdf_add_name(pdf, (const char *) "DecodeParms"); + pdf_add_name(pdf, "DecodeParms"); copyObject(pdf, pdf_doc, &obj1); } } diff --git a/Build/source/texk/web2c/luatexdir/lua/lepdflib.cc b/Build/source/texk/web2c/luatexdir/lua/lepdflib.cc index 1e0e0d597a4..621717635fe 100644 --- a/Build/source/texk/web2c/luatexdir/lua/lepdflib.cc +++ b/Build/source/texk/web2c/luatexdir/lua/lepdflib.cc @@ -980,7 +980,7 @@ static int m_Dict_lookup(lua_State * L) s = luaL_checkstring(L, 2); uout = new_Object_userdata(L); uout->d = new Object(); - ((Dict *) uin->d)->lookup((char *) s, (Object *) uout->d); + ((Dict *) uin->d)->lookup(s, (Object *) uout->d); uout->atype = ALLOC_LEPDF; uout->pc = uin->pc; uout->pd = uin->pd; @@ -997,7 +997,7 @@ static int m_Dict_lookupNF(lua_State * L) s = luaL_checkstring(L, 2); uout = new_Object_userdata(L); uout->d = new Object(); - ((Dict *) uin->d)->lookupNF((char *) s, (Object *) uout->d); + ((Dict *) uin->d)->lookupNF(s, (Object *) uout->d); uout->atype = ALLOC_LEPDF; uout->pc = uin->pc; uout->pd = uin->pd; @@ -1858,7 +1858,7 @@ static int m_Object_dictSet(lua_State * L) pdfdoc_changed_error(L); if (!((Object *) uin->d)->isDict()) luaL_error(L, "Object is not a Dict"); - ((Object *) uin->d)->dictSet((char *) s, (Object *) uobj->d); + ((Object *) uin->d)->dictSet(s, (Object *) uobj->d); return 0; } @@ -1873,7 +1873,7 @@ static int m_Object_dictLookup(lua_State * L) if (((Object *) uin->d)->isDict()) { uout = new_Object_userdata(L); uout->d = new Object(); - ((Object *) uin->d)->dictLookup((char *) s, (Object *) uout->d); + ((Object *) uin->d)->dictLookup(s, (Object *) uout->d); uout->atype = ALLOC_LEPDF; uout->pc = uin->pc; uout->pd = uin->pd; @@ -1893,7 +1893,7 @@ static int m_Object_dictLookupNF(lua_State * L) if (((Object *) uin->d)->isDict()) { uout = new_Object_userdata(L); uout->d = new Object(); - ((Object *) uin->d)->dictLookupNF((char *) s, (Object *) uout->d); + ((Object *) uin->d)->dictLookupNF(s, (Object *) uout->d); uout->atype = ALLOC_LEPDF; uout->pc = uin->pc; uout->pd = uin->pd; @@ -3241,7 +3241,7 @@ static int m_StructTreeRoot_getChild(lua_State * L) static int m_StructTreeRoot_appendChild(lua_State * L) { - udstruct *uin, *uin_child, *uout; + udstruct *uin, *uin_child; StructElement *child ; StructTreeRoot *root ; uin = (udstruct *) luaL_checkudata(L, 1, M_StructTreeRoot); diff --git a/Build/source/texk/web2c/luatexdir/lua/lpdfscannerlib.cc b/Build/source/texk/web2c/luatexdir/lua/lpdfscannerlib.cc index d7782c2fe54..7fa6c4438c7 100644 --- a/Build/source/texk/web2c/luatexdir/lua/lpdfscannerlib.cc +++ b/Build/source/texk/web2c/luatexdir/lua/lpdfscannerlib.cc @@ -73,7 +73,7 @@ typedef enum { typedef struct Token { pdf_token_type type; double value; - const char *string; + char *string; } Token; typedef struct ObjectList { @@ -165,7 +165,7 @@ static scannerdata *scanner_check (lua_State *L, int index) static void free_token (Token *token) { if (token->string) { - free((void *)token->string); + free(token->string); } free(token); } -- cgit v1.2.3