r24676 by jghali - Fix gcc compiler warning

scribus-commit scribus-commit at lists.scribus.net
Sun Jul 4 23:36:43 UTC 2021


Author: jghali
Date: Sun Jul  4 23:36:42 2021
New Revision: 24676

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24676
Log:
Fix gcc compiler warning

Modified:
    trunk/Scribus/scribus/plugins/gettext/pdbim/pdbim.cpp

Modified: trunk/Scribus/scribus/plugins/gettext/pdbim/pdbim.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24676&path=/trunk/Scribus/scribus/plugins/gettext/pdbim/pdbim.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/gettext/pdbim/pdbim.cpp	(original)
+++ trunk/Scribus/scribus/plugins/gettext/pdbim/pdbim.cpp	Sun Jul  4 23:36:42 2021
@@ -4,6 +4,9 @@
 a copyright and/or license notice that predates the release of Scribus 1.3.2
 for which a new license (GPL+exception) is in place.
 */
+
+#include <cstdint>
+
 #include <QApplication>
 #include <QFile>
 #include <QFileInfo>
@@ -174,14 +177,11 @@
 
 void PdbIm::selectSwap()
 {
-	union { char c[2];  Word n; }  w;
-	strncpy(  w.c, "\1\2",     2 );
-
-	if ( w.n == 0x0201 )
-		m_littlendian = true;
-	else
-		m_littlendian = false;
-
+	uint32_t value = 0x01;
+	const void * valuePtr = static_cast<const void *>(&value);
+	const uint8_t * valuePtr8 = static_cast<const unsigned char *>(valuePtr);
+
+	m_littlendian = (*valuePtr8 == 0x01);
 }  
 
 Word PdbIm::swap_Word( Word r )




More information about the scribus-commit mailing list