• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

*NIXコンソール用Google ToDo(Tasks) クライアント


Commit MetaInfo

Revisiond92a9b5e33476e743dfb1a63b37c20f43131ff38 (tree)
Zeit2020-02-17 22:04:20
AutorKoine Yuusuke(koinec) <koinec@user...>
CommiterKoine Yuusuke(koinec)

Log Message

  • WorkBackup

Ändern Zusammenfassung

Diff

--- a/src/libtodo_define.h
+++ b/src/libtodo_define.h
@@ -36,6 +36,24 @@ TODOCMDTODOCMDTODOCMDTODOCMDTODOCMDTODOCMDTODOCMDTODOCMDTODOCMDTODOCMDTODO*/
3636 #define GLAPI_JSON_KEY_ACCESS_TOKEN "access_token"
3737 #define GLAPI_JSON_KEY_REFRESH_TOKEN "refresh_token"
3838 #define GLAPI_JSON_KEY_TOKEN_TYPE "token_type"
39+
40+#define JSON_KEY_LISTS_KIND "\"tasks#taskLists\""
41+#define JSON_KEY_LISTS_ITEMS "items"
42+
43+#define JSON_KEY_LIST_KIND "\"tasks#taskList\""
44+#define JSON_KEY_LIST_ID "id"
45+#define JSON_KEY_LIST_TITLE "title"
46+#define JSON_KEY_LIST_UPDATED "updated"
47+
48+#define JSON_KEY_TASKS_KIND "\"tasks#tasks\""
49+#define JSON_KEY_TASKS_NEXTPAGETOKEN "nextPageToken"
50+#define JSON_KEY_TASKS_ITEMS "items"
51+
52+#define JSON_KEY_TASK_PARENT "parent"
53+#define JSON_KEY_TASK_POSITION "position"
54+#define JSON_KEY_TASK_ID "id"
55+#define JSON_KEY_TASK_TITLE "title"
56+#define JSON_KEY_TASK_UPDATED "updated"
3957
4058 #endif
4159
--- a/src/libtodo_glapi_list.c
+++ b/src/libtodo_glapi_list.c
@@ -65,12 +65,12 @@ int
6565 // Parse & Inset ListData ---
6666 p_json = json_tokener_parse( (const char *)t_glresult.pb_result );
6767
68- if( 0x00 != ProcJson_CheckKind( p_json, "\"tasks#taskLists\"" ) ) {
68+ if( 0x00 != ProcJson_CheckKind( p_json, JSON_KEY_LISTS_KIND ) ) {
6969 i_result = -0x02;
7070 goto goto_GLAPI_List_GetTaskList_putjson;
7171 }
7272
73- p_jitems = ProcJson_GetJsonChildArray( p_json, "items" );
73+ p_jitems = ProcJson_GetJsonChildArray( p_json, JSON_KEY_LISTS_ITEMS );
7474 if( NULL == p_jitems ) {
7575 i_result = -0x03;
7676 goto goto_GLAPI_List_GetTaskList_putjson;
@@ -90,20 +90,20 @@ int
9090 assert( NULL != p_tdata );
9191
9292 // kind
93- if( 0x00 != ProcJson_CheckKind( p_jlist, "\"tasks#taskList\"" ) ) {
93+ if( 0x00 != ProcJson_CheckKind( p_jlist, JSON_KEY_LIST_KIND ) ) {
9494 i_result = -0x05;
9595 goto goto_GLAPI_List_GetTaskList_putjson;
9696 }
9797
9898 // id
99- ProcJson_GetJsonChildString( p_tdata->str_id, p_jlist, "id", 64 );
99+ ProcJson_GetJsonChildString( p_tdata->str_id, p_jlist, JSON_KEY_LIST_ID, 64 );
100100 strncpy( p_tdata->t_data.str_id, p_tdata->str_id, 64 ); // copy.
101101 p_tdata->dw_hash = Common_CalcDJBhash( p_tdata->str_id );
102102 // etag: NOT USE.
103103 // title
104- ProcJson_GetJsonChildString( p_tdata->t_data.str_item, p_jlist, "title", 512 );
104+ ProcJson_GetJsonChildString( p_tdata->t_data.str_item, p_jlist, JSON_KEY_LIST_TITLE, 512 );
105105 // updated
106- ProcJson_GetJsonChildString( p_tdata->t_data.str_update, p_jlist, "updated", 32 );
106+ ProcJson_GetJsonChildString( p_tdata->t_data.str_update, p_jlist, JSON_KEY_LIST_UPDATED, 32 );
107107 // selflink: NOT USE.
108108
109109 // level
--- a/src/libtodo_glapi_task.c
+++ b/src/libtodo_glapi_task.c
@@ -59,31 +59,32 @@ int
5959 json_object *p_jtask;
6060 ToDo_Data *p_tdata;
6161
62- if( 0x00 != ProcJson_CheckKind( p_json, "\"tasks#tasks\"" ) ) {
62+ if( 0x00 != ProcJson_CheckKind( p_json, JSON_KEY_TASKS_KIND ) ) {
6363 i_result = -0x01;
6464 goto goto_GLAPI_Tasks_GetTask_RegistTaskfromJson_post;
6565 }
6666
67- ProcJson_GetJsonChildString( pstr_nexttoken, p_json, "nextPageToken", 255 );
67+ ProcJson_GetJsonChildString( pstr_nexttoken, p_json, JSON_KEY_TASKS_NEXTPAGETOKEN, 255 );
6868
69- p_jitems = ProcJson_GetJsonChildArray( p_json, "items" );
69+ p_jitems = ProcJson_GetJsonChildArray( p_json, JSON_KEY_TASKS_ITEMS );
7070 if( NULL == p_jitems ) {
7171 i_result = -0x02;
7272 goto goto_GLAPI_Tasks_GetTask_RegistTaskfromJson_post;
7373 }
74+
7475 for( i_cnt = 0; i_cnt < json_object_array_length( p_jitems ); i_cnt++ ) {
7576 str_parentid[0] = '\0';
7677 p_jtask = json_object_array_get_idx( p_jitems, i_cnt );
7778 assert( NULL != p_jtask );
7879
7980 // parent:
80- ProcJson_GetJsonChildString( str_parentid, p_jtask, "parent", 64 );
81+ ProcJson_GetJsonChildString( str_parentid, p_jtask, JSON_KEY_TASK_PARENT, 64 );
8182 if( '\0' != str_parentid[0] ) { b_type = TODODATA_TYPE_SUB; }
8283 else { b_type = TODODATA_TYPE_TASK; }
8384 i_tparent = p_tlist->i_id;
8485
8586 // position:
86- ProcJson_GetJsonChildString( str_position, p_jtask, "position", 32 );
87+ ProcJson_GetJsonChildString( str_position, p_jtask, JSON_KEY_TASK_POSITION, 32 );
8788 qw_position = Common_ConvStr2QWord( str_position );
8889
8990 // Alloc ToDo Data ---
@@ -104,14 +105,14 @@ int
104105 }
105106 */
106107 // id
107- ProcJson_GetJsonChildString( p_tdata->str_id, p_jtask, "id", 64 );
108+ ProcJson_GetJsonChildString( p_tdata->str_id, p_jtask, JSON_KEY_TASK_ID, 64 );
108109 strncpy( p_tdata->t_data.str_id, p_tdata->str_id, 64 ); // Copy.
109110 p_tdata->dw_hash = Common_CalcDJBhash( p_tdata->str_id );
110111 // etag: NOT USE.
111112 // title
112- ProcJson_GetJsonChildString( p_tdata->t_data.str_item, p_jtask, "title", 512 );
113+ ProcJson_GetJsonChildString( p_tdata->t_data.str_item, p_jtask, JSON_KEY_TASK_TITLE, 512 );
113114 // updated
114- ProcJson_GetJsonChildString( p_tdata->t_data.str_update, p_jtask, "updated", 32 );
115+ ProcJson_GetJsonChildString( p_tdata->t_data.str_update, p_jtask, JSON_KEY_TASK_UPDATED, 32 );
115116 // parentid
116117 strncpy( p_tdata->str_parent, str_parentid, 64 );
117118 // selflink: NOT USE.