[sword-devel] Win32 FileMgr Subclass
Troy A. Griffitts
scribe at crosswire.org
Sun Jul 26 14:37:37 EDT 2020
Thanks Tobias,
I've made these updates and should have fixed the error in filemgr.cpp
on line 410. I appreciate the feedback. Please update and try this out
and let me know. Thanks for testing your compiler.
Troy
On 7/26/20 8:25 PM, Tobias Klein wrote:
>
> To address the errors below I had to add the include for <windows.h>
> both in *src/mgr/filemgr.cpp* and in *src/modules/commons/zipmgr.cpp*.
>
> After that I'm getting the next error:
>
> 1>C:\Users\tobi\Dev\sword-build-win32\sword\src\mgr\filemgr.cpp(410):
> error C2664: 'BOOL FindNextFileA(HANDLE,LPWIN32_FIND_DATAA)': cannot
> convert argument 2 from 'WIN32_FIND_DATAW *' to 'LPWIN32_FIND_DATAA'
> 1>C:\Users\tobi\Dev\sword-build-win32\sword\src\mgr\filemgr.cpp(410):
> note: Types pointed to are unrelated; conversion requires
> reinterpret_cast, C-style cast or function-style cast
>
> Best regards,
> Tobias
>
> On 7/26/20 4:44 PM, Troy A. Griffitts wrote:
>>
>> Can one of you guys try simply including <windows.h> at the top of
>> filemgr.cpp and see if this fixes it for you?
>>
>>
>> On 7/26/20 4:01 PM, Tobias Klein wrote:
>>>
>>> I'm getting similar error messages with Visual Studio 2019. Note
>>> that I'm also generating the make files via CMake.
>>>
>>> First couple of error messages:
>>>
>>> 2>D:\a\sword-build-win32\sword-build-win32\sword\src\mgr\filemgr.cpp(395,2):
>>> error C2065: 'WIN32_FIND_DATAW': undeclared identifier
>>> 2>D:\a\sword-build-win32\sword-build-win32\sword\src\mgr\filemgr.cpp(395,19):
>>> error C2146: syntax error: missing ';' before identifier 'fileData'
>>>
>>> 2>D:\a\sword-build-win32\sword-build-win32\sword\src\mgr\filemgr.cpp(395,19):
>>> error C2065: 'fileData': undeclared identifier
>>>
>>> 2>D:\a\sword-build-win32\sword-build-win32\sword\src\mgr\filemgr.cpp(398,2):
>>> error C2065: 'HANDLE': undeclared identifier
>>>
>>> 2>D:\a\sword-build-win32\sword-build-win32\sword\src\mgr\filemgr.cpp(398,9):
>>> error C2146: syntax error: missing ';' before identifier 'findIterator'
>>> 2>D:\a\sword-build-win32\sword-build-win32\sword\src\mgr\filemgr.cpp(398,9):
>>> error C2065: 'findIterator': undeclared identifier
>>> 2>D:\a\sword-build-win32\sword-build-win32\sword\src\mgr\filemgr.cpp(398,51):
>>> error C2065: 'fileData': undeclared identifier
>>>
>>>
>>> Best regards,
>>> Tobias
>>>
>>> On 7/26/20 3:00 PM, Greg Hellings wrote:
>>>>
>>>>
>>>> On Sun, Jul 26, 2020 at 6:42 AM Troy A. Griffitts
>>>> <scribe at crosswire.org <mailto:scribe at crosswire.org>> wrote:
>>>>
>>>> I've just committed the last bit for fixing the WIN32 Unicode
>>>> issues. If anyone can try compiling and running Xiphos without
>>>> the Xiphos patch or any other projects for Windows, and let me
>>>> know if things work for them in folders which include Unicode
>>>> character, I would appreciate it. I've tested BibleCS and it
>>>> now works with a SWORD_PATH defined to /books/χαρις. I've
>>>> tested using and installing modules in this configuration and
>>>> believe all the bugs are squashed, but I would love
>>>> confirmation from other projects.
>>>>
>>>> Thanks for any feedback,
>>>>
>>>> Troy
>>>>
>>>> During cross-compile I'm getting the following errors:
>>>>
>>>> [ 6%] Building CXX object CMakeFiles/sword.dir/src/mgr/filemgr.cpp.obj
>>>> /usr/bin/i686-w64-mingw32-g++ -DCLUCENE2 -DCURLAVAILABLE
>>>> -DCURLSFTPAVAILABLE -DEXCLUDEBZIP2 -DEXCLUDEXZ
>>>> -DGLOBCONFPATH=\"/usr/i686-w64-mingw32/sys-root/mingw/etc/sword.conf\"
>>>> -DUSEICUREGEX -DUSELUCENE -DU_USING_ICU_NAMESPACE
>>>> -D_FTPLIB_NO_COMPAT -D_ICU_ -Dsword_EXPORTS
>>>> @CMakeFiles/sword.dir/includes_CXX.rsp -D_ICUSWORD_ -g3 -Wall -O0
>>>> -D_ICUSWORD_ -o CMakeFiles/sword.dir/src/mgr/filemgr.cpp.obj -c
>>>> /builddir/build/BUILD/sword-1.8.900/src/mgr/filemgr.cpp
>>>> /builddir/build/BUILD/sword-1.8.900/src/mgr/filemgr.cpp: In static
>>>> member function 'static std::vector<sword::DirEntry>
>>>> sword::FileMgr::getDirList(const char*, bool, bool)':
>>>> /builddir/build/BUILD/sword-1.8.900/src/mgr/filemgr.cpp:395:2:
>>>> error: 'WIN32_FIND_DATAW' was not declared in this scope
>>>> 395 | WIN32_FIND_DATAW fileData;
>>>> | ^~~~~~~~~~~~~~~~
>>>> /builddir/build/BUILD/sword-1.8.900/src/mgr/filemgr.cpp:398:2:
>>>> error: 'HANDLE' was not declared in this scope
>>>> 398 | HANDLE findIterator = FindFirstFileW(wcharPath, &fileData);
>>>> | ^~~~~~
>>>> /builddir/build/BUILD/sword-1.8.900/src/mgr/filemgr.cpp:399:6:
>>>> error: 'findIterator' was not declared in this scope
>>>> 399 | if (findIterator != INVALID_HANDLE_VALUE) {
>>>> | ^~~~~~~~~~~~
>>>> /builddir/build/BUILD/sword-1.8.900/src/mgr/filemgr.cpp:399:22:
>>>> error: 'INVALID_HANDLE_VALUE' was not declared in this scope
>>>> 399 | if (findIterator != INVALID_HANDLE_VALUE) {
>>>> | ^~~~~~~~~~~~~~~~~~~~
>>>> /builddir/build/BUILD/sword-1.8.900/src/mgr/filemgr.cpp:401:35:
>>>> error: 'fileData' was not declared in this scope
>>>> 401 | SWBuf dirEntName = wcharToUTF8(fileData.cFileName);
>>>> | ^~~~~~~~
>>>> /builddir/build/BUILD/sword-1.8.900/src/mgr/filemgr.cpp:405:49:
>>>> error: 'FILE_ATTRIBUTE_DIRECTORY' was not declared in this scope
>>>> 405 | i.isDirectory = fileData.dwFileAttributes &
>>>> FILE_ATTRIBUTE_DIRECTORY;
>>>> | ^~~~~~~~~~~~~~~~~~~~~~~~
>>>> /builddir/build/BUILD/sword-1.8.900/src/mgr/filemgr.cpp:409:40:
>>>> error: 'fileData' was not declared in this scope
>>>> 409 | } while (FindNextFile(findIterator, &fileData) != 0);
>>>> | ^~~~~~~~
>>>> /builddir/build/BUILD/sword-1.8.900/src/mgr/filemgr.cpp:409:12:
>>>> error: 'FindNextFile' was not declared in this scope
>>>> 409 | } while (FindNextFile(findIterator, &fileData) != 0);
>>>> | ^~~~~~~~~~~~
>>>> /builddir/build/BUILD/sword-1.8.900/src/mgr/filemgr.cpp:410:3:
>>>> error: 'FindClose' was not declared in this scope; did you mean
>>>> '_findclose'?
>>>> 410 | FindClose(findIterator);
>>>> | ^~~~~~~~~
>>>> | _findclose
>>>> /builddir/build/BUILD/sword-1.8.900/src/mgr/filemgr.cpp:397:17:
>>>> warning: unused variable 'wcharPath' [-Wunused-variable]
>>>> 397 | const wchar_t *wcharPath = (const wchar_t
>>>> *)wcharBuf.getRawData();
>>>> | ^~~~~~~~~
>>>> /builddir/build/BUILD/sword-1.8.900/src/mgr/filemgr.cpp: In static
>>>> member function 'static int sword::FileMgr::createParent(const char*)':
>>>> /builddir/build/BUILD/sword-1.8.900/src/mgr/filemgr.cpp:436:5:
>>>> error: '_wmkdir' was not declared in this scope; did you mean 'mkdir'?
>>>> 436 | _wmkdir((const wchar_t *)utf8ToWChar(buf).getRawData());
>>>> | ^~~~~~~
>>>> | mkdir
>>>> make[2]: *** [CMakeFiles/sword.dir/build.make:283:
>>>> CMakeFiles/sword.dir/src/mgr/filemgr.cpp.obj] Error 1
>>>>
>>>> I'm assuming there's a new package or macro I need to define? On my
>>>> system the WIN32_FIND_DATAW struct is defined in both minwinbase.h
>>>> and shtypes.h. I'm building with MinGW which might have a different
>>>> header structure than your compilers, if you're using Borland?
>>>>
>>>> --Greg
>>>>
>>>>
>>>> On 7/20/20 7:18 PM, Greg Hellings wrote:
>>>>> Sorry for the previous blank email - user error when I tried
>>>>> to reply:
>>>>>
>>>>> On Sun, Jul 19, 2020 at 2:40 PM Tobias Klein
>>>>> <contact at tklein.info <mailto:contact at tklein.info>> wrote:
>>>>>
>>>>> Thanks for giving me the background on this, Karl! I
>>>>> appreciate it!
>>>>>
>>>>> Is Xiphos the only frontend that has been patching Sword
>>>>> for this purpose? Then I suppose all other frontends
>>>>> suffer from this issue, huh?
>>>>>
>>>>>
>>>>> When I first encountered this patch in Xiphos I tested with
>>>>> BibleTime and The Sword Project for Windows and both of them
>>>>> do crash under these circumstances.
>>>>>
>>>>> Yes, other toolkits such as Qt do have wrappers for this
>>>>> shortcoming already, but none of the other front ends I've
>>>>> worked with have bothered to put in the effort to produce a
>>>>> patched version of Sword to fix the crash.
>>>>>
>>>>> --Greg
>>>>>
>>>>> _______________________________________________
>>>>> sword-devel mailing list:sword-devel at crosswire.org <mailto:sword-devel at crosswire.org>
>>>>> http://www.crosswire.org/mailman/listinfo/sword-devel
>>>>> Instructions to unsubscribe/change your settings at above page
>>>> _______________________________________________
>>>> sword-devel mailing list: sword-devel at crosswire.org
>>>> <mailto:sword-devel at crosswire.org>
>>>> http://www.crosswire.org/mailman/listinfo/sword-devel
>>>> Instructions to unsubscribe/change your settings at above page
>>>>
>>>>
>>>> _______________________________________________
>>>> sword-devel mailing list:sword-devel at crosswire.org
>>>> http://www.crosswire.org/mailman/listinfo/sword-devel
>>>> Instructions to unsubscribe/change your settings at above page
>>>
>>> _______________________________________________
>>> sword-devel mailing list:sword-devel at crosswire.org
>>> http://www.crosswire.org/mailman/listinfo/sword-devel
>>> Instructions to unsubscribe/change your settings at above page
>>
>> _______________________________________________
>> sword-devel mailing list:sword-devel at crosswire.org
>> http://www.crosswire.org/mailman/listinfo/sword-devel
>> Instructions to unsubscribe/change your settings at above page
>
> _______________________________________________
> sword-devel mailing list: sword-devel at crosswire.org
> http://www.crosswire.org/mailman/listinfo/sword-devel
> Instructions to unsubscribe/change your settings at above page
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.crosswire.org/pipermail/sword-devel/attachments/20200726/d8db1e5c/attachment-0001.html>
More information about the sword-devel
mailing list