Too Many Segments (hard version)

本文提供了解决 CodeForces-1249D2 问题的算法思路,该问题涉及线段树和贪心算法,目标是最小化移除线段数量,以确保每个点的覆盖次数不超过指定值k。

题目链接:CodeForces - 1249D2

The only difference between easy and hard versions is constraints.

You are given nn segments on the coordinate axis OXOX. Segments can intersect, lie inside each other and even coincide. The ii-th segment is [li;ri][li;ri] (li≤rili≤ri) and it covers all integer points jj such that li≤j≤rili≤j≤ri.

The integer point is called bad if it is covered by strictly more than kk segments.

Your task is to remove the minimum number of segments so that there are no badpoints at all.

Input

The first line of the input contains two integers nn and kk (1≤k≤n≤2⋅1051≤k≤n≤2⋅105) — the number of segments and the maximum number of segments by which each integer point can be covered.

The next nn lines contain segments. The ii-th line contains two integers lili and riri (1≤li≤ri≤2⋅1051≤li≤ri≤2⋅105) — the endpoints of the ii-th segment.

Output

In the first line print one integer mm (0≤m≤n0≤m≤n) — the minimum number of segments you need to remove so that there are no bad points.

In the second line print mm distinct integers p1,p2,…,pmp1,p2,…,pm (1≤pi≤n1≤pi≤n) — indices of segments you remove in any order. If there are multiple answers, you can print any of them.

Examples

Input

7 2
11 11
9 11
7 8
8 9
7 8
9 11
7 9

Output

3
4 6 7 

Input

5 1
29 30
30 30
29 29
28 30
30 30

Output

3
1 4 5 

Input

6 1
2 3
3 3
2 3
2 2
2 3
2 3

Output

4
1 3 5 6 

 题目大意:有n条线段,对于每个点其覆盖次数不能超过k,问至少移除几条线段才能满足要求。

思路: 在一个点,其覆盖值如果大于k了,应该移除覆盖这个点的线段中最右边的值最大的那个,因为这样可以最多减少对后面点的覆盖,从而使移除的线段数最少。

对输入的线段按右端点从小到大排序,因为这样遍历的时候先遍历右端点小的值,然后遍历到右端点大的值超过k值时,就可以将其移除。。。

但因为数据太大,需要用到容器,vector,set 容器。

 

#include<stdio.h>
#include<string.h>
#include<vector>
#include<set>
#include<algorithm>
using namespace std;
const int N=200010;
struct node
{
    int id;
    int r;
};
bool operator<(node u,node v)
{
    if(u.r!=v.r)
        return u.r<v.r;
    else
        return u.id<v.id;
}
vector<node>v[N];
vector<int>ans;
int main()
{
    int n,k;
    scanf("%d%d",&n,&k);

    for(int i=1; i<=n; i++)
    {
        node q;
        int x,y;
        scanf("%d%d",&x,&y);
        q.id=i;
        q.r=y;
        v[x].push_back(q);
    }
    set<node>s;
    for(int i=1; i<N; i++)
    {
        while(s.size()&&(*s.begin()).r<i)//容器不为空,如果线段的最右边的值<i,这条线段对后面的点没用
            s.erase(*s.begin());

        for(int j=0; j<v[i].size(); j++)//以i为左端点的所有线段
            s.insert(v[i][j]);

        while(s.size()>k)//大于k移除线段右值最大的线段
        {
            ans.push_back((*s.rbegin()).id);
            s.erase(*s.rbegin());
        }
    }
    printf("%d\n",ans.size());
    for(int i=0; i<ans.size(); i++)
        printf("%d ",ans[i]);
    return 0;
}

 

这是slp_model.h中部分代码: #define ALARM_PLAN_STR_MAX_LEN 16 typedef struct _MSG_ALARM_CHN1_PLAN { SWITCH enabled; char alarm_plan_1[5][ALARM_PLAN_STR_MAX_LEN + 1]; /* 0000-0000,000格式 */ S32 alarm_plan_num; }MSG_ALARM_CHN1_PLAN, *PTR_MSG_ALARM_PLAN; 这是msg_alarm.c中部分代码: LOCAL void msg_alarm_plan_data_model() { /*************************************************************************************/ /********* Desc of /msg_alarm_plan/chn1_msg_alarm_plan *******************************/ /*************************************************************************************/ DS_ARR_DESC(alarm_plan, OPT_TYPE_STRING, MSG_ALARM_CHN1_PLAN, alarm_plan_1); DS_OPT_DESC chn1_msg_alarm_plan_options[] = { DS_SWITCH_OPT(MSG_ALARM_CHN1_PLAN, enabled, OPT_FLAG_NORM), DS_ARR_OPT(MSG_ALARM_CHN1_PLAN, alarm_plan_1, OPT_FLAG_NORM, &alarm_plan), DS_S32_OPT(MSG_ALARM_CHN1_PLAN, alarm_plan_num, OPT_FLAG_NORM), }; DS_SEG_DESC chn1_msg_alarm_plan_segments[] = { DS_STRUCT_SEG("chn1_msg_alarm_plan", SEG_LIM_RW, SEG_GROUP_ROOT, MSG_ALARM_CHN1_PLAN, chn1_msg_alarm_plan_options), }; DS_SECT_DESC chn1_msg_alarm_plan_sections[] = { DS_STRUCT_SECT("chn1_msg_alarm_plan", chn1_msg_alarm_plan_segments), }; /*************************************************************************************/ /********* Desc of /msg_alarm_plan/arming_schedule_sound***************************************/ /*************************************************************************************/ DS_OPT_DESC arming_schedule_info_options[] = { DS_STR_OPT(ARMING_SCHEDULE, monday, OPT_FLAG_NORM), DS_STR_OPT(ARMING_SCHEDULE, tuesday, OPT_FLAG_NORM), DS_STR_OPT(ARMING_SCHEDULE, wednesday, OPT_FLAG_NORM), DS_STR_OPT(ARMING_SCHEDULE, thursday, OPT_FLAG_NORM), DS_STR_OPT(ARMING_SCHEDULE, friday, OPT_FLAG_NORM), DS_STR_OPT(ARMING_SCHEDULE, saturday, OPT_FLAG_NORM), DS_STR_OPT(ARMING_SCHEDULE, sunday, OPT_FLAG_NORM), }; DS_SEG_DESC sound_arming_schedule_info_segments[] = { DS_STRUCT_SEG("arming_schedule_sound", SEG_LIM_RW, SEG_GROUP_ROOT, ARMING_SCHEDULE, arming_schedule_info_options), }; DS_SECT_DESC sound_arming_schedule_sections[] = { DS_STRUCT_SECT("arming_schedule_sound", sound_arming_schedule_info_segments), }; /*************************************************************************************/ /********* Desc of /msg_alarm_plan/arming_schedule_light***************************************/ /*************************************************************************************/ DS_SEG_DESC light_arming_schedule_info_segments[] = { DS_STRUCT_SEG("arming_schedule_light", SEG_LIM_RW, SEG_GROUP_ROOT, ARMING_SCHEDULE, arming_schedule_info_options), }; DS_SECT_DESC light_arming_schedule_sections[] = { DS_STRUCT_SECT("arming_schedule_light", light_arming_schedule_info_segments), }; DS_TBL_DESC msg_alarm_plan_tables[] = { DS_STRUCT_TBL("plan", TBL_ATTR_CFG, chn1_msg_alarm_plan_sections), DS_STRUCT_TBL("plan", TBL_ATTR_CFG, sound_arming_schedule_sections), DS_STRUCT_TBL("plan", TBL_ATTR_CFG, light_arming_schedule_sections), }; DS_DAT_MON_DESC msg_alarm_plan_data_monitor[] = { DS_DAT_MON(MSG_ALARM_CHN1_PLAN_PATH, DATA_ATTRI_CHECK), DS_DAT_MON(MSG_ALARM_PLAN_ARMING_SCHEDULE_SOUND_PATH, DATA_ATTRI_CHECK), DS_DAT_MON(MSG_ALARM_PLAN_ARMING_SCHEDULE_LIGHT_PATH, DATA_ATTRI_CHECK), }; DS_MOD_DESC msg_alarm_plan_module = DS_STRUCT_MOD("msg_alarm_plan", msg_alarm_plan_init, msg_alarm_plan_check, NULL, msg_alarm_plan_start, NULL, msg_alarm_plan_tables, msg_alarm_plan_data_monitor); MODULE *module_node = ds_register_module("msg_alarm_plan", &msg_alarm_plan_module); CAP_ASSERT(NULL != module_node); } CAP_INIT(msg_alarm_plan_data_model); 这是alarm_plan_ds.c中的代码: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include <unistd.h> #include "slp_model.h" #include "libds.h" #include "msg_alarm.h" #include "detection_utils.h" #define MSG_ALARM_PLAN_MODULE_NAME "msg_alarm_plan" #define MSG_ALARM_PLAN_TABLE_NAME "plan" #define MSG_ALARM_PLAN_SECTION_NAME "chn1_msg_alarm_plan" /* 存放从ds中读取的数据 */ LOCAL MSG_ALARM_CHN1_PLAN g_msg_alarm_plan = {FALSE, NULL, 0}; /* ds get回调函数 */ /* 从ds共享内存中读取,然后填入json字符串 */ S32 ds_cb_get_alarm_plan(struct _DS_HANDLE_CONTEXT *context, JSON_OBJPTR reply_obj) { S32 i = 0; if (NULL == context || NULL == reply_obj) { MSG_ALARM_ERROR("ds_cb_get_alarm_plan: ptr is null"); return ERROR; } /* 从内存中读取并存入g_msg_alarm_plan结构体中 */ if (0 == ds_read(MSG_ALARM_CHN1_PLAN_PATH, &g_msg_alarm_plan, sizeof(MSG_ALARM_CHN1_PLAN))) { MSG_ALARM_ERROR("read from ds shm fail."); return ERROR; } /* 将enabled配置写入json */ jso_add_string(reply_obj, "enabled", g_msg_alarm_plan.enabled ? "on" : "off"); /* 将alarm_plan_num配置写入json */ jso_add_int(reply_obj, "alarm_plan_num", g_msg_alarm_plan.alarm_plan_num); JSON_OBJPTR alarm_plan_array = jso_new_array(); if(NULL == alarm_plan_array) { MSG_ALARM_ERROR("create new array object fail."); return ERROR; } /* 将alarm_plan_1数组配置写入json */ for (i = 0; i < g_msg_alarm_plan.alarm_plan_num; i++) { jso_array_add(alarm_plan_array, jso_new_string(g_msg_alarm_plan.alarm_plan_1[i])); } jso_obj_add(reply_obj, "alarm_plan_1", alarm_plan_array); /* 调试:打印json字符串 */ MSG_ALARM_DEBUG(" JSON %s",json_object_to_json_string(reply_obj)); return OK; } /* ds set回调函数 */ /* 解析json字符串,然后填入ds共享内存 */ S32 ds_cb_set_alarm_plan(struct _DS_HANDLE_CONTEXT *context, U8 method, const char* section_name, JSON_OBJPTR req_obj, BOOL is_table) { S32 i = 0; S32 ret = OK; const char *json_value_str = NULL; if (NULL == context || NULL == section_name || NULL == req_obj) { MSG_ALARM_ERROR("ptr is null"); return ERROR; } /* 从json中获取enable配置值 */ json_value_str = jso_obj_get_string_origin(req_obj, "enabled"); if (NULL == json_value_str) { MSG_ALARM_ERROR("jso_obj_get_string_origin key-enable return NULL"); return ERROR; } g_msg_alarm_plan.enabled = 0; if (0 == strcmp(json_value_str, "on")) { g_msg_alarm_plan.enabled = 1; } /* 从json中获取alarm_plan_num配置值 */ if (!jso_obj_get_int(req_obj, "alarm_plan_num", &g_msg_alarm_plan.alarm_plan_num)) { MSG_ALARM_ERROR("jso_obj_get_int key-alarm_plan_num return -1"); return ERROR; } /* 如果传入太多,只取前最大plan个数 */ if (g_msg_alarm_plan.alarm_plan_num > ALARM_PLAN_SIZE) { MSG_ALARM_ERROR("set too many plans!"); g_msg_alarm_plan.alarm_plan_num = ALARM_PLAN_SIZE; } JSON_OBJPTR alarm_plan_array = jso_obj_get(req_obj, "alarm_plan_1"); JSON_OBJPTR alarm_plan_term = jso_new_string(""); if (!jso_is_array(alarm_plan_array)) { MSG_ALARM_ERROR("key-alarm_plan_1 get non-array"); return ERROR; } /* 从json中获取alarm_plan_ch1配置值 */ for (i = 0; i < g_msg_alarm_plan.alarm_plan_num; i++) { alarm_plan_term = jso_array_get_idx(req_obj, i); if (!jso_is_string(alarm_plan_term)) { MSG_ALARM_ERROR("key-alarm_plan_1[] get non-string"); return ERROR; } jso_to_string(alarm_plan_term, g_msg_alarm_plan.alarm_plan_1[i], ALARM_PLAN_STR_MAX_LEN); } if (0 == ds_write(MSG_ALARM_CHN1_PLAN_PATH, &g_msg_alarm_plan, sizeof(MSG_ALARM_CHN1_PLAN))) { MSG_ALARM_ERROR("ds_write %s error", MSG_ALARM_CHN1_PLAN_PATH); return ERROR; } ret = ds_save_usr_cfg(); MSG_ALARM_DEBUG("ds_save_usr_cfg() ret[%d]", ret); /* 由于ds暂不支持listConfig的reload,所以这里手动调用 */ if (OK == ret) { alarm_plan_reload(); } return OK; } /* ds del回调函数 */ /* 解析json字符串,然后删除ds共享内存结构体中对应的plan */ S32 ds_cb_del_alarm_plan(struct _DS_HANDLE_CONTEXT *context, U8 method, const char* section_name, JSON_OBJPTR req_obj, BOOL is_table) { S32 i = 0; S32 ret = OK; const char *json_value_str = NULL; if (NULL == context || NULL == section_name || NULL == req_obj) { MSG_ALARM_ERROR("ptr is null"); return ERROR; } /* 从内存中读取并存入g_msg_alarm_plan结构体中 */ if (0 == ds_read(MSG_ALARM_CHN1_PLAN_PATH, &g_msg_alarm_plan, sizeof(MSG_ALARM_CHN1_PLAN))) { MSG_ALARM_ERROR("read from ds shm fail."); return ERROR; } JSON_OBJPTR alarm_plan_array = jso_obj_get(req_obj, "alarm_plan_1"); JSON_OBJPTR alarm_plan_term = jso_new_string(""); if (!jso_is_array(alarm_plan_array)) { MSG_ALARM_ERROR("key-alarm_plan_1 get non-array"); return ERROR; } /* 删的数量过多,清空plan数组 */ if (0 > (g_msg_alarm_plan.alarm_plan_num - jso_array_length(alarm_plan_array))) { for (i = 0; i < g_msg_alarm_plan.alarm_plan_num; i++ ) { memset(g_msg_alarm_plan.alarm_plan_1[i], 0, ALARM_PLAN_STR_MAX_LEN); } MSG_ALARM_ERROR("delete too many plans."); return ERROR; } /* 从json中获取enable配置值 */ json_value_str = jso_obj_get_string_origin(req_obj, "enabled"); if (NULL == json_value_str) { MSG_ALARM_ERROR("jso_obj_get_string_origin key-enable return NULL"); return ERROR; } if (!strcmp(json_value_str, "on")) { g_msg_alarm_plan.enabled = 1; } else if (!strcmp(json_value_str, "off")) { g_msg_alarm_plan.enabled = 0; } else { MSG_ALARM_ERROR("set wrong key-enable param"); return ERROR; } /* 从json中获取要删除的plan项并删除,并更新alarm_plan_num的值 */ for (i = 0; i < jso_array_length(alarm_plan_array); i++) { alarm_plan_term = jso_array_get_idx(req_obj, i); if (!jso_is_string(alarm_plan_term)) { MSG_ALARM_ERROR("key-alarm_plan_1[] get non-string"); return ERROR; } jso_to_string(alarm_plan_term, json_value_str, ALARM_PLAN_STR_MAX_LEN); for (int j = 0; j < g_msg_alarm_plan.alarm_plan_num; j++) { if (!strncmp(json_value_str, g_msg_alarm_plan.alarm_plan_1[j], strlen(json_value_str))) { strncpy(g_msg_alarm_plan.alarm_plan_1[j], g_msg_alarm_plan.alarm_plan_1[g_msg_alarm_plan.alarm_plan_num - 1], strlen(g_msg_alarm_plan.alarm_plan_1[g_msg_alarm_plan.alarm_plan_num - 1])); memset(g_msg_alarm_plan.alarm_plan_1[g_msg_alarm_plan.alarm_plan_num - 1], 0, ALARM_PLAN_STR_MAX_LEN); g_msg_alarm_plan.alarm_plan_num--; break; } } } if (0 == ds_write(MSG_ALARM_CHN1_PLAN_PATH, &g_msg_alarm_plan, sizeof(MSG_ALARM_CHN1_PLAN))) { MSG_ALARM_ERROR("ds_write %s error", MSG_ALARM_CHN1_PLAN_PATH); return ERROR; } ret = ds_save_usr_cfg(); MSG_ALARM_DEBUG("ds_save_usr_cfg() ret[%d]", ret); /* 由于ds暂不支持listConfig的reload,所以这里手动调用 */ if (OK == ret) { msg_alarm_plan_reload(); } return OK; } /* 注册ds get/set 回调函数 */ S32 registe_ds_cb() { S32 ret = OK; if (ERROR == ds_register_get_json(MSG_ALARM_PLAN_MODULE_NAME, MSG_ALARM_PLAN_TABLE_NAME, MSG_ALARM_PLAN_SECTION_NAME, ds_cb_get_alarm_plan)) { MSG_ALARM_ERROR("ds_register_get_json return error"); ret = ERROR; } if (ERROR == ds_register_set_json(MSG_ALARM_PLAN_MODULE_NAME, MSG_ALARM_PLAN_TABLE_NAME, MSG_ALARM_PLAN_SECTION_NAME, ds_cb_set_alarm_plan)) { MSG_ALARM_ERROR("ds_register_set_json return error"); ret = ERROR; } if (ERROR == ds_register_del_json(MSG_ALARM_PLAN_MODULE_NAME, MSG_ALARM_PLAN_TABLE_NAME, ds_cb_del_alarm_plan)) { MSG_ALARM_ERROR("ds_register_del_json return error"); ret = ERROR; } return ret; } /* 获取报警排程 */ PTR_MSG_ALARM_PLAN get_alarm_plan_cfg() { return &g_msg_alarm_plan; } /* 初始化 */ S32 alarm_plan_init() { S32 ret = OK; /* 注册ds set/get/del回调函数 */ ret = registe_ds_cb(); if (ERROR == ret) { MSG_ALARM_ERROR("registe_ds_cb error"); return ret; } /* 初始化ds侦测报警排程结构体 */ g_msg_alarm_plan.enabled = FALSE; g_msg_alarm_plan.alarm_plan_num = 0; for(int i = 0; i < ALARM_PLAN_SIZE; i++) { memset(g_msg_alarm_plan.alarm_plan_1[i], 0, ALARM_PLAN_STR_MAX_LEN); } return ret; } 发生以下错误:make "make -C modules/msg_alarm MODULE_NAME=msg_alarm" make[5]: Entering directory '/home/xyc/NVMP/nvmp/build_dir/target-arm-AX620E-linux-uclibcgnueabihf-c668bv1/cap/modules/msg_alarm' arm-AX620E-linux-uclibcgnueabihf-gcc -Os -pipe -D__LINUX_ARM_ARCH__=7 -march=armv7-a -mfloat-abi=hard -Wformat=0 -g -Wno-stringop-truncation -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast -Wno-sizeof-pointer-div -Wno-restrict -Wno-stringop-overflow -Wno-format-truncation -Wno-format-overflow -Wno-error -g -DMCU_DIGITAL_LIGHT_SENSOR -DMCU_DIGITAL_PIR_SENSOR -DCLOUD_IOT_SUPPORT -DTAPO_USR_DEF_AUDIO_ALARM -DAUDIO_SAMPLE_RATE=16000 -DTAPO_AUDIO_ALARM_SETTINGS -DOPTIONAL_ALARM_AUDIO -DTELEMETRY_SUPPORT -DIR_LED_USE_MCU_ADC -DTP_TAPO_BATTERY_CAM -DTAPO_CARE_SUPPORT -DCONFIG_TARGET_AX620Q -DCONFIG_OPT300X_I2C_ALIAS=\"/dev/i2c-0\" -DSET_FRAME_SUPPORT -DBATTERY_OPERATING_MODE_SUPPORT -DBATTERY_STATISTIC_SUPPORT -DFREQ_WAKE_ABNORMAL_POWER_SUPPORT -DHUB_MANAGE_SUPPORT -DAUDIO_G711_16K_SUPPORT -DNET_STATUS_CHANGE_BITRATE -DNET_STATUS_CHANGE_BITRATE_REALTIME -DBAT_CAPACITY_CURVE_OPTIMIZATION -DPIR_SENSITIVITY_DEF_TABLE=100,91,80,69,48,36,30,28,24,20 -DMCU_CONTROL_MOTOR -DIRCUT_SWITCH_BY_MCU_MSG -DMCU_UART_ALIAS=\"/dev/ttyS3\" -DMCU_UPGRADE_CLEAN_UART -DMAX_BAT_MODEL=2 -DLOWER_IR_BEFORE_POWER_OFF -DJPEG_STREAM_ENABLE -DPTZ_SUPPORT -DGET_SNAPSHOT_ACCURATE -DSNAPSHOT_JPEG_HEIGHT=360 -DWLAN_SUPPORT -DLINUX_VERSION=4.19.125 -DTP_TAPO_RESET_WIFI_SUPPORT -I/home/xyc/NVMP/nvmp/staging_dir/target-arm-AX620E-linux-uclibcgnueabihf-c668bv1/usr/include -I/home/xyc/NVMP/nvmp/staging_dir/target-arm-AX620E-linux-uclibcgnueabihf-c668bv1/include -I/home/xyc/NVMP/nvmp/../sdk/soc/AX620Q/uclibc-toolchain/arm-AX620E-linux-uclibcgnueabihf/arm-AX620E-linux-uclibcgnueabihf/libc/usr/include -Wall -Werror -ffunction-sections -fdata-sections -DMODULE_LIST="\"general_plan mcu_proxy osd image dn_switch cover video battery_manage msg_alarm hsr md_alarm ptd_alarm vd_alarm speaker sd_card record_plan alarm_clock audio_library detection_region ptz light_control\"" -DTSS_MODULE_LIST="\"\"" -I/home/xyc/NVMP/nvmp/build_dir/target-arm-AX620E-linux-uclibcgnueabihf-c668bv1/cap -c -o alarm_plan_ds.o alarm_plan_ds.c alarm_plan_ds.c:17:54: error: initialization of 'char' from 'void *' makes integer from pointer without a cast [-Werror=int-conversion] LOCAL MSG_ALARM_CHN1_PLAN g_msg_alarm_plan = {FALSE, NULL, 0}; ^~~~ alarm_plan_ds.c:17:54: note: (near initialization for 'g_msg_alarm_plan.alarm_plan_1[0]') alarm_plan_ds.c:17:46: error: missing braces around initializer [-Werror=missing-braces] LOCAL MSG_ALARM_CHN1_PLAN g_msg_alarm_plan = {FALSE, NULL, 0}; ^ In file included from alarm_plan_ds.c:9: alarm_plan_ds.c: In function 'ds_cb_get_alarm_plan': msg_alarm.h:59:36: error: implicit declaration of function 'CAP_ERROR'; did you mean 'MC_ERROR'? [-Werror=implicit-function-declaration] #define MSG_ALARM_ERROR(fmt, ...) CAP_ERROR("[MSG_ALARM]" fmt , ##__VA_ARGS__) ^~~~~~~~~ alarm_plan_ds.c:27:3: note: in expansion of macro 'MSG_ALARM_ERROR' MSG_ALARM_ERROR("ds_cb_get_alarm_plan: ptr is null"); ^~~~~~~~~~~~~~~ alarm_plan_ds.c:54:85: error: passing argument 1 of 'jso_new_string' makes pointer from integer without a cast [-Werror=int-conversion] jso_array_add(alarm_plan_array, jso_new_string(g_msg_alarm_plan.alarm_plan_1[i])); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ In file included from /home/xyc/NVMP/nvmp/staging_dir/target-arm-AX620E-linux-uclibcgnueabihf-c668bv1/usr/include/json/json.h:26, from /home/xyc/NVMP/nvmp/staging_dir/target-arm-AX620E-linux-uclibcgnueabihf-c668bv1/usr/include/libds.h:7, from /home/xyc/NVMP/nvmp/staging_dir/target-arm-AX620E-linux-uclibcgnueabihf-c668bv1/usr/include/slp_model.h:7, from alarm_plan_ds.c:7: /home/xyc/NVMP/nvmp/staging_dir/target-arm-AX620E-linux-uclibcgnueabihf-c668bv1/usr/include/json/json_api.h:35:41: note: expected 'char *' but argument is of type 'char' extern JSON_OBJPTR jso_new_string(char *str); ~~~~~~^~~ In file included from alarm_plan_ds.c:9: msg_alarm.h:57:36: error: implicit declaration of function 'CAP_DEBUG'; did you mean 'MC_DEBUG'? [-Werror=implicit-function-declaration] #define MSG_ALARM_DEBUG(fmt, ...) CAP_DEBUG("[MSG_ALARM]" fmt, ##__VA_ARGS__) ^~~~~~~~~ alarm_plan_ds.c:59:2: note: in expansion of macro 'MSG_ALARM_DEBUG' MSG_ALARM_DEBUG(" JSON %s",json_object_to_json_string(reply_obj)); ^~~~~~~~~~~~~~~ alarm_plan_ds.c: In function 'ds_cb_set_alarm_plan': alarm_plan_ds.c:100:43: error: 'ALARM_PLAN_SIZE' undeclared (first use in this function); did you mean 'ALARM_STATE_IDLE'? if (g_msg_alarm_plan.alarm_plan_num > ALARM_PLAN_SIZE) ^~~~~~~~~~~~~~~ ALARM_STATE_IDLE alarm_plan_ds.c:100:43: note: each undeclared identifier is reported only once for each function it appears in alarm_plan_ds.c:124:69: error: passing argument 2 of 'jso_to_string' makes pointer from integer without a cast [-Werror=int-conversion] jso_to_string(alarm_plan_term, g_msg_alarm_plan.alarm_plan_1[i], ALARM_PLAN_STR_MAX_LEN); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ In file included from /home/xyc/NVMP/nvmp/staging_dir/target-arm-AX620E-linux-uclibcgnueabihf-c668bv1/usr/include/json/json.h:26, from /home/xyc/NVMP/nvmp/staging_dir/target-arm-AX620E-linux-uclibcgnueabihf-c668bv1/usr/include/libds.h:7, from /home/xyc/NVMP/nvmp/staging_dir/target-arm-AX620E-linux-uclibcgnueabihf-c668bv1/usr/include/slp_model.h:7, from alarm_plan_ds.c:7: /home/xyc/NVMP/nvmp/staging_dir/target-arm-AX620E-linux-uclibcgnueabihf-c668bv1/usr/include/json/json_api.h:40:49: note: expected 'char *' but argument is of type 'char' extern int jso_to_string(JSON_OBJPTR obj, char *str_buf, int len); ~~~~~~^~~~~~~ alarm_plan_ds.c:139:3: error: implicit declaration of function 'alarm_plan_reload' [-Werror=implicit-function-declaration] alarm_plan_reload(); ^~~~~~~~~~~~~~~~~ alarm_plan_ds.c: In function 'ds_cb_del_alarm_plan': alarm_plan_ds.c:180:49: error: passing argument 1 of 'memset' makes pointer from integer without a cast [-Werror=int-conversion] memset(g_msg_alarm_plan.alarm_plan_1[i], 0, ALARM_PLAN_STR_MAX_LEN); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ In file included from alarm_plan_ds.c:3: /home/xyc/NVMP/sdk/soc/AX620Q/uclibc-toolchain/arm-AX620E-linux-uclibcgnueabihf/arm-AX620E-linux-uclibcgnueabihf/sysroot/usr/include/string.h:58:14: note: expected 'void *' but argument is of type 'char' extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1)); ^~~~~~ alarm_plan_ds.c:218:40: error: passing argument 2 of 'jso_to_string' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers] jso_to_string(alarm_plan_term, json_value_str, ALARM_PLAN_STR_MAX_LEN); ^~~~~~~~~~~~~~ In file included from /home/xyc/NVMP/nvmp/staging_dir/target-arm-AX620E-linux-uclibcgnueabihf-c668bv1/usr/include/json/json.h:26, from /home/xyc/NVMP/nvmp/staging_dir/target-arm-AX620E-linux-uclibcgnueabihf-c668bv1/usr/include/libds.h:7, from /home/xyc/NVMP/nvmp/staging_dir/target-arm-AX620E-linux-uclibcgnueabihf-c668bv1/usr/include/slp_model.h:7, from alarm_plan_ds.c:7: /home/xyc/NVMP/nvmp/staging_dir/target-arm-AX620E-linux-uclibcgnueabihf-c668bv1/usr/include/json/json_api.h:40:49: note: expected 'char *' but argument is of type 'const char *' extern int jso_to_string(JSON_OBJPTR obj, char *str_buf, int len); ~~~~~~^~~~~~~ alarm_plan_ds.c:221:71: error: passing argument 2 of 'strncmp' makes pointer from integer without a cast [-Werror=int-conversion] if (!strncmp(json_value_str, g_msg_alarm_plan.alarm_plan_1[j], strlen(json_value_str))) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ In file included from alarm_plan_ds.c:3: /home/xyc/NVMP/sdk/soc/AX620Q/uclibc-toolchain/arm-AX620E-linux-uclibcgnueabihf/arm-AX620E-linux-uclibcgnueabihf/sysroot/usr/include/string.h:101:51: note: expected 'const char *' but argument is of type 'char' extern int strncmp (const char *__s1, const char *__s2, size_t __n) ~~~~~~~~~~~~^~~~ alarm_plan_ds.c:224:61: error: passing argument 1 of 'strlen' makes pointer from integer without a cast [-Werror=int-conversion] strlen(g_msg_alarm_plan.alarm_plan_1[g_msg_alarm_plan.alarm_plan_num - 1])); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from alarm_plan_ds.c:3: /home/xyc/NVMP/sdk/soc/AX620Q/uclibc-toolchain/arm-AX620E-linux-uclibcgnueabihf/arm-AX620E-linux-uclibcgnueabihf/sysroot/usr/include/string.h:247:35: note: expected 'const char *' but argument is of type 'char' extern size_t strlen (const char *__s) ~~~~~~~~~~~~^~~ alarm_plan_ds.c:223:54: error: passing argument 1 of 'strncpy' makes pointer from integer without a cast [-Werror=int-conversion] strncpy(g_msg_alarm_plan.alarm_plan_1[j], g_msg_alarm_plan.alarm_plan_1[g_msg_alarm_plan.alarm_plan_num - 1], ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ In file included from alarm_plan_ds.c:3: /home/xyc/NVMP/sdk/soc/AX620Q/uclibc-toolchain/arm-AX620E-linux-uclibcgnueabihf/arm-AX620E-linux-uclibcgnueabihf/sysroot/usr/include/string.h:86:14: note: expected 'char * restrict' but argument is of type 'char' extern char *strncpy (char *__restrict __dest, ^~~~~~~ alarm_plan_ds.c:223:88: error: passing argument 2 of 'strncpy' makes pointer from integer without a cast [-Werror=int-conversion] strncpy(g_msg_alarm_plan.alarm_plan_1[j], g_msg_alarm_plan.alarm_plan_1[g_msg_alarm_plan.alarm_plan_num - 1], ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from alarm_plan_ds.c:3: /home/xyc/NVMP/sdk/soc/AX620Q/uclibc-toolchain/arm-AX620E-linux-uclibcgnueabihf/arm-AX620E-linux-uclibcgnueabihf/sysroot/usr/include/string.h:86:14: note: expected 'const char * restrict' but argument is of type 'char' extern char *strncpy (char *__restrict __dest, ^~~~~~~ alarm_plan_ds.c:225:53: error: passing argument 1 of 'memset' makes pointer from integer without a cast [-Werror=int-conversion] memset(g_msg_alarm_plan.alarm_plan_1[g_msg_alarm_plan.alarm_plan_num - 1], 0, ALARM_PLAN_STR_MAX_LEN); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from alarm_plan_ds.c:3: /home/xyc/NVMP/sdk/soc/AX620Q/uclibc-toolchain/arm-AX620E-linux-uclibcgnueabihf/arm-AX620E-linux-uclibcgnueabihf/sysroot/usr/include/string.h:58:14: note: expected 'void *' but argument is of type 'char' extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1)); ^~~~~~ alarm_plan_ds.c:244:3: error: implicit declaration of function 'msg_alarm_plan_reload'; did you mean 'msg_alarm_type_filter'? [-Werror=implicit-function-declaration] msg_alarm_plan_reload(); ^~~~~~~~~~~~~~~~~~~~~ msg_alarm_type_filter alarm_plan_ds.c: In function 'registe_ds_cb': alarm_plan_ds.c:268:94: error: passing argument 3 of 'ds_register_del_json' from incompatible pointer type [-Werror=incompatible-pointer-types] if (ERROR == ds_register_del_json(MSG_ALARM_PLAN_MODULE_NAME, MSG_ALARM_PLAN_TABLE_NAME, ds_cb_del_alarm_plan)) ^~~~~~~~~~~~~~~~~~~~ In file included from /home/xyc/NVMP/nvmp/staging_dir/target-arm-AX620E-linux-uclibcgnueabihf-c668bv1/usr/include/libds.h:12, from /home/xyc/NVMP/nvmp/staging_dir/target-arm-AX620E-linux-uclibcgnueabihf-c668bv1/usr/include/slp_model.h:7, from alarm_plan_ds.c:7: /home/xyc/NVMP/nvmp/staging_dir/target-arm-AX620E-linux-uclibcgnueabihf-c668bv1/usr/include/ds_model.h:252:87: note: expected 'DEL_JSON' {aka 'int (*)(struct _DS_HANDLE_CONTEXT *, struct json_object *, enum _BOOL)'} but argument is of type 'S32 (*)(struct _DS_HANDLE_CONTEXT *, U8, const char *, struct json_object *, BOOL)' {aka 'int (*)(struct _DS_HANDLE_CONTEXT *, unsigned char, const char *, struct json_object *, enum _BOOL)'} STATUS ds_register_del_json(const char *module_name, const char *table_name, DEL_JSON del_json); ~~~~~~~~~^~~~~~~~ alarm_plan_ds.c: In function 'alarm_plan_init': alarm_plan_ds.c:299:24: error: 'ALARM_PLAN_SIZE' undeclared (first use in this function); did you mean 'ALARM_STATE_IDLE'? for(int i = 0; i < ALARM_PLAN_SIZE; i++) ^~~~~~~~~~~~~~~ ALARM_STATE_IDLE alarm_plan_ds.c:301:45: error: passing argument 1 of 'memset' makes pointer from integer without a cast [-Werror=int-conversion] memset(g_msg_alarm_plan.alarm_plan_1[i], 0, ALARM_PLAN_STR_MAX_LEN); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ In file included from alarm_plan_ds.c:3: /home/xyc/NVMP/sdk/soc/AX620Q/uclibc-toolchain/arm-AX620E-linux-uclibcgnueabihf/arm-AX620E-linux-uclibcgnueabihf/sysroot/usr/include/string.h:58:14: note: expected 'void *' but argument is of type 'char' extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1)); ^~~~~~ cc1: all warnings being treated as errors <builtin>: recipe for target 'alarm_plan_ds.o' failed make[5]: *** [alarm_plan_ds.o] Error 1 make[5]: Leaving directory '/home/xyc/NVMP/nvmp/build_dir/target-arm-AX620E-linux-uclibcgnueabihf-c668bv1/cap/modules/msg_alarm' Makefile:32: recipe for target 'build_modules' failed make[4]: *** [build_modules] Error 2 make[4]: Leaving directory '/home/xyc/NVMP/nvmp/build_dir/target-arm-AX620E-linux-uclibcgnueabihf-c668bv1/cap' Makefile:758: recipe for target '/home/xyc/NVMP/nvmp/build_dir/target-arm-AX620E-linux-uclibcgnueabihf-c668bv1/cap/.built' failed make[3]: *** [/home/xyc/NVMP/nvmp/build_dir/target-arm-AX620E-linux-uclibcgnueabihf-c668bv1/cap/.built] Error 2 make[3]: Leaving directory '/home/xyc/NVMP/nvmp/tp_package/cap' package/Makefile:105: recipe for target 'package/tp_package/cap/compile' failed make[2]: *** [package/tp_package/cap/compile] Error 2 make[2]: Leaving directory '/home/xyc/NVMP/nvmp' package/Makefile:101: recipe for target '/home/xyc/NVMP/nvmp/staging_dir/target-arm-AX620E-linux-uclibcgnueabihf-c668bv1/stamp/.package_compile' failed make[1]: *** [/home/xyc/NVMP/nvmp/staging_dir/target-arm-AX620E-linux-uclibcgnueabihf-c668bv1/stamp/.package_compile] Error 2 make[1]: Leaving directory '/home/xyc/NVMP/nvmp' /home/xyc/NVMP/nvmp/include/toplevel.mk:210: recipe for target 'world' failed make: *** [world] Error 2
最新发布
08-19
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值