]> git.tdb.fi Git - libs/gui.git/commitdiff
Use the append function to build hex dump
authorMikko Rasa <tdb@tdb.fi>
Tue, 2 Nov 2021 09:55:40 +0000 (11:55 +0200)
committerMikko Rasa <tdb@tdb.fi>
Tue, 2 Nov 2021 09:55:40 +0000 (11:55 +0200)
source/graphics/imageloader.cpp

index 52b087490d21b58612219952ec89844ad06c0e2a..e224af63cd161495a7e13a7ee795c92273864678 100644 (file)
@@ -1,6 +1,7 @@
 #include <msp/core/refptr.h>
 #include <msp/io/file.h>
 #include <msp/strings/format.h>
+#include <msp/strings/utils.h>
 #include "bmploader.h"
 #include "imageloader.h"
 #ifdef WITH_LIBPNG
@@ -73,11 +74,7 @@ ImageLoader *ImageLoader::open_io(IO::Seekable &io)
        {
                string sig_hex;
                for(unsigned i=0; i<sig_len; ++i)
-               {
-                       if(i)
-                               sig_hex += ' ';
-                       sig_hex += format("%02X", static_cast<unsigned char>(sig_buf[i]));
-               }
+                       append(sig_hex, " ", format("%02X", static_cast<unsigned char>(sig_buf[i])));
                throw unsupported_image_format(sig_hex);
        }