예제 #1
0
파일: reg.c 프로젝트: byskleroz/UltraDefrag
/**
 * @internal
 * @brief Compares two boot execute commands.
 * @details Treats 'command' and 'autocheck command' as the same.
 * @param[in] reg_cmd the command read from the registry.
 * @param[in] cmd the command to be searched for.
 * @return Positive value indicates that the commands are equal,
 * zero indicates that they're different, negative value
 * indicates a failure of the comparison.
 */
static int cmd_compare(wchar_t *reg_cmd,const wchar_t *cmd)
{
    wchar_t *long_cmd;
    int result;
    
    /* do we have the command registered as it is? */
    if(!winx_wcsicmp(cmd,reg_cmd))
        return 1;
        
    /* compare reg_cmd with 'autocheck {cmd}' */
    long_cmd = winx_swprintf(L"autocheck %ws",cmd);
    if(long_cmd == NULL){
        mtrace();
        return (-1);
    }
        
    result = winx_wcsicmp(long_cmd,reg_cmd);
    winx_free(long_cmd);
    return (result == 0) ? 1 : 0;
}
예제 #2
0
/**
 * @brief Defines rules for the fragmented files list sorting.
 */
static int fragmented_files_compare(const void *prb_a, const void *prb_b, void *prb_param)
{
    winx_file_info *a, *b;
    //udefrag_job_parameters *jp;
    
    a = (winx_file_info *)prb_a;
    b = (winx_file_info *)prb_b;
    //jp = (udefrag_job_parameters *)prb_param;

    /* sort files in descending order by number of fragments */
    if(a->disp.fragments != b->disp.fragments)
        return (a->disp.fragments < b->disp.fragments) ? 1 : (-1);

    /* if files have equal number of fragments, sort 'em by path */
    return winx_wcsicmp(a->path, b->path);
}