#26 Full Unicode Build

trunk
closed-accepted
nobody
None
5
2010-04-18
2010-04-06
SimCutie
No

Full Unicode build (UnicodeDebug / Unicode Debug)
Fixed incompatible data types and function arg/return types in Unicode build.
Add appropriate conversions between single byte string and Unicode string data.

Discussion

  • Kimmo Varis

    Kimmo Varis - 2010-04-08

    Thanks a lot for all this work you've done!

    I quickly looked through the patch and I think the principle is correct. I have earlier converted lots of code to use TCHAR instead of char to get some progress in Unicode front. But of course when dealing with bytes TCHAR is not really a good type. BYTE is the correct type. And you probably have now fixed the errors I made in my initial "search/replace" approach.

    However this is so big patch it is hard to understand all the things that are changing. If you can split it to smaller pieces it would be great and make review and applying easier/faster. I can also start picking changes in smaller pieces and commit them while I progress with reviewing/testing them. I'm talking about splitting this work to pieces like one patch to fix language file loading, one patch to fix Text2BinTranslator etc. No need to submit separate tracker items, just split into separate patch files attached to this tracker item.

    You have some weird changes there, are you converting files to UTF-8 perhaps?

    Jochen had the idea to use one .exe binary that would load ANSI or Unicode version DLL. But I think the better approach is to have also separate .exe files. Which I think is the approach you have too in your changes.

    > - destlen = bPasteUnicode ? 2 * wcslen((WCHAR *)pcPastestring) : _tcslen(pcPastestring);
    > + // destlen = bPasteUnicode ? 2 * wcslen((WCHAR *)pcPastestring) : strlen((char*)pcPastestring);
    In general, just remove the code don't leave it in comments. Commented out code is just noise. We can see the history from version control.

    > - int endpos = startpos + iBytesPerLine - 1;
    > + UINT64 endpos = startpos + iBytesPerLine - 1;
    Changing offsets / sizes to 64-bit is generally good idea. We cannot load such big files to memory but can load part of very big file with large offset values. However this could be again a separate patch from Unicode conversion.

    About the coding style, please put the opening brace to new line, not same line:
    So instead of this:
    + if ( bPasteAsUnicode ) {
    do this:
    + if ( bPasteAsUnicode )
    * {
    like most of the code does.

    So I think this needs some small tweaks before I can commit it. I'll go through the changes more carefully in next few days.

     
  • Kimmo Varis

    Kimmo Varis - 2010-04-11

    I committed first part of this patch to SVN trunk:
    Completed: At revision: 851

    This commit includes find- and binary translator fixes.

     
  • Kimmo Varis

    Kimmo Varis - 2010-04-11

    Committe fix for loading encoder dlls to SVN trunk:
    Completed: At revision: 852

     
  • Kimmo Varis

    Kimmo Varis - 2010-04-11

    Committed more type fixes to SVN trunk:
    Completed: At revision: 853

     
  • Kimmo Varis

    Kimmo Varis - 2010-04-11

    Committed language loading/translation fixes to SVN trunk:
    Completed: At revision: 854

     
  • Kimmo Varis

    Kimmo Varis - 2010-04-11

    Committed type fixes for disk handling to SVN trunk:
    Completed: At revision: 855

     
  • Kimmo Varis

    Kimmo Varis - 2010-04-11

    Committed some int to unsigned int fixes to SVN trunk:
    Completed: At revision: 856

     
  • Kimmo Varis

    Kimmo Varis - 2010-04-11

    Committed conversion of offset values to 64-bit to SVN trunk:
    Completed: At revision: 857

     
  • Kimmo Varis

    Kimmo Varis - 2010-04-11

    Committed Unicode fix for main executable to SVN trunk:
    Completed: At revision: 858

     
  • Kimmo Varis

    Kimmo Varis - 2010-04-11

    Committed prelink.bat improvements to SVN trunk:
    Completed: At revision: 859

    I hope all your changes are now committed. Can you double-check?

    I did couple of coding style fixes and removed some commented out code while reviewing.

     
  • Kimmo Varis

    Kimmo Varis - 2010-04-11
    • status: open --> open-accepted
     
  • Kimmo Varis

    Kimmo Varis - 2010-04-11

    There seems to be now a compile errors with VS2005:

    .\HexDump.cpp(127) : error C2666: 'SimpleArray<T>::operator []' : 3 overloads have similar conversions
    1> with
    1> [
    1> T=BYTE
    1> ]
    1> d:\work\frhed\frhed_svn\frhed\simparr.h(56): could be 'BYTE &SimpleArray<T>::operator [](int)'
    1> with
    1> [
    1> T=BYTE
    1> ]
    1> or 'built-in C++ operator[(BYTE , unsigned int)'
    1> or 'built-in C++ operator[(BYTE , unsigned int)'
    1> while trying to match the argument list '(SimpleArray<T>, unsigned int)'
    1> with
    1> [
    1> T=BYTE
    1> ]
    1>.\HexDump.cpp(132) : error C2666: 'SimpleArray<T>::operator []' : 3 overloads have similar conversions
    1> with
    1> [
    1> T=BYTE
    1> ]
    1> d:\work\frhed\frhed_svn\frhed\simparr.h(56): could be 'BYTE &SimpleArray<T>::operator [](int)'
    1> with
    1> [
    1> T=BYTE
    1> ]
    1> or 'built-in C++ operator[(BYTE , unsigned int)'
    1> or 'built-in C++ operator[(BYTE , unsigned int)'
    1> while trying to match the argument list '(SimpleArray<T>, unsigned int)'
    1> with
    1> [
    1> T=BYTE
    1> ]
    1>.\HexDump.cpp(133) : error C2666: 'SimpleArray<T>::operator []' : 3 overloads have similar conversions
    1> with
    1> [
    1> T=BYTE
    1> ]
    1> d:\work\frhed\frhed_svn\frhed\simparr.h(56): could be 'BYTE &SimpleArray<T>::operator [](int)'
    1> with
    1> [
    1> T=BYTE
    1> ]
    1> or 'built-in C++ operator[(BYTE , unsigned int)'
    1> or 'built-in C++ operator[(BYTE , unsigned int)'
    1> while trying to match the argument list '(SimpleArray<T>, unsigned int)'
    1> with
    1> [
    1> T=BYTE
    1> ]
    1>.\HexDump.cpp(134) : error C2666: 'SimpleArray<T>::operator []' : 3 overloads have similar conversions
    1> with
    1> [
    1> T=BYTE
    1> ]
    1> d:\work\frhed\frhed_svn\frhed\simparr.h(56): could be 'BYTE &SimpleArray<T>::operator [](int)'
    1> with
    1> [
    1> T=BYTE
    1> ]
    1> or 'built-in C++ operator[(BYTE , unsigned int)'
    1> or 'built-in C++ operator[(BYTE , unsigned int)'
    1> while trying to match the argument list '(SimpleArray<T>, unsigned int)'
    1> with
    1> [
    1> T=BYTE
    1> ]
    1>.\HexDump.cpp(134) : error C2666: 'SimpleArray<T>::operator []' : 3 overloads have similar conversions
    1> with
    1> [
    1> T=BYTE
    1> ]
    1> d:\work\frhed\frhed_svn\frhed\simparr.h(56): could be 'BYTE &SimpleArray<T>::operator [](int)'
    1> with
    1> [
    1> T=BYTE
    1> ]
    1> or 'built-in C++ operator[(BYTE , unsigned int)'
    1> or 'built-in C++ operator[(BYTE , unsigned int)'
    1> while trying to match the argument list '(SimpleArray<T>, unsigned int)'
    1> with
    1> [
    1> T=BYTE
    1> ]
    1>.\HexDump.cpp(135) : error C2666: 'SimpleArray<T>::operator []' : 3 overloads have similar conversions
    1> with
    1> [
    1> T=BYTE
    1> ]
    1> d:\work\frhed\frhed_svn\frhed\simparr.h(56): could be 'BYTE &SimpleArray<T>::operator [](int)'
    1> with
    1> [
    1> T=BYTE
    1> ]
    1> or 'built-in C++ operator[(BYTE , unsigned int)'
    1> or 'built-in C++ operator[(BYTE , unsigned int)'
    1> while trying to match the argument list '(SimpleArray<T>, unsigned int)'
    1> with
    1> [
    1> T=BYTE
    1> ]
    1>.\HexDump.cpp(135) : error C2666: 'SimpleArray<T>::operator []' : 3 overloads have similar conversions
    1> with
    1> [
    1> T=BYTE
    1> ]
    1> d:\work\frhed\frhed_svn\frhed\simparr.h(56): could be 'BYTE &SimpleArray<T>::operator [](int)'
    1> with
    1> [
    1> T=BYTE
    1> ]
    1> or 'built-in C++ operator[(BYTE , unsigned int)'
    1> or 'built-in C++ operator[(BYTE , unsigned int)'
    1> while trying to match the argument list '(SimpleArray<T>, unsigned int)'
    1> with
    1> [
    1> T=BYTE
    1> ]
    1>.\HexDump.cpp(136) : error C2666: 'SimpleArray<T>::operator []' : 3 overloads have similar conversions
    1> with
    1> [
    1> T=BYTE
    1> ]
    1> d:\work\frhed\frhed_svn\frhed\simparr.h(56): could be 'BYTE &SimpleArray<T>::operator [](int)'
    1> with
    1> [
    1> T=BYTE
    1> ]
    1> or 'built-in C++ operator[(BYTE , unsigned int)'
    1> or 'built-in C++ operator[(BYTE , unsigned int)'
    1> while trying to match the argument list '(SimpleArray<T>, unsigned int)'
    1> with
    1> [
    1> T=BYTE
    1> ]
    1>.\HexDump.cpp(136) : error C2666: 'SimpleArray<T>::operator []' : 3 overloads have similar conversions
    1> with
    1> [
    1> T=BYTE
    1> ]
    1> d:\work\frhed\frhed_svn\frhed\simparr.h(56): could be 'BYTE &SimpleArray<T>::operator [](int)'
    1> with
    1> [
    1> T=BYTE
    1> ]
    1> or 'built-in C++ operator[(BYTE , unsigned int)'
    1> or 'built-in C++ operator[(BYTE , unsigned int)'
    1> while trying to match the argument list '(SimpleArray<T>, unsigned int)'
    1> with
    1> [
    1> T=BYTE
    1> ]
    1>.\HexDump.cpp(138) : error C2666: 'SimpleArray<T>::operator []' : 3 overloads have similar conversions
    1> with
    1> [
    1> T=BYTE
    1> ]
    1> d:\work\frhed\frhed_svn\frhed\simparr.h(56): could be 'BYTE &SimpleArray<T>::operator [](int)'
    1> with
    1> [
    1> T=BYTE
    1> ]
    1> or 'built-in C++ operator[(BYTE , unsigned int)'
    1> or 'built-in C++ operator[(BYTE , unsigned int)'
    1> while trying to match the argument list '(SimpleArray<T>, unsigned int)'
    1> with
    1> [
    1> T=BYTE
    1> ]

     
  • Kimmo Varis

    Kimmo Varis - 2010-04-18
    • status: open-accepted --> closed-accepted
     
  • Kimmo Varis

    Kimmo Varis - 2010-04-18

    Ok, I solved the compile error by adding new version of array operator for SimpleArray. I've also fixed some other remaining problems like missing manifest files for Unicode versions of binaries.

    Now I can get Unicode versions compiled and run with current trunk r 866.

    I hope I've included all your changes. But if you spot something is missing just let me know.

    Thanks a lot for this contribution. I'm now closing this patch item.

     
  • Jochen Tucht

    Jochen Tucht - 2010-05-30

    Translation system is designed to keep texts from PO files in octet strings regardless of build configuration. Translation to TCHAR strings is handled exclusively in LangArray::TranslateString(). WinMerge translation system has been working that way for years. So nothing to fix here.

    Back in the days when Frhed was in WinMerge repo, there had also existed a full unicode build, albeit experimental, and about solely for the purpose of testing the translation system.

    > But I think the better approach is to have also separate .exe files.

    Why? Main reason for having a single .exe was that it does not break existing code for maintaining the links to it. Anyway, the issue is outdated since we do not even address Win9x any more.

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks