prpr
Well-Known Member
see https://github.com/hummypkg/hmt for the source


Having tweaked a few things, it now builds cleanly on both.

Patch attached.
I won't comment at this point about using %d with unsigned variables...
see https://github.com/hummypkg/hmt for the source
You just did.I won't comment at this point about using %d with unsigned variables...
Further portability tweaks, and I now have a version that builds on Humax, Linux, and Windows (Visual Studio).Thanks @af123 From the looks of it, it should be possible to build a Windows version from that source which requires no additional depencies.
Thanks!Oh and @prpr, point taken, I'll make sure my images are more user friendly in future!
And again, to fix the spelling errors in two instances of "preceeded".I'll update the patch diff shortly... done.
I assume thatThere was also a nasty buffer overwrite bug.
ctime()
returns more characters on Windows then? The strcpy() needs adjusting regardless, thanks.Oops, the second must be a copy and paste error but I can't explain how the first slipped by.And again, to fix the spelling errors in two instances of "preceeded".
Interesting - obviously it builds for me on the Humax but I just tried it on Debian and it built fine without changesit doesn't compile (either on the Humax or on my Linux box).
It returns e.g. "Sat Dec 29 19:00:00 2018\n" which is 26 characters including the null. Your buffer was 25. I like round numbers, so made it 32.I assume thatctime()
returns more characters on Windows then?
The rest of those tweaks were because time_t is 64 bit by default on VS2013 and passing in a pointer to a 32 bit number made ctime() return null, which obviously stuffs strcpy(). The way I did it will make it work on either 32 or 64 bit time_t.The strcpy() needs adjusting regardless, thanks.
It depends on how you approach these things really. Assigning a 32 bit variable to a 16 bit variable (say), quite rightly in my book, should produce a warning about potential data truncation (with the warning level set high enough - and I always turn it up from the default). It is good practice to use a cast to tell whoever is reading the code that you really meant to do this, rather than just turning the warning off and letting the compiler do it anyway.A lot of these casts look unnecessary to me, are you adding them because a toolchain is producing warnings and if so, which one?
The big thing was that "inline" stuff. I'll get you the build output in a bit.Interesting - obviously it builds for me on the Humax
It's now moaning about these superfluous include files:it still builds fine on the Humax and Linux but I have not tested Windows
#ifdef _WIN32
#include <io.h>
#include <windows.h>
#define MAXPATHLEN MAX_PATH
#define open(a,b,c) _open(a,b,c)
#define close(a) _close(a)
#define read(a,b,c) _read(a,b,c)
#define write(a,b,c) _write(a,b,c)
#define lseek(a,b,c) _lseek(a,b,c)
#define MAP_FAILED 0
#define mmap(a,b,c,d,e,f) MAP_FAILED
#define munmap(a,b)
#define strncasecmp _strnicmp
typedef long off_t;
#else /* _WIN32 */
#include <sys/mman.h>
#include <sys/param.h>
#include <strings.h>
#include <unistd.h>
#endif /* _WIN32 */
Glad you found it - Humax packages are gradually being migrated to our own git host repositoryJust built this cleanly for a Pi4B (Raspbian Lite) and working fine (thanks..), but worth noting that the source has vanished from the github link above - tracked it down to:
Code:https://git.hpkg.tv/hummypkg/hmt/