X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Ftrunk%2Fsrc%2Fmodules%2Fmod_mng%2Ftrgt_mng.cpp;h=7a97c7c5815303a58a8d7e55f7a8b7ca22a25459;hb=9459638ad6797b8139f1e9f0715c96076dbf0890;hp=5ef569471369218f70ea1c29412316f1fffdf247;hpb=ba2f883ad78a8316361fe0da09cd21f68919c83d;p=synfig.git diff --git a/synfig-core/trunk/src/modules/mod_mng/trgt_mng.cpp b/synfig-core/trunk/src/modules/mod_mng/trgt_mng.cpp index 5ef5694..7a97c7c 100644 --- a/synfig-core/trunk/src/modules/mod_mng/trgt_mng.cpp +++ b/synfig-core/trunk/src/modules/mod_mng/trgt_mng.cpp @@ -5,7 +5,8 @@ ** $Id$ ** ** \legal -** Copyright 2007 Paul Wise +** Copyright (c) 2007 Paul Wise +** Copyright (c) 2007 Chris Moore ** ** This package is free software; you can redistribute it and/or ** modify it under the terms of the GNU General Public License as @@ -68,13 +69,13 @@ mng_alloc_proc(mng_size_t size) } static void MNG_DECL -mng_free_proc(mng_ptr ptr, mng_size_t size) +mng_free_proc(mng_ptr ptr, mng_size_t size __attribute__ ((unused))) { free(ptr); return; } static mng_bool MNG_DECL -mng_null_proc(mng_handle mng) +mng_null_proc(mng_handle mng __attribute__ ((unused))) { // synfig::info("%s:%d mng_trgt::mng_null_proc was called", __FILE__, __LINE__); return MNG_TRUE; @@ -89,8 +90,10 @@ mng_write_proc(mng_handle mng, mng_ptr buf, mng_uint32 size, mng_uint32* written } static mng_bool MNG_DECL -mng_error_proc(mng_handle mng, mng_int32 error, mng_int8 severity, mng_chunkid chunkname, - mng_uint32 chunkseq, mng_int32 extra1, mng_int32 extra2, mng_pchar errortext) +mng_error_proc(mng_handle mng __attribute__ ((unused)), mng_int32 error __attribute__ ((unused)), + mng_int8 severity __attribute__ ((unused)), mng_chunkid chunkname __attribute__ ((unused)), + mng_uint32 chunkseq __attribute__ ((unused)), mng_int32 extra1 __attribute__ ((unused)), + mng_int32 extra2 __attribute__ ((unused)), mng_pchar errortext) { synfig::error("%s:%d mng_trgt: error: %s", __FILE__, __LINE__, errortext); return MNG_TRUE; @@ -100,8 +103,8 @@ mng_trgt::mng_trgt(const char *Filename) : filename(Filename) { file=NULL; buffer=NULL; - color_buffer=NULL; - zbuffer=NULL; + color_buffer=NULL; + zbuffer=NULL; zbuffer_len=0; ready=false; } @@ -147,7 +150,7 @@ mng_trgt::set_rend_desc(RendDesc *given_desc) bool mng_trgt::init() { - // synfig::info("%s:%d mng_trgt::init()", __FILE__, __LINE__); + // synfig::info("%s:%d mng_trgt::init()", __FILE__, __LINE__); int frame_rate, num_frames, play_time; int num_layers = 1; @@ -180,9 +183,22 @@ mng_trgt::init() if (mng_create(mng) != 0) goto cleanup_on_error; if (mng_putchunk_mhdr(mng, w, h, frame_rate, num_layers, num_frames, play_time, MNG_SIMPLICITY_VALID|MNG_SIMPLICITY_SIMPLEFEATURES) != 0) goto cleanup_on_error; if (mng_putchunk_term(mng, MNG_TERMACTION_REPEAT, MNG_ITERACTION_LASTFRAME, 0, 0x7fffffff) != 0) goto cleanup_on_error; - if (mng_putchunk_text(mng, sizeof(MNG_TEXT_TITLE), MNG_TEXT_TITLE, get_canvas()->get_name().length(), const_cast(get_canvas()->get_name().c_str())) != 0) goto cleanup_on_error; - if (mng_putchunk_text(mng, sizeof(MNG_TEXT_DESCRIPTION), MNG_TEXT_DESCRIPTION, get_canvas()->get_description().length(), const_cast(get_canvas()->get_description().c_str())) != 0) goto cleanup_on_error; - if (mng_putchunk_text(mng, sizeof(MNG_TEXT_SOFTWARE), MNG_TEXT_SOFTWARE, sizeof("SYNFIG"), "SYNFIG") != 0) goto cleanup_on_error; + { + char title[] = MNG_TEXT_TITLE; + if (mng_putchunk_text(mng, sizeof(title), title, + get_canvas()->get_name().length(), const_cast(get_canvas()->get_name().c_str())) != 0) + goto cleanup_on_error; + + char description[] = MNG_TEXT_DESCRIPTION; + if (mng_putchunk_text(mng, sizeof(description), description, + get_canvas()->get_description().length(), const_cast(get_canvas()->get_description().c_str())) != 0) + goto cleanup_on_error; + + char software[] = MNG_TEXT_SOFTWARE; char synfig[] = "SYNFIG"; + if (mng_putchunk_text(mng, sizeof(software), software, + sizeof(synfig), synfig) != 0) + goto cleanup_on_error; + } if (mng_putchunk_gama(mng, MNG_FALSE, (int)(gamma().get_gamma()*100000)) != 0) goto cleanup_on_error; if (mng_putchunk_phys(mng, MNG_FALSE, round_to_int(desc.get_x_res()),round_to_int(desc.get_y_res()), MNG_UNIT_METER) != 0) goto cleanup_on_error; if (mng_putchunk_time(mng, gmt->tm_year + 1900, gmt->tm_mon + 1, gmt->tm_mday, gmt->tm_hour, gmt->tm_min, gmt->tm_sec) != 0) goto cleanup_on_error; @@ -191,7 +207,7 @@ mng_trgt::init() color_buffer=new Color[w]; if (color_buffer == NULL) goto cleanup_on_error; return true; - + cleanup_on_error: ready=false; if (mng != MNG_NULL) @@ -203,7 +219,7 @@ cleanup_on_error: mng_int32 extra2; mng_pchar errortext; mng_getlasterror (mng, &severity, &chunkname, &chunkseq, &extra1,&extra2, &errortext); - synfig::error("mng_trgt: libmng: %s",errortext); + synfig::error("mng_trgt: libmng: %s",errortext); mng_cleanup (&mng); } @@ -223,13 +239,13 @@ cleanup_on_error: color_buffer = NULL; } - return false; + return false; } void mng_trgt::end_frame() { - // synfig::info("%s:%d mng_trgt::end_frame()", __FILE__, __LINE__); + // synfig::info("%s:%d mng_trgt::end_frame()", __FILE__, __LINE__); if (deflate(&zstream,Z_FINISH) != Z_STREAM_END) { @@ -251,9 +267,9 @@ mng_trgt::end_frame() } bool -mng_trgt::start_frame(synfig::ProgressCallback *callback) +mng_trgt::start_frame(synfig::ProgressCallback *callback __attribute__ ((unused))) { - // synfig::info("%s:%d mng_trgt::start_frame()", __FILE__, __LINE__); + // synfig::info("%s:%d mng_trgt::start_frame()", __FILE__, __LINE__); if (mng == MNG_NULL) { @@ -266,7 +282,7 @@ mng_trgt::start_frame(synfig::ProgressCallback *callback) synfig::error("%s:%d mng_putchunk_ihdr()", __FILE__, __LINE__); return false; } - + zstream.zalloc = Z_NULL; zstream.zfree = Z_NULL; zstream.opaque = Z_NULL; @@ -292,7 +308,7 @@ mng_trgt::start_frame(synfig::ProgressCallback *callback) } Color* -mng_trgt::start_scanline(int scanline) +mng_trgt::start_scanline(int scanline __attribute__ ((unused))) { return color_buffer; }