마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

ndk 에러가 나는데 이유가 뭘까요?

0 추천

현재 소스에서 warring이 나는건 const를 써서 그런것 같구요. 빌드를 하면  Error: bad instruction `int $0x03'

로그가 발생하는데 소스상에 문제인것 같습니다. 혹시 잘못된 부분이 있다면 조언 부탁드립니다.
 
#include "com_test_driver.h"
#include "testutil.h"
#include <npk.h>
#include <npk_dev.h>
 
JNIEXPORT jint JNICALL Java_com_test_driver_fileExport(JNIEnv *env, jclass jc, jstring str){
int teakey[4] = {0,0,0,0};
 
    NPK_PACKAGE pack = npk_package_open( str, teakey );
    CHECK( pack != NULL );
//jstring 으로 들어온 파일명을 char형으로 변환시켜준다.
char strbuf[128];
const char *sz =(*env)->GetStringUTFChars(env, str, 0);
strcpy(strbuf, sz);
(*env)->ReleaseStringUTFChars(env, str, sz);
    //std::string entityNames[4] = { "sample.txt", "zip.txt", "tea.txt", "zipntea.txt" };
//패키지의 첫번째 엔티티를 가져온다
NPK_ENTITY entitytemp = npk_package_get_first_entity(pack);
while(entitytemp != NULL){
char *entityName = npk_entity_get_name(entitytemp);
//npk_entity_export(엔티티, 파일출력 이름, 덮어쓰기여부)
CHECK( NPK_SUCCESS == npk_entity_export(entitytemp, entityName, true) );
 
NPK_SIZE size = npk_entity_get_size( entitytemp );
//현재 엔티티의 사이즈를 가져와서 메모리에서 동적 메모리로 그 만큼만 할당해준다.
void* buf = malloc( size );
//엔티티를 buf에 읽어온다.
CHECK( npk_entity_read( entitytemp, buf));
CHECK_EQUAL_STR_WITH_FILE( (const char*)buf, entityName );
 
free(buf);
entitytemp = npk_entity_next(entitytemp);
}
//완료되면 패키지를 닫아준다.
npk_package_close(pack);
return 0;
}

 

사막돌고래 (1,410 포인트) 님이 2013년 10월 30일 질문
사막돌고래님이 2013년 10월 30일 태그 변경

답변 달기

· 글에 소스 코드 보기 좋게 넣는 법
· 질문에 대해 추가적인 질문이나 의견이 있으면 답변이 아니라 댓글로 달아주시기 바랍니다.
표시할 이름 (옵션):
개인정보: 당신의 이메일은 이 알림을 보내는데만 사용됩니다.
스팸 차단 검사:
스팸 검사를 다시 받지 않으려면 로그인하거나 혹은 가입 하세요.
...