williamjbronskii / heekscnc

Automatically exported from code.google.com/p/heekscnc
0 stars 0 forks source link

Patch for string assignment type error causing Unix compile error #364

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Building on Ubuntu 14.04
2. Using wxWidgets 3.0 *but probably also true for 2.8*

What is the expected output? What do you see instead?
Normal build is expected (no error at this point in code)

See:
from /home/tom/heekscnc/src/HeeksCNC.cpp:8:
/home/tom/heekscnc/src/HeeksCNC.cpp: In member function 'wxString 
CHeeksCNCApp::GetResourceFilename(wxString, bool) const':
/home/tom/heekscnc/src/HeeksCNC.cpp:1402:107: error: operands to ?: have 
different types 'wchar_t*' and 'wxString'
  filename = (wxGetenv(wxT("XDG_CONFIG_HOME"))?wxGetenv(wxT("XDG_CONFIG_HOME")):wxFileName::GetHomeDir() + wxT("/.config")) + wxT("/heekscnc/") + resource;

What version of the product are you using? On what operating system?
SVN trunk
Ubuntu Linux 14.04

Please provide any additional information below.

Fixed by casting first option of the unary operator to wxString
user@host~/heekscnc$ svn diff
Index: src/HeeksCNC.cpp
===================================================================
--- src/HeeksCNC.cpp    (revision 1563)
+++ src/HeeksCNC.cpp    (working copy)
@@ -1399,7 +1399,10 @@
    // Unix
    // Under Unix, it looks for a user-defined resource first.
    // According to FreeDesktop XDG standards, HeeksCNC user-defineable resources should be placed in XDG_CONFIG_HOME (usually: ~/.config/heekscnc/)
-   filename = 
(wxGetenv(wxT("XDG_CONFIG_HOME"))?wxGetenv(wxT("XDG_CONFIG_HOME")):wxFileName::G
etHomeDir() + wxT("/.config")) + wxT("/heekscnc/") + resource;
+   filename = (wxGetenv(wxT("XDG_CONFIG_HOME")) ?
+           wxString(wxGetenv(wxT("XDG_CONFIG_HOME"))) :
+           wxFileName::GetHomeDir() + wxT("/.config")) +
+                    wxT("/heekscnc/") + resource;

    // Under Unix user can't save its resources in system (permissions denied), so we always return a user-writable file
    if(!writableOnly)

Fix is above because I can't attach patch file
Issue system says Issue attachment storage quota exceeded.

-tgii

Original issue reported on code.google.com by me85638...@gmail.com on 6 Feb 2015 at 2:51

GoogleCodeExporter commented 8 years ago
Hello,

Thx for this patch.

wxWigdets 2.8 installation is not affected by this trouble:
wxChar* can be automatically converted to wxString but you're right wxWigdet 
3.0 does change strings behaviour.
So, I'll try this patch with wxWidget 2.8, then apply it upstream.

Please note a PPA does already exists for Ubuntu, but still use wxWidget 2.8 
(backward compatibility).

Original comment by neomil...@gmail.com on 7 Feb 2015 at 10:11

GoogleCodeExporter commented 8 years ago
r1564 fixes this issue.

Original comment by neomil...@gmail.com on 7 Feb 2015 at 10:41

GoogleCodeExporter commented 8 years ago
Thank you for the added clarification about wx2.8 and accepting the patch!

Original comment by me85638...@gmail.com on 7 Feb 2015 at 1:11