From ebc6cf72f0179870d119233240bdefdf2c46e042 Mon Sep 17 00:00:00 2001
From: Sebastião Guerra <sebastiao.luiz.guerra@gmail.com>
Date: Sat, 14 Nov 2026 17:36:24 -0300
Subject: KFax/KFaxview: Replace zero pointer constants with nullptr
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Replace zero pointer constants with nullptr.

Signed-off-by: Sebastião Guerra <sebastiao.luiz.guerra@gmail.com>
---
 kfax/faxinput.cpp                   |  4 +--
 kfax/kfax.cpp                       | 42 +++++++++++++-------------
 kfax/kfax.h                         |  2 +-
 kfax/kfax_printsettings.h           |  2 +-
 kfax/options.h                      |  2 +-
 kfax/viewfax.cpp                    | 60 ++++++++++++++++++-------------------
 kfaxview/faxrenderer.cpp            |  4 +--
 kfaxview/libkfaximage/kfaximage.cpp |  8 ++---
 kfaxview/libkfaximage/kfaximage.h   |  2 +-
 kfaxview/main.cpp                   | 46 ++++++++++++++--------------
 10 files changed, 86 insertions(+), 86 deletions(-)

diff --git a/kfax/faxinput.cpp b/kfax/faxinput.cpp
index 7d11e9ed..87b7f1e8 100644
--- a/kfax/faxinput.cpp
+++ b/kfax/faxinput.cpp
@@ -67,7 +67,7 @@ notefile(const char *name, int type)
     newnode->type = type;
 
 
-    if ((newnode->name = strrchr(newnode->pathname, '/')))
+    if ((newnode->name = strrchr(newnode->pathname, '/')) != nullptr)
 	newnode->name++;
     else
 	newnode->name = newnode->pathname;
@@ -109,7 +109,7 @@ notetiff(const char *name)
     TQString str;
 
 
-    if (!(tf = fopen(name, "r"))) {
+    if ((tf = fopen(name, "r")) == nullptr) {
         TQString mesg = i18n("Unable to open:\n%1\n").arg(TQFile::decodeName(name));
 	kfaxerror(i18n("Sorry"), mesg);
 	return 0;
diff --git a/kfax/kfax.cpp b/kfax/kfax.cpp
index d48d35b3..09d4a45f 100644
--- a/kfax/kfax.cpp
+++ b/kfax/kfax.cpp
@@ -189,7 +189,7 @@ bool MyApp::x11EventFilter( XEvent * ev)
 }
 
 TopLevel::TopLevel (TQWidget *, const char *name)
-    : TDEMainWindow (0, name)
+    : TDEMainWindow (nullptr, name)
 {
   setMinimumSize (100, 100);
 
@@ -1624,26 +1624,26 @@ static const char description[] =
 
 static TDECmdLineOptions options[] =
 {
-   {"f", 0, 0 },
-   {"fine",         I18N_NOOP( "Fine resolution" ), 0 },
-   {"n", 0, 0 },
-   {"normal",       I18N_NOOP( "Normal resolution" ), 0 },
-   {"height",       I18N_NOOP( "Height (number of fax lines)" ), 0 },
-   {"w", 0, 0 },
-   {"width",        I18N_NOOP( "Width (dots per fax line)" ), 0 },
-   {"l", 0, 0 },
-   {"landscape",    I18N_NOOP( "Turn image 90 degrees (landscape mode)" ), 0 },
-   {"u", 0, 0 },
-   {"upsidedown",   I18N_NOOP( "Turn image upside down" ), 0 },
-   {"i", 0, 0 },
-   {"invert",       I18N_NOOP( "Invert black and white" ), 0 },
-   {"m", 0, 0 },
+   {"f", nullptr, nullptr },
+   {"fine",         I18N_NOOP( "Fine resolution" ), nullptr },
+   {"n", nullptr, nullptr },
+   {"normal",       I18N_NOOP( "Normal resolution" ), nullptr },
+   {"height",       I18N_NOOP( "Height (number of fax lines)" ), nullptr },
+   {"w", nullptr, nullptr },
+   {"width",        I18N_NOOP( "Width (dots per fax line)" ), nullptr },
+   {"l", nullptr, nullptr },
+   {"landscape",    I18N_NOOP( "Turn image 90 degrees (landscape mode)" ), nullptr },
+   {"u", nullptr, nullptr },
+   {"upsidedown",   I18N_NOOP( "Turn image upside down" ), nullptr },
+   {"i", nullptr, nullptr },
+   {"invert",       I18N_NOOP( "Invert black and white" ), nullptr },
+   {"m", nullptr, nullptr },
    {"mem <bytes>",  I18N_NOOP( "Limit memory use to 'bytes'" ), "8M" },
-   {"r", 0, 0 },
-   {"reverse",      I18N_NOOP( "Fax data is packed lsb first" ), 0 },
-   {"2" ,           I18N_NOOP( "Raw files are g3-2d" ), 0 },
-   {"4",            I18N_NOOP( "Raw files are g4" ), 0 },
-   {"+file(s)",     I18N_NOOP( "Fax file(s) to show" ), 0 },
+   {"r", nullptr, nullptr },
+   {"reverse",      I18N_NOOP( "Fax data is packed lsb first" ), nullptr },
+   {"2" ,           I18N_NOOP( "Raw files are g3-2d" ), nullptr },
+   {"4",            I18N_NOOP( "Raw files are g4" ), nullptr },
+   {"+file(s)",     I18N_NOOP( "Fax file(s) to show" ), nullptr },
    TDECmdLineLastOption
 };
 
@@ -1652,7 +1652,7 @@ int main (int argc, char **argv)
   TDEAboutData aboutData( "kfax", I18N_NOOP("KFax"),
       KFAXVERSION, description, TDEAboutData::License_GPL,
       "(c) 1997-98 Bernd Johannes Wuebben");
-  aboutData.addAuthor( "Bernd Johannes Wuebben", 0, "wuebben@kde.org" );
+  aboutData.addAuthor( "Bernd Johannes Wuebben", nullptr, "wuebben@kde.org" );
   aboutData.addCredit( "Nadeem Hasan", I18N_NOOP( "UI Rewrite, lots of code "
       "cleanups and fixes" ), "nhasan@kde.org" );
   aboutData.addCredit( "Helge Deller", I18N_NOOP( "Printing Rewrite, lots of code "
diff --git a/kfax/kfax.h b/kfax/kfax.h
index ac2df263..8455c1c3 100644
--- a/kfax/kfax.h
+++ b/kfax/kfax.h
@@ -59,7 +59,7 @@ class TopLevel : public TDEMainWindow
 
 public:
 
-    TopLevel( TQWidget *parent=0, const char *name=0 );
+    TopLevel( TQWidget *parent=nullptr, const char *name=nullptr );
     ~TopLevel();
 
     void openNetFile( const KURL& _url);
diff --git a/kfax/kfax_printsettings.h b/kfax/kfax_printsettings.h
index 11fc2935..17d56b17 100644
--- a/kfax/kfax_printsettings.h
+++ b/kfax/kfax_printsettings.h
@@ -33,7 +33,7 @@ class KFAXPrintSettings : public KPrintDialogPage
 	TQ_OBJECT
   
 public:
-	KFAXPrintSettings(TQWidget *parent = 0, const char *name = 0);
+	KFAXPrintSettings(TQWidget *parent = nullptr, const char *name = nullptr);
 	~KFAXPrintSettings();
 
 	void getOptions(TQMap<TQString,TQString>& opts, bool incldef = false);
diff --git a/kfax/options.h b/kfax/options.h
index c539eced..448da7bb 100644
--- a/kfax/options.h
+++ b/kfax/options.h
@@ -61,7 +61,7 @@ class OptionsDialog : public KDialogBase {
   
 
 public:
-    OptionsDialog( TQWidget *parent = 0, const char *name = 0);
+    OptionsDialog( TQWidget *parent = nullptr, const char *name = nullptr);
 
     struct optionsinfo* getInfo();
     void setWidgets(struct optionsinfo *oi);
diff --git a/kfax/viewfax.cpp b/kfax/viewfax.cpp
index 09872ceb..9c82bf48 100644
--- a/kfax/viewfax.cpp
+++ b/kfax/viewfax.cpp
@@ -151,7 +151,7 @@ XSizeHints size_hints;
 
 Time Lasttime = 0; 
 
-struct pagenode *viewpage = 0;  
+struct pagenode *viewpage = nullptr;
 
 int viewfaxmain()
 {
@@ -237,7 +237,7 @@ int viewfaxmain()
 	TDECmdLineArgs::usage("--height value is required to interpret raw g4 faxes\n");
     }
 
-    firstpage = lastpage = thispage = helppage = auxpage =  0;
+    firstpage = lastpage = thispage = helppage = auxpage =  nullptr;
 
     for (int i = 0; i < args->count(); i++){
 	loadfile(TQFile::decodeName(args->arg(i)));
@@ -249,7 +249,7 @@ int viewfaxmain()
       exit(1);
     }
 
-    have_no_fax = (firstpage == 0);
+    have_no_fax = (firstpage == nullptr);
 
     Disp = qtdisplay;
     Default_Screen = XDefaultScreen(qtdisplay);
@@ -264,7 +264,7 @@ void TurnFollowing(int How, struct pagenode *pn)
     while (pn) {
 	if (Pimage(pn)) {
 	    FreeImage(Pimage(pn));
-	    pn->extra = 0;
+	    pn->extra = nullptr;
 	}
 	pn->orient ^= How;
 	pn = pn->next;
@@ -290,7 +290,7 @@ drawline(pixnum *run, int LineNum, struct pagenode *pn)
     }
     
     p = (t32bits *) (Pimage(pn)->data + LineNum*(2-pn->vres)*Pimage(pn)->bytes_per_line);
-    p1 =(t32bits *)( pn->vres ? 0 : p + Pimage(pn)->bytes_per_line/sizeof(*p));
+    p1 =(t32bits *)( pn->vres ? nullptr : p + Pimage(pn)->bytes_per_line/sizeof(*p));
     r = run;
     acc = 0;
     nacc = 0;
@@ -339,7 +339,7 @@ GetPartImage(struct pagenode *pn, int n)
 {
     unsigned char *Data = getstrip(pn, n);
 
-    if (Data == 0)
+    if (!Data)
 	return 3;
     pn->stripnum = n;
     (*pn->expander)(pn, drawline);
@@ -350,23 +350,23 @@ GetPartImage(struct pagenode *pn, int n)
 int GetImage(struct pagenode *pn){
     int i;
 
-    if (pn->strips == 0) {
+    if (!pn->strips) {
 
       /*printf("RAW fax file\n");*/
 
 	/* raw file; maybe we don't have the height yet */
 	unsigned char *Data = getstrip(pn, 0);
-	if (Data == 0){
+	if (!Data){
 
 	  return 0;
 	}
 	pn->extra = NewImage(pn->width, pn->vres ?
-			     pn->height : 2*pn->height, 0, 1);
+			     pn->height : 2*pn->height, nullptr, 1);
 
 //printf("height = %d\n",pn->height);
 //printf("setting height to %d\n", pn->vres ? pn->height : 2*pn->height);
 
-	if(pn->extra == 0)
+	if(!pn->extra)
 	  return 0;
 
 	(*pn->expander)(pn, drawline);
@@ -376,9 +376,9 @@ int GetImage(struct pagenode *pn){
       /*printf("MULTI STRIP TIFF fax file\n");*/
 
 	pn->extra = NewImage(pn->width, pn->vres ?
-			     pn->height : 2*pn->height, 0, 1);
+			     pn->height : 2*pn->height, nullptr, 1);
 
-	if(pn->extra == 0)
+	if(!pn->extra)
 	  return 0;
 	pn->stripnum = 0;
 	for (i = 0; i < pn->nstrips; i++){
@@ -464,9 +464,9 @@ XImage *ZoomImage(XImage *Big){
     XFlush(Disp);
     w = (Big->width+1) / 2;
     h = (Big->height+1) / 2;
-    Small = NewImage(w, h, 0, Big->bitmap_bit_order);
-    if(Small == 0)
-      return 0;
+    Small = NewImage(w, h, nullptr, Big->bitmap_bit_order);
+    if(!Small)
+      return nullptr;
 
     Small->xoffset = (Big->xoffset+1)/2;
     for (i = 0; i < Big->height; i += 2) {
@@ -522,8 +522,8 @@ XImage *FlipImage(XImage *Image){
 
     XImage *New = NewImage(Image->width, Image->height,
 			   Image->data, !Image->bitmap_bit_order);
-    if(New == 0)
-      return 0;
+    if(!New)
+      return nullptr;
 
     t32bits *p1 = (t32bits *) Image->data;
     t32bits *p2 = (t32bits *) (Image->data + Image->height *
@@ -540,7 +540,7 @@ XImage *FlipImage(XImage *Image){
     New->xoffset = 32 - (Image->width & 31) - Image->xoffset;
     New->xoffset &= 31;
 
-    Image->data = 0;
+    Image->data = nullptr;
     FreeImage(Image);
     return New;
 }
@@ -550,8 +550,8 @@ XImage *MirrorImage(XImage *Image){
     int i;
     XImage *New = NewImage(Image->width, Image->height,
 			   Image->data, !Image->bitmap_bit_order);
-    if(New == 0)
-      return 0;
+    if(!New)
+      return nullptr;
 
     /* reverse order of 32-bit words in each line */
     for (i = 0; i < Image->height; i++) {
@@ -568,7 +568,7 @@ XImage *MirrorImage(XImage *Image){
     New->xoffset = 32 - (Image->width & 31) - Image->xoffset;
     New->xoffset &= 31;
 
-    Image->data = 0;
+    Image->data = nullptr;
     FreeImage(Image);
     return New;
 }
@@ -582,9 +582,9 @@ XImage *RotImage(XImage *Image){
     int order = Image->bitmap_bit_order;
     int offs = h+Image->xoffset-1;
 
-    New = NewImage(w, h, 0, 1);
-    if (New == 0)
-      return 0;
+    New = NewImage(w, h, nullptr, 1);
+    if (!New)
+      return nullptr;
 
     k = (32 - Image->xoffset) & 3;
     for (i = h - 1; i && k; i--, k--) {
@@ -676,7 +676,7 @@ XImage *RotImage(XImage *Image){
 #define Try(n)								\
     if (n && n != thispage && n->extra) {				\
 	FreeImage((XImage*)n->extra);	\
-	n->extra = 0;						\
+	n->extra = nullptr;						\
 	return 1;							\
     }
 
@@ -693,7 +693,7 @@ release(int quit)
 	    if (pn->extra && pn != thispage && pn != thispage->prev &&
 		pn != thispage->next && pn != lastpage) {
 		FreeImage(Pimage(pn));
-		pn->extra = 0;
+		pn->extra = nullptr;
 		return 1;
 	    }
 	Try(lastpage);
@@ -715,7 +715,7 @@ XImage *NewImage(int w, int h, char *data, int bit_order){
     Display fake;
 
     fake = *Disp;
-    if (data == 0)
+    if (!data)
 	data = xmalloc(((w + 31) & ~31) * h / 8);
     fake.byte_order = ByteOrder;
     fake.bitmap_unit = 32;
@@ -723,7 +723,7 @@ XImage *NewImage(int w, int h, char *data, int bit_order){
 
     int returncode = -1;
     while ((newimage = XCreateImage(&fake, DefaultVisual(Disp, Default_Screen),
-				    1, XYBitmap, 0, data, w, h, 32, 0)) == 0 ){
+				    1, XYBitmap, 0, data, w, h, 32, 0)) == nullptr ){
       
       returncode = release(1);
       if (returncode == 0)
@@ -732,7 +732,7 @@ XImage *NewImage(int w, int h, char *data, int bit_order){
 
     if (returncode == 0){
       kfaxerror("Sorry","Can not allocate Memory for a new Fax Image\n");
-      return 0;
+      return nullptr;
     }
 
     Memused += newimage->bytes_per_line * newimage->height;
@@ -763,7 +763,7 @@ xmalloc(unsigned int size)
 
     while (Memused + size > Memlimit && release(0))
 	;
-    while ((p = (char*) malloc(size)) == 0)
+    while ((p = (char*) malloc(size)) == nullptr)
 	(void) release(1);
     return p;
 }
diff --git a/kfaxview/faxrenderer.cpp b/kfaxview/faxrenderer.cpp
index c2315908..5da6eaa9 100644
--- a/kfaxview/faxrenderer.cpp
+++ b/kfaxview/faxrenderer.cpp
@@ -61,7 +61,7 @@ void FaxRenderer::drawPage(double resolution, RenderedDocumentPage* page)
 #endif
 
   // Paranoid safety checks
-  if (page == 0) {
+  if (!page) {
     kdError() << "FaxRenderer::drawPage(documentPage*) called with argument == 0" << endl;
     return;
   }
@@ -86,7 +86,7 @@ void FaxRenderer::drawPage(double resolution, RenderedDocumentPage* page)
   SimplePageSize psize = pageSizes[page->getPageNumber() - 1];
   if (psize.isValid()) {
     TQPainter *foreGroundPaint = page->getPainter();
-    if (foreGroundPaint != 0) {
+    if (foreGroundPaint != nullptr) {
       // Compute an image for the page.
 
       // WARNING: It may be tempting to compute the image size in
diff --git a/kfaxview/libkfaximage/kfaximage.cpp b/kfaxview/libkfaximage/kfaximage.cpp
index f5153cfc..42d4508e 100644
--- a/kfaxview/libkfaximage/kfaximage.cpp
+++ b/kfaxview/libkfaximage/kfaximage.cpp
@@ -538,7 +538,7 @@ drawline(pixnum *run, int LineNum, pagenode *pn)
     }
     
     p = (t32bits *) pn->image.scanLine(LineNum*(2-pn->vres));
-    p1 =(t32bits *)( pn->vres ? 0 : pn->image.scanLine(1+LineNum*(2-pn->vres)));
+    p1 =(t32bits *)( pn->vres ? nullptr : pn->image.scanLine(1+LineNum*(2-pn->vres)));
     r = run;
     acc = 0;
     nacc = 0;
@@ -586,7 +586,7 @@ int
 KFaxImage::GetPartImage(pagenode *pn, int n)
 {
     unsigned char *Data = getstrip(pn, n);
-    if (Data == 0)
+    if (!Data)
 	return 3;
     pn->stripnum = n;
     (*pn->expander)(pn, drawline);
@@ -601,13 +601,13 @@ KFaxImage::GetImage(pagenode *pn)
 	return 1;
 
     int i;
-    if (pn->strips == 0) {
+    if (!pn->strips) {
 
         kdDebug() << "Loading RAW fax file " << m_filename << " size=" << pn->size << endl;
 
 	/* raw file; maybe we don't have the height yet */
 	unsigned char *Data = getstrip(pn, 0);
-	if (Data == 0){
+	if (!Data){
 	  return 0;
 	}
 	if (!NewImage(pn, pn->size.width(), (pn->vres ? 1:2) * pn->size.height()))
diff --git a/kfaxview/libkfaximage/kfaximage.h b/kfaxview/libkfaximage/kfaximage.h
index 56f6cc43..cdd5ed43 100644
--- a/kfaxview/libkfaximage/kfaximage.h
+++ b/kfaxview/libkfaximage/kfaximage.h
@@ -64,7 +64,7 @@ public:
      *  @see: numPages
      */
 
-    KFaxImage( const TQString &filename = TQString(), TQObject *parent = 0, const char *name = 0 );
+    KFaxImage( const TQString &filename = TQString(), TQObject *parent = nullptr, const char *name = nullptr );
 
     /**
      *  Destructor
diff --git a/kfaxview/main.cpp b/kfaxview/main.cpp
index bfaa8f30..13d17d59 100644
--- a/kfaxview/main.cpp
+++ b/kfaxview/main.cpp
@@ -17,30 +17,30 @@
 
 static TDECmdLineOptions options[] =
 {
-  { "unique", I18N_NOOP("Check if the file is loaded in another KFaxView instance.\nIf it is, bring up the other KFaxView. Otherwise, load the file."), 0 },
-  { "g", 0, 0 },
-  { "goto <pagenumber>", I18N_NOOP("Navigate to this page"), 0 },
+  { "unique", I18N_NOOP("Check if the file is loaded in another KFaxView instance.\nIf it is, bring up the other KFaxView. Otherwise, load the file."), nullptr },
+  { "g", nullptr, nullptr },
+  { "goto <pagenumber>", I18N_NOOP("Navigate to this page"), nullptr },
   // The rest of the options are only for compability with the old KFax
-  { "f", 0, 0 },
-  { "fine",         I18N_NOOP("(obsolete)"), 0 },
-  { "n", 0, 0 },
-  { "normal",       I18N_NOOP("(obsolete)"), 0 },
-  { "height",       I18N_NOOP("(obsolete)"), 0 },
-  { "w", 0, 0 },
-  { "width",        I18N_NOOP("(obsolete)"), 0 },
-  { "l", 0, 0 },
-  { "landscape",    I18N_NOOP("(obsolete)"), 0 },
-  { "u", 0, 0 },
-  { "upsidedown",   I18N_NOOP("(obsolete)"), 0 },
-  { "i", 0, 0 },
-  { "invert",       I18N_NOOP("(obsolete)"), 0 },
-  { "m", 0, 0 },
-  { "mem <bytes>",  I18N_NOOP("(obsolete)"), 0 },
-  { "r", 0, 0 },
-  { "reverse",      I18N_NOOP("(obsolete)"), 0 },
-  { "2" ,           I18N_NOOP("(obsolete)"), 0 },
-  { "4",            I18N_NOOP("(obsolete)"), 0 },
-  { "+file(s)", I18N_NOOP("Files to load"), 0 },
+  { "f", nullptr, nullptr },
+  { "fine",         I18N_NOOP("(obsolete)"), nullptr },
+  { "n", nullptr, nullptr },
+  { "normal",       I18N_NOOP("(obsolete)"), nullptr },
+  { "height",       I18N_NOOP("(obsolete)"), nullptr },
+  { "w", nullptr, nullptr },
+  { "width",        I18N_NOOP("(obsolete)"), nullptr },
+  { "l", nullptr, nullptr },
+  { "landscape",    I18N_NOOP("(obsolete)"), nullptr },
+  { "u", nullptr, nullptr },
+  { "upsidedown",   I18N_NOOP("(obsolete)"), nullptr },
+  { "i", nullptr, nullptr },
+  { "invert",       I18N_NOOP("(obsolete)"), nullptr },
+  { "m", nullptr, nullptr },
+  { "mem <bytes>",  I18N_NOOP("(obsolete)"), nullptr },
+  { "r", nullptr, nullptr },
+  { "reverse",      I18N_NOOP("(obsolete)"), nullptr },
+  { "2" ,           I18N_NOOP("(obsolete)"), nullptr },
+  { "4",            I18N_NOOP("(obsolete)"), nullptr },
+  { "+file(s)", I18N_NOOP("Files to load"), nullptr },
   TDECmdLineLastOption
 };
 
-- 
cgit v1.2.3

