/* * Class: nitf_ImageSubheader * Method: getExtendedSection * Signature: ()Lnitf/Extensions; */ JNIEXPORT jobject JNICALL Java_nitf_ImageSubheader_getExtendedSection (JNIEnv * env, jobject self) { nitf_ImageSubheader *header = _GetObj(env, self); jclass extensionsClass = (*env)->FindClass(env, "nitf/Extensions"); jmethodID methodID = (*env)->GetMethodID(env, extensionsClass, "<init>", "(J)V"); nitf_Error error; jobject extensions; /* we need to construct it if it doesn't already exist */ if (!header->extendedSection) { header->extendedSection = nitf_Extensions_construct(&error); if (!header->extendedSection) goto CATCH_ERROR; } extensions = (*env)->NewObject(env, extensionsClass, methodID, (jlong) header->extendedSection); return extensions; CATCH_ERROR: _ThrowNITFException(env, error.message); return NULL; }
nitf_GraphicSubheader_construct(nitf_Error * error) { /* Start by allocating the header */ nitf_GraphicSubheader *subhdr = (nitf_GraphicSubheader *) NITF_MALLOC(sizeof(nitf_GraphicSubheader)); /* Return now if we have a problem above */ if (!subhdr) { nitf_Error_init(error, NITF_STRERROR(NITF_ERRNO), NITF_CTXT, NITF_ERR_MEMORY); goto CATCH_ERROR; } subhdr->extendedSection = NULL; subhdr->securityGroup = NULL; subhdr->securityGroup = nitf_FileSecurity_construct(error); if (!subhdr->securityGroup) goto CATCH_ERROR; _NITF_CONSTRUCT_FIELD(subhdr, NITF_SY, NITF_BCS_A); _NITF_CONSTRUCT_FIELD(subhdr, NITF_SID, NITF_BCS_A); _NITF_CONSTRUCT_FIELD(subhdr, NITF_SNAME, NITF_BCS_A); _NITF_CONSTRUCT_FIELD(subhdr, NITF_SSCLAS, NITF_BCS_A); _NITF_CONSTRUCT_FIELD(subhdr, NITF_ENCRYP, NITF_BCS_A); _NITF_CONSTRUCT_FIELD(subhdr, NITF_SFMT, NITF_BCS_A); _NITF_CONSTRUCT_FIELD(subhdr, NITF_SSTRUCT, NITF_BCS_N); _NITF_CONSTRUCT_FIELD(subhdr, NITF_SDLVL, NITF_BCS_N); _NITF_CONSTRUCT_FIELD(subhdr, NITF_SALVL, NITF_BCS_N); _NITF_CONSTRUCT_FIELD(subhdr, NITF_SLOC, NITF_BCS_N); _NITF_CONSTRUCT_FIELD(subhdr, NITF_SBND1, NITF_BCS_N); _NITF_CONSTRUCT_FIELD(subhdr, NITF_SCOLOR, NITF_BCS_A); _NITF_CONSTRUCT_FIELD(subhdr, NITF_SBND2, NITF_BCS_N); _NITF_CONSTRUCT_FIELD(subhdr, NITF_SRES2, NITF_BCS_N); _NITF_CONSTRUCT_FIELD(subhdr, NITF_SXSHDL, NITF_BCS_N); _NITF_CONSTRUCT_FIELD(subhdr, NITF_SXSOFL, NITF_BCS_N); subhdr->extendedSection = nitf_Extensions_construct(error); if (!subhdr->extendedSection) goto CATCH_ERROR; return subhdr; CATCH_ERROR: if (subhdr) nitf_GraphicSubheader_destruct(&subhdr); return NULL; }
nitf_TextSubheader_construct(nitf_Error * error) { /* Start by allocating the header */ nitf_TextSubheader *subhdr = (nitf_TextSubheader *) NITF_MALLOC(sizeof(nitf_TextSubheader)); /* Return now if we have a problem above */ if (!subhdr) { nitf_Error_init(error, NITF_STRERROR(NITF_ERRNO), NITF_CTXT, NITF_ERR_MEMORY); return NULL; } subhdr->extendedSection = NULL; subhdr->securityGroup = nitf_FileSecurity_construct(error); if (!subhdr->securityGroup) { nitf_TextSubheader_destruct(&subhdr); goto CATCH_ERROR; } _NITF_CONSTRUCT_FIELD(subhdr, NITF_TE, NITF_BCS_A); _NITF_CONSTRUCT_FIELD(subhdr, NITF_TEXTID, NITF_BCS_A); _NITF_CONSTRUCT_FIELD(subhdr, NITF_TXTALVL, NITF_BCS_N); _NITF_CONSTRUCT_FIELD(subhdr, NITF_TXTDT, NITF_BCS_A); _NITF_CONSTRUCT_FIELD(subhdr, NITF_TXTITL, NITF_BCS_A); _NITF_CONSTRUCT_FIELD(subhdr, NITF_TSCLAS, NITF_BCS_A); _NITF_CONSTRUCT_FIELD(subhdr, NITF_ENCRYP, NITF_BCS_A); _NITF_CONSTRUCT_FIELD(subhdr, NITF_TXTFMT, NITF_BCS_A); _NITF_CONSTRUCT_FIELD(subhdr, NITF_TXSHDL, NITF_BCS_N); _NITF_CONSTRUCT_FIELD(subhdr, NITF_TXSOFL, NITF_BCS_N); subhdr->extendedSection = nitf_Extensions_construct(error); if (!subhdr->extendedSection) goto CATCH_ERROR; return subhdr; CATCH_ERROR: nitf_TextSubheader_destruct(&subhdr); return NULL; }