It would be useful if a WDX plugin developer could determine the maximum length of the ft_string field type. Currently the maxlen parameter is a parameter to functions ContentGetValue() and ContentEditValue(). It is also a hidden limitation of ContentSetValue().
I noticed that maxlen is always 2^10. However JPG comment supports a maximum length of 2^16. So there is a limitation that only 2^10 characters can be set by the content plugin.
Additionally, I noticed that "Load from file under cursor" will display only 258 = MAX_PATH - 2 characters although maxlen characters are retrieved from the plugin by ContentGetValue(). If the >> button is clicked afterwards with flags=editflags_initialize then the FieldValue in ContentEditValue() is only 258 characters long and not maxlen as expected.
maxlen in content plugins
Moderators: Hacker, petermad, Stefan2, white
maxlen in content plugins
TC plugins: Autodesk 3ds Max / Inventor / Revit Preview, FileInDir, ImageMetaData (JPG Comment/EXIF/IPTC/XMP), MATLAB MAT-file Viewer, Mover, SetFolderDate, Solid Edge Preview, Zip2Zero and more
- ghisler(Author)
- Site Admin
- Posts: 50479
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Just copy only as many characters to the buffer as TC tells you. In Delphi, there is a function strlcopy for that. Here is the equivalent in C/C++:I noticed that maxlen is always 2^10. However JPG comment supports a maximum length of 2^16. So there is a limitation that only 2^10 characters can be set by the content plugin.
Code: Select all
char* strlcpy(char* p,const char* p2,int maxlen)
{
if ((int)strlen(p2)>=maxlen) {
strncpy(p,p2,maxlen);
p[maxlen]=0;
} else
strcpy(p,p2);
return p;
}
This is due to limitations of the operating system (MAXLEN-1 is the maximum path length supported by Ansi file system functions).Additionally, I noticed that "Load from file under cursor" will display only 258 = MAX_PATH - 2 characters although maxlen characters are retrieved from the plugin by ContentGetValue(). If the >> button is clicked afterwards with flags=editflags_initialize then the FieldValue in ContentEditValue() is only 258 characters long and not maxlen as expected.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
This is of course what is done. But buffer size of TC is too short. There is no chance to specify the buffer size. Buffer size maxlen = 2^10 might be suitable for custom columns view, however larger maxlen is possible for the field edit window of ContentEditField(). Do you think a user-specified maxlen is possible?ghisler(Author) wrote:Just copy only as many characters to the buffer as TC tells you.
TC plugins: Autodesk 3ds Max / Inventor / Revit Preview, FileInDir, ImageMetaData (JPG Comment/EXIF/IPTC/XMP), MATLAB MAT-file Viewer, Mover, SetFolderDate, Solid Edge Preview, Zip2Zero and more
- ghisler(Author)
- Site Admin
- Posts: 50479
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
No, that's not possible. But I could use a larger buffer for the field edit, where it really would make sense...
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
2ghisler(Author)
Support for fields of type fulltext would be also nice
I'm not sure if a larger buffer for writing fields would make sense if it's not used in the read functions. In other words: A string would be written which cannot be displayed.But I could use a larger buffer for the field edit, where it really would make sense...
Support for fields of type fulltext would be also nice
