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

为适应不同编译器,且不更改字节对齐方式,建议修改attr联合体的定义方式,master代码在mingw32下存在问题,导致元素ShellCommandType type : 4恒定为0,无法执行命令解析 #149

Open
luckyxrq opened this issue Apr 14, 2023 · 0 comments

Comments

@luckyxrq
Copy link

luckyxrq commented Apr 14, 2023

需要更改为:

union
    {
        struct
        {
            int permission : 8;                       /**< command权限 */
            ShellCommandType type : 4;                          /**< command类型 */
            int enableUnchecked : 1;                  /**< 在未校验密码的情况下可用 */
            int disableReturn : 1;                    /**< 禁用返回值输出 */
            int  readOnly : 1;                        /**< 只读 */
            int reserve : 1;                          /**< 保留 */
            int paramNum : 4;                         /**< 参数数量 */
        } attrs;
        int value;
    } attr;

改了后sizeof(attr)正常为4, type才能对应左移8位的偏移
否则不正常sizeof(attr)为12

@luckyxrq luckyxrq changed the title shell_command结构体字节对齐,在Windows x64的qt(mingw32条件下)存在问题,导致type类型恒定为0 为适应不同编译器,切不更改字节对齐方式,建议修改attr联合体的定义方式,master代码在mingw32下存在问题,导致元素ShellCommandType type : 4恒定为0,无法执行命令解析 Apr 17, 2023
@luckyxrq luckyxrq changed the title 为适应不同编译器,切不更改字节对齐方式,建议修改attr联合体的定义方式,master代码在mingw32下存在问题,导致元素ShellCommandType type : 4恒定为0,无法执行命令解析 为适应不同编译器,且不更改字节对齐方式,建议修改attr联合体的定义方式,master代码在mingw32下存在问题,导致元素ShellCommandType type : 4恒定为0,无法执行命令解析 Apr 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant