Exemplo n.º 1
0
int
android_charmap_setup(const char* kcm_file_path) {
    // android_charmap_count being non-zero is used here as a flag,
    //  indicating that charmap has been initialized for the running
    // executable.
    if (android_charmap_count != 0) {
        return 0;
    }

    if (NULL != kcm_file_path) {
        if (!parse_kcm_file(kcm_file_path, &android_custom_charmap)) {
            // Here we have two default charmaps and the custom one.
            android_charmap_count = 3;
            android_charmaps = qemu_malloc(sizeof(AKeyCharmap*) *
                                           android_charmap_count);
            android_charmaps[0] = &android_custom_charmap;
            android_charmaps[1] = &_qwerty_charmap;
            android_charmaps[2] = &_qwerty2_charmap;
        } else {
            derror("Unable to parse kcm file.");
            return -1;
        }
    } else {
        // Here we have only two default charmaps.
        android_charmap_count = 2;
        android_charmaps = qemu_malloc(sizeof(AKeyCharmap*) *
                           android_charmap_count);
        android_charmaps[0] = &_qwerty_charmap;
        android_charmaps[1] = &_qwerty2_charmap;
    }

    return 0;
}
Exemplo n.º 2
0
int
android_charmap_setup(const char* kcm_file_path) {
    if (NULL != kcm_file_path) {
        if (!parse_kcm_file(kcm_file_path, &android_custom_charmap)) {
            // Here we have two default charmaps and the custom one.
            android_charmap_count = 3;
            android_charmaps = qemu_malloc(sizeof(AKeyCharmap*) *
                                           android_charmap_count);
            android_charmaps[0] = &android_custom_charmap;
            android_charmaps[1] = &_qwerty_charmap;
            android_charmaps[2] = &_qwerty2_charmap;
        } else {
            derror("Unable to parse kcm file.");
            return -1;
        }
    } else {
        // Here we have only two default charmaps.
        android_charmap_count = 2;
        android_charmaps = qemu_malloc(sizeof(AKeyCharmap*) *
                           android_charmap_count);
        android_charmaps[0] = &_qwerty_charmap;
        android_charmaps[1] = &_qwerty2_charmap;
    }

    return 0;
}