New option --dump-palette. Fixed a double free in the cleanup code.
git-svn-id: svn://svn.cc65.org/cc65/trunk@5604 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -161,6 +161,26 @@ static void OptConvertTo (const char* Opt attribute ((unused)), const char* Arg)
|
||||
|
||||
|
||||
|
||||
static void OptDumpPalette (const char* Opt attribute ((unused)),
|
||||
const char* Arg attribute ((unused)))
|
||||
/* Dump the palette of the current work bitmap */
|
||||
{
|
||||
/* We must have a bitmap ... */
|
||||
if (C == 0) {
|
||||
Error ("No bitmap");
|
||||
}
|
||||
|
||||
/* ... which must be indexed */
|
||||
if (!BitmapIsIndexed (C)) {
|
||||
Error ("Current bitmap is not indexed");
|
||||
}
|
||||
|
||||
/* Dump the palette */
|
||||
DumpPalette (stdout, GetBitmapPalette (C));
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void OptHelp (const char* Opt attribute ((unused)),
|
||||
const char* Arg attribute ((unused)))
|
||||
/* Print usage information and exit */
|
||||
@@ -297,6 +317,7 @@ int main (int argc, char* argv [])
|
||||
/* Program long options */
|
||||
static const LongOpt OptTab[] = {
|
||||
{ "--convert-to", 1, OptConvertTo },
|
||||
{ "--dump-palette", 0, OptDumpPalette },
|
||||
{ "--help", 0, OptHelp },
|
||||
{ "--list-conversions", 0, OptListConversions },
|
||||
{ "--pop", 0, OptPop },
|
||||
@@ -374,8 +395,8 @@ int main (int argc, char* argv [])
|
||||
}
|
||||
|
||||
/* Cleanup data */
|
||||
SetWorkBitmap (C);
|
||||
FreeBitmap (B);
|
||||
FreeBitmap (C);
|
||||
FreeStrBuf (D);
|
||||
|
||||
/* Success */
|
||||
|
||||
Reference in New Issue
Block a user