Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

Unicode compile error code-completion plugin oktober 4th

(1/3) > >>

David Perfors:

--- Code: ---plugins\codecompletion\/parser/token.h: In function `bool LoadStringFromFile(wxFile*, wxString&)':
plugins\codecompletion\/parser/token.h:128: error: ambiguous overload for 'operator=' in 'str = buf'
C:/Development/wxWidgets/include/wx/string.h:627: note: candidates are: wxString& wxString::operator=(int) <near match>
C:/Development/wxWidgets/include/wx/string.h:847: note:                 wxString& wxString::operator=(wxChar) <near match>
C:/Development/wxWidgets/include/wx/string.h:861: note:                 wxString& wxString::operator=(const wxWCharBuffer&) <near match>
C:/Development/wxWidgets/include/wx/string.h:916: note:                 wxString& wxString::operator=(const wxString&) <near match>

--- End code ---
I just report it here, because I don't have a solution for it...

mandrav:
Hmm, that's strange because this function used to exist in parser.cpp but I moved it (verbatim) in token.h. I haven't edited it in any way.
How come it used to build before and not now?
Any unicode guru to shed some light please?

The line where the error occurs is "str = _U(buf);", where 'str' is a wxString& and 'buf' is a static char[] (_U() is declared in sdk/settings.h)...

rickg22:
Maybe you need to include the header with the _U macro in there?

Anyway, I don't like function implementations being put in header files. Mind moving it as it was  pls? :P

David Perfors:
the header is there :? so I don't know what is wrong... :cry:

--Edit--
 I think I fixed it... at least it compiles again :lol: I post the diff so you can test it you're self, because I am NOT an unicode guru :lol:


--- Code: ---Index: src/plugins/codecompletion/parser/token.h
===================================================================
RCS file: /cvsroot/codeblocks/codeblocks/src/plugins/codecompletion/parser/token.h,v
retrieving revision 1.4
diff -u -r1.4 token.h
--- src/plugins/codecompletion/parser/token.h 4 Oct 2005 09:17:22 -0000 1.4
+++ src/plugins/codecompletion/parser/token.h 6 Oct 2005 09:29:22 -0000
@@ -122,7 +122,7 @@
     bool ok = true;
     if (size > 0 && size <= 512)
     {
-        static char buf[513];
+        static wxChar buf[513];
         ok = f->Read(buf, size) == size;
         buf[size] = '\0';
         str = _U(buf);
--- End code ---

rickg22:
I don't think that would work... since wxChar would be now 16 bytes, the 0 would be inserted at an inappropriate location, leaving us with garbage strings. We need to find out exactly what went wrong, or how to convert a char buffer into a wxString.

Hmmm try this:


--- Code: ---str = wxString(buf,wxConvUTF8);
--- End code ---

Navigation

[0] Message Index

[#] Next page

Go to full version