File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed
Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change 22
33#include " ../util/logging.h"
44
5- PropellerImage::PropellerImage (QByteArray image, QString filename)
5+ PropellerImage::PropellerImage (const QByteArray & image, const QString & filename)
66{
77 _image = image;
88 _filename = filename;
@@ -31,9 +31,11 @@ quint8 PropellerImage::checksum()
3131{
3232 quint8 sum = 0 ;
3333 foreach (quint8 c, _image)
34+ {
3435 sum += c;
36+ }
3537
36- if (_type == Binary )
38+ if (imageSize () <= programSize () )
3739 sum += 2 * (0xff + 0xff + 0xff + 0xf9 );
3840
3941 return sum;
@@ -75,8 +77,10 @@ QByteArray PropellerImage::data()
7577 Sets the raw binary data of the image.
7678 */
7779
78- void PropellerImage::setData (QByteArray data) {
80+ void PropellerImage::setData (QByteArray data)
81+ {
7982 _image = data;
83+ _image.detach ();
8084}
8185
8286/* *
Original file line number Diff line number Diff line change @@ -95,8 +95,8 @@ class PropellerImage
9595
9696public:
9797
98- PropellerImage ( QByteArray image = QByteArray (),
99- QString filename = " " );
98+ PropellerImage ( const QByteArray & image = QByteArray (),
99+ const QString & filename = " " );
100100
101101 /* *
102102 @name Image Validation
You can’t perform that action at this time.
0 commit comments