diff o3pack.cpp @ 8:21ce6187d32e

Minor changes done by automatic style checker
author Ideenmodellierer
date Mon, 12 Jan 2026 13:51:17 +0000
parents 0b3630a29ad8
children
line wrap: on
line diff
--- a/o3pack.cpp	Mon Jan 12 13:49:16 2026 +0000
+++ b/o3pack.cpp	Mon Jan 12 13:51:17 2026 +0000
@@ -7,18 +7,10 @@
 #include "HexFile.h"
 
 //////////////////////////////////////////////////////////////////////////////
-static unsigned char frogSecretKey[16] = {
-    111, 85, 190, 69,
-    108,254, 242, 19,
-    231, 49, 248,255,
-    233, 48, 176,241
-};
-static unsigned char ostc3SecretKey[16] = {
-    241,233, 176, 48,
-     69,111, 190, 85,
-    255,231, 248, 49,
-     19,108, 242,254
-};
+static unsigned char frogSecretKey[16]
+    = {111, 85, 190, 69, 108, 254, 242, 19, 231, 49, 248, 255, 233, 48, 176, 241};
+static unsigned char ostc3SecretKey[16]
+    = {241, 233, 176, 48, 69, 111, 190, 85, 255, 231, 248, 49, 19, 108, 242, 254};
 
 int main(int argc, char *argv[])
 {
@@ -31,19 +23,20 @@
     bool force = false;
     bool ostc3 = true;
 
-    if( argc < 2 ) goto Usage;
+    if (argc < 2)
+        goto Usage;
 
-    if( QString(argv[1]).toLower() == "-frog" ) {
+    if (QString(argv[1]).toLower() == "-frog") {
         ostc3 = false;
         argc--, argv++;
-    } else if(  QString(argv[1]).toLower() == "-ostc3" ) {
+    } else if (QString(argv[1]).toLower() == "-ostc3") {
         ostc3 = true;
         argc--, argv++;
     }
 
-    in  = QDir::cleanPath(current.absoluteFilePath(argv[1]));
+    in = QDir::cleanPath(current.absoluteFilePath(argv[1]));
     out = QDir::cleanPath(current.absoluteFilePath(argv[2]));
-    if( argv[2] == QString("-f") && argc >= 3 ) {
+    if (argv[2] == QString("-f") && argc >= 3) {
         out = QDir::cleanPath(current.absoluteFilePath(argv[3]));
         force = true;
     }
@@ -51,7 +44,7 @@
     //---- Check parameters consistency --------------------------------------
     {
         QFileInfo fi(in);
-        if( ! fi.exists() || ! fi.isReadable() ) {
+        if (!fi.exists() || !fi.isReadable()) {
             qWarning().nospace() << "Cannot read input file " << in;
             goto Usage;
         }
@@ -59,13 +52,13 @@
 
     {
         QFileInfo fo(out);
-        if( fo.exists() ) {
-            if( !force ) {
+        if (fo.exists()) {
+            if (!force) {
                 qWarning().nospace() << "File " << out << " exists. Use -f to force overwrite.";
                 goto Usage;
             }
 
-            if( !fo.isWritable() ) {
+            if (!fo.isWritable()) {
                 qWarning().nospace() << "Cannot write to " << out << ". Protected file ?";
                 goto Usage;
             }
@@ -75,7 +68,7 @@
 
     //---- Load the HEX file -------------------------------------------------
     {
-        QProgressBar* progress = new QProgressBar(0);
+        QProgressBar *progress = new QProgressBar(0);
         progress->setFormat("Loading %p%");
         progress->show();
 
@@ -90,11 +83,10 @@
             sprintf(sum, "%08X", hex.checksum());
             qDebug() << "Checksum " << sum;
 
-    //---- Save encrypted HEX file -------------------------------------------
+            //---- Save encrypted HEX file -------------------------------------------
             progress->setFormat("Saving %p%");
             hex.saveEncrypted(out, (ostc3 ? ostc3SecretKey : frogSecretKey), progress);
-        }
-        catch(const char* msg) {
+        } catch (const char *msg) {
             qWarning() << "Failed: " << msg;
         }
 
@@ -106,7 +98,7 @@
 
 Usage:
     qWarning() << "Usage:" << endl
-               << "    " << QString(app.arguments()[0]).section('/', -1).section('\\',-1)
+               << "    " << QString(app.arguments()[0]).section('/', -1).section('\\', -1)
                << "[-frog|-ostc3]"
                << " input.hex [-f] output.hex";
     exit(-1);