C++ (Cpp) error Examples

C++ (Cpp) error - 30 examples found. These are the top rated real world C++ (Cpp) examples of error extracted from open source projects. You can rate examples to help us improve the quality of examples.
Example #1
0
void printInstructions(xed_uint8_t* codeStartAddr,
                       xed_uint8_t* codeEndAddr,
                       bool printAddr) {
    char codeStr[MAX_INSTR_ASM_LEN];
    xed_uint8_t *frontier;
    xed_decoded_inst_t xedd;
    uint64 ip;

    // Decode and print each instruction
    for (frontier = codeStartAddr, ip = (uint64)codeStartAddr;
            frontier < codeEndAddr;
        ) {
        xed_decoded_inst_zero_set_mode(&xedd, &xed_state);
        xed_decoded_inst_set_input_chip(&xedd, XED_CHIP_INVALID);
        xed_error_enum_t xed_error = xed_decode(&xedd, frontier, 15);
        if (xed_error != XED_ERROR_NONE) error("disasm error: xed_decode failed");

        // Get disassembled instruction in codeStr
        if (!xed_format_context(XED_SYNTAX_INTEL, &xedd, codeStr, MAX_INSTR_ASM_LEN,
                                ip, NULL)) {
            error("disasm error: xed_format_context failed");
        }

        if (printAddr) printf("0x%08llx: ", ip);
        printf("%s\n", codeStr);
        uint32 instrLen = xed_decoded_inst_get_length(&xedd);
        frontier += instrLen;
        ip       += instrLen;


    }
}
Example #2
0
Sprite::Sprite(SagaEngine *vm) : _vm(vm) {
    debug(8, "Initializing sprite subsystem...");

    // Load sprite module resource context
    _spriteContext = _vm->_resource->getContext(GAME_RESOURCEFILE);
    if (_spriteContext == NULL) {
        error("Sprite::Sprite resource context not found");
    }

    if (_vm->getGameId() == GID_ITE) {
        loadList(_vm->getResourceDescription()->mainSpritesResourceId, _mainSprites);
        _arrowSprites = _saveReminderSprites = _inventorySprites = _mainSprites;
#ifdef ENABLE_IHNM
    } else if (_vm->getGameId() == GID_IHNM) {
        if (_vm->isIHNMDemo()) {
            loadList(RID_IHNMDEMO_ARROW_SPRITES, _arrowSprites);
            loadList(RID_IHNMDEMO_SAVEREMINDER_SPRITES, _saveReminderSprites);
        } else {
            loadList(RID_IHNM_ARROW_SPRITES, _arrowSprites);
            loadList(RID_IHNM_SAVEREMINDER_SPRITES, _saveReminderSprites);
        }
#endif
    } else {
        error("Sprite: unknown game type");
    }
}
Example #3
0
void handleHandShake1() {
    if ((numbytes_rec = recvfrom(sockfd, rec_buffer,
                                 sizeof(rec_buffer),0,
                                 (sockaddr *) &sender_addr, &sender_len)) == -1) {
        error("error: on recvfrom()!");
    }
    rdp_segment rec_seg = generate_segment(rec_buffer);
    if (rec_seg.SYN != true) {
        debugprint("HS1 failed");
    }
    else {
        //debugprint("HandShake 1 received");
        log_event('r', "SYN", rec_seg,sender_addr,rec_addr);
        //print_rdp_message(rec_seg);

        // 3W-HandShake Part 2
        rdp_segment resp_seg = rec_seg;
        resp_seg.ackno = rec_seg.seqno+1;
        resp_seg.seqno = random_seq();
        isn = resp_seg.seqno;
        rdp_payload_set(resp_seg,"HSP2");
        strcpy(send_buffer, rdp_string_message(resp_seg).c_str());
        if ((numbytes_sent = sendto(sockfd,send_buffer, sizeof(send_buffer), 0,
                                    (sockaddr *) &sender_addr, sender_len)) == 1) {
            close(sockfd);
            error ("in sendto()");
        }
        log_event('s', "SYN+ACK", resp_seg, sender_addr, rec_addr);
        state = HandShake3;
        //debugprint("state change to HandShake3");
    }
}
Example #4
0
void Parser::skipMultilineComment()
{
    static const charset skipChars = commentChars - '*';
    while (true)
    {
        input->skip(skipChars);
        if (input->eol())
        {
            if (input->eof())
                error("Unexpected end of file in comments");
            skipEol();
            continue;
        }
        char e = input->get();
        if (e == '*')
        {
            if (input->preview() == '/')
            {
                input->get();
                break;
            }
        }
        else
            error("Illegal character in comments " + to_printable(e));
    }
}
Example #5
0
static int populate_opts_cb(const char *key, const char *value, void *data)
{
    struct replay_opts *opts = data;
    int error_flag = 1;

    if (!value)
        error_flag = 0;
    else if (!strcmp(key, "options.no-commit"))
        opts->no_commit = git_config_bool_or_int(key, value, &error_flag);
    else if (!strcmp(key, "options.edit"))
        opts->edit = git_config_bool_or_int(key, value, &error_flag);
    else if (!strcmp(key, "options.signoff"))
        opts->signoff = git_config_bool_or_int(key, value, &error_flag);
    else if (!strcmp(key, "options.record-origin"))
        opts->record_origin = git_config_bool_or_int(key, value, &error_flag);
    else if (!strcmp(key, "options.allow-ff"))
        opts->allow_ff = git_config_bool_or_int(key, value, &error_flag);
    else if (!strcmp(key, "options.mainline"))
        opts->mainline = git_config_int(key, value);
    else if (!strcmp(key, "options.strategy"))
        git_config_string(&opts->strategy, key, value);
    else if (!strcmp(key, "options.gpg-sign"))
        git_config_string(&opts->gpg_sign, key, value);
    else if (!strcmp(key, "options.strategy-option")) {
        ALLOC_GROW(opts->xopts, opts->xopts_nr + 1, opts->xopts_alloc);
        opts->xopts[opts->xopts_nr++] = xstrdup(value);
    } else
        return error(_("Invalid key: %s"), key);

    if (!error_flag)
        return error(_("Invalid value for %s: %s"), key, value);

    return 0;
}
Example #6
0
/*******************************************************************
 *         parse_spec_extern
 *
 * Parse an 'extern' definition in a .spec file.
 */
static int parse_spec_extern( ORDDEF *odp, DLLSPEC *spec )
{
    const char *token;

    if (spec->type == SPEC_WIN16)
    {
        error( "'extern' not supported for Win16, use 'variable' instead\n" );
        return 0;
    }
    if (!(token = GetToken(1)))
    {
        if (!strcmp( odp->name, "@" ))
        {
            error( "Missing handler name for anonymous extern\n" );
            return 0;
        }
        odp->link_name = xstrdup( odp->name );
    }
    else
    {
        odp->link_name = xstrdup( token );
        if (strchr( odp->link_name, '.' )) odp->flags |= FLAG_FORWARD;
    }
    return 1;
}