Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile failure with mingw/gcc 3.4.2; ReadOnly issue #19

Closed
pstavirs opened this issue Jun 4, 2015 · 2 comments
Closed

Compile failure with mingw/gcc 3.4.2; ReadOnly issue #19

pstavirs opened this issue Jun 4, 2015 · 2 comments

Comments

@pstavirs
Copy link

pstavirs commented Jun 4, 2015

v0.7.3 was not compiling with gcc 3.4.2 on MINGW - yes I know it's a very old gcc version - but that's what I am on and the fix was simple - wrap 64-bit literals with Q_INT64_C()

Another issue I faced was that sometimes the Widget after creation would be set to readonly and I was unable to edit contents. My code never touches the readOnly property. Looking at the qhexedit.cpp, I see that _readOnly is never explicitly initialized - so I guess this could happen?

Here's a patch for both issues -

diff --git a/extra/qhexedit2/src/chunks.cpp b/extra/qhexedit2/src/chunks.cpp
--- a/extra/qhexedit2/src/chunks.cpp
+++ b/extra/qhexedit2/src/chunks.cpp
@@ -6,7 +6,7 @@

 #define BUFFER_SIZE 0x10000
 #define CHUNK_SIZE 0x1000
-#define READ_CHUNK_MASK 0xfffffffffffff000
+#define READ_CHUNK_MASK Q_INT64_C(0xfffffffffffff000)

 // ***************************************** Constructors and file settings

diff --git a/extra/qhexedit2/src/qhexedit.cpp b/extra/qhexedit2/src/qhexedit.cpp
--- a/extra/qhexedit2/src/qhexedit.cpp
+++ b/extra/qhexedit2/src/qhexedit.cpp
@@ -98,7 +98,7 @@ int QHexEdit::addressWidth()
 {
     qint64 size = _chunks->size();
     int n = 1;
-    if (size > 0x100000000){ n += 8; size /= 0x100000000;}
+    if (size > Q_INT64_C(0x100000000)){ n += 8; size /= Q_INT64_C(0x100000000);}
     if (size > 0x10000){ n += 4; size /= 0x10000;}
     if (size > 0x100){ n += 2; size /= 0x100;}
     if (size > 0x10){ n += 1; size /= 0x10;}
@@ -858,6 +858,7 @@ void QHexEdit::init()
     setCursorPosition(0);
     verticalScrollBar()->setValue(0);
     _modified = false;
+    _readOnly = false;
 }

 void QHexEdit::adjust()
@pstavirs
Copy link
Author

pstavirs commented Jun 5, 2015

Would the problem with _readOnly not being initialized be also applicable to other properties?

@Simsys
Copy link
Owner

Simsys commented Jun 7, 2015

fixed, see
dda2e77
352daca

I also checked the initialization of other properties and didn't find any problem.

Thanks for reporting these issues.

@Simsys Simsys closed this as completed Jun 7, 2015
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants