ecc-rs02.c 2.86 KB
Newer Older
1
/*  dvdisaster: Additional error correction for optical media.
2
 *  Copyright (C) 2004-2017 Carsten Gnoerlich.
3
 *
4 5 6 7 8 9
 *  Email: carsten@dvdisaster.org  -or-  cgnoerlich@fsfe.org
 *  Project homepage: http://www.dvdisaster.org
 *
 *  This file is part of dvdisaster.
 *
 *  dvdisaster is free software: you can redistribute it and/or modify
10
 *  it under the terms of the GNU General Public License as published by
11
 *  the Free Software Foundation, either version 3 of the License, or
12 13
 *  (at your option) any later version.
 *
14
 *  dvdisaster is distributed in the hope that it will be useful,
15 16 17 18 19
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
20
 *  along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
 */

#include "dvdisaster.h"

#include "rs02-includes.h"

/***
 *** Method registration
 ***/

static void destroy(Method*);


void register_rs02(void)
{  Method *method = g_malloc0(sizeof(Method));

37 38
   method->ckSumClosure = g_malloc0(sizeof(RS02CksumClosure));

39 40 41 42 43 44 45 46 47
   /*** Standard infomation and methods */ 

   strncpy(method->name, "RS02", 4);
   method->menuEntry = g_strdup(_("Augmented image (RS02)"));
   method->description = g_strdup(_("Reed-Solomon method with improved tolerance for defective ecc data"));
   method->create  = RS02Create;
   method->fix     = RS02Fix;
   method->verify  = RS02Verify;

48 49 50 51 52 53 54 55 56
   /*** Linkage to rs02-common.c */

   method->recognizeEccImage = RS02Recognize;
   method->getCrcBuf         = RS02GetCrcBuf;
   method->resetCksums       = RS02ResetCksums;
   method->updateCksums      = RS02UpdateCksums;
   method->finalizeCksums    = RS02FinalizeCksums;
   method->expectedImageSize = RS02ExpectedImageSize;

57 58 59 60 61 62 63 64 65 66 67 68
   /*** Linkage to rs02-window.c */

   method->createCreateWindow = CreateRS02EncWindow;
   method->createFixWindow    = CreateRS02FixWindow;

   method->resetCreateWindow = ResetRS02EncWindow;
   method->resetFixWindow    = ResetRS02FixWindow;

   method->createPrefsPage   = CreateRS02PrefsPage;
   method->resetPrefsPage    = ResetRS02PrefsPage;
   method->readPreferences   = ReadRS02Preferences;

69
   /*** Linkage to rs02-verify.c */
70 71 72 73 74 75 76 77 78 79 80 81 82

   method->createVerifyWindow = CreateRS02VerifyWindow;
   method->resetVerifyWindow  = ResetRS02VerifyWindow;

   /*** Register ourself */

   method->destroy = destroy;

   RegisterMethod(method);
}

static void destroy(Method *method)
{  RS02Widgets *wl = (RS02Widgets*)method->widgetList;
83 84 85 86 87
   RS02CksumClosure *csc = (RS02CksumClosure*)method->ckSumClosure;

   if(csc->lay)
      g_free(csc->lay);
   g_free(method->ckSumClosure);
88 89 90 91 92 93 94 95 96 97 98 99 100 101

   if(wl)
   {  if(wl->fixCurve) FreeCurve(wl->fixCurve);

      if(wl->cmpSpiral)
	FreeSpiral(wl->cmpSpiral);

      if(wl->cmpLayout)
	g_object_unref(wl->cmpLayout);

      g_free(wl);
   }
}