Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

文件名过长 + 大量文件 (> 400) 的时候,缺少数据 #10

Closed
jixunmoe opened this issue Apr 29, 2021 · 1 comment
Closed

文件名过长 + 大量文件 (> 400) 的时候,缺少数据 #10

jixunmoe opened this issue Apr 29, 2021 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@jixunmoe
Copy link
Owner

jixunmoe commented Apr 29, 2021

问题报告来自博客评论,由 jusanyuan 提交。

jusanyuan:

您好,这个标准提取码生成器,在批量本地生成的时候,好像超过333个文件,后面的就生成不出来了呢?请问一下这是什么原因呢

Jixun:

并没有人为限制数量,因此你这个问题的原因不清楚。
注意在旧版本(v3.0.0)如果文件过小的话是不会被生成的: https://github.com/jixunmoe/mfcDuDownloadCodeGenerator/blob/v3/generator/ListBoxEx.cpp#L260

jusanyuan:

哦!那就很奇怪了,旧版本是文件过小就不能生成,我用的是新版本,我测试过很多次了,我以为是系统的问题,换了几台电脑都是这个结果,准确来说只能生成277个文件,,第278个文件之后的都不能生成,有机会的话,麻烦您能测试测试吗?谢谢

Jixun:

mkdir -p test_bin
dd if=/dev/zero of=test_bin/001.bin bs=4096 count=64

for i in $(seq -f '%03g' 2 278); do
    cp test_bin/001.bin test_bin/$i.bin
done

使用上述脚本生成测试文件,然后将整个目录拖入程序,能看到全部 278 个文件。手动将所有文件拖入界面或使用添加文件/目录功能也能看到全部 278 个文件。

测试文件打包: https://mega.nz/file/2ZUwgLRQ#_np4XzsLjLUPCic-ltOz8YA_bFky05gg1X7XjXqw-to

jusanyuan:

你好,
1、我用你给我的测试文件“278个文件”,我再用278个文件生成278个相同文件副本,总共556个文件放在一起,用标准码生成,只能生成357个。
2、我在你个的278个测试文件文件名前加上"19f256c9ca517896b57e6112a59f108619f256c9ca517896b57e6112a59f1086_"然后278个文件用标准码生成工具只能生成204个。
3、用你给的测试文件,命名到400.bin,总共400个文件,然后这400个文件用标准码生成工具只能生成366个。
4、从这些规律看来,好像和文件名的长度有关系,文件名越长好像能生成的也就越少,你可以测试一下文件名比较长,500个以上文件,都是不能完全生成的,有时间你可以测试一下 谢谢

Jixun:

如果可以请提供一下文件所在的目录和系统版本,我去这个环境试试。

文件名的话,我到时候用 19f256c9ca517896b57e6112a59f108619f256c9ca517896b57e6112a59f1086_###.bin 来测,其中 ###000400

jusanyuan:

win10专业版20H2和win7旗舰版都试过了,目录我就放在E盘上在,你也可以直接用你给我的测试文件测试,增加到400个文件就是了,幸苦了,非常感谢

@jixunmoe jixunmoe added the bug Something isn't working label Apr 29, 2021
@jixunmoe jixunmoe self-assigned this Apr 29, 2021
@jixunmoe
Copy link
Owner Author

https://stackoverflow.com/a/184484

I found the documentation is wrong when mentioning the default size for a single line CEdit control in vista.

I ran this code:

CWnd* pWnd = dlg.GetDlgItem(nItemId);
CEdit *edit = static_cast<CEdit*>(pWnd); //dynamic_cast does not work
if(edit != 0)
{
    UINT limit = edit->GetLimitText(); //The current text limit, in bytes, for this CEdit object.
    //value returned: 30000 (0x7530)
    edit->SetLimitText(0);
    limit = edit->GetLimitText();
    //value returned: 2147483646 (0x7FFFFFFE) 
}

the documentation states:

Before EM_SETLIMITTEXT is called, the default limit for the amount of text a user can enter in an edit control is 32,767 characters.

which is apparently wrong.

解决方案:初始化的时候设定为最大值。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant