#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "pi-hinote.h"
Include dependency graph for hinote.c:

Go to the source code of this file.
Functions | |
| void | free_HiNoteNote (HiNoteNote_t *hinote) |
| int | unpack_HiNoteNote (HiNoteNote_t *hinote, unsigned char *buffer, int len) |
| int | pack_HiNoteNote (HiNoteNote_t *hinote, unsigned char *buffer, int len) |
| int | unpack_HiNoteAppInfo (HiNoteAppInfo_t *appinfo, unsigned char *record, size_t len) |
| int | pack_HiNoteAppInfo (HiNoteAppInfo_t *appinfo, unsigned char *record, size_t len) |
| void free_HiNoteNote | ( | HiNoteNote_t * | hinote | ) |
| int pack_HiNoteAppInfo | ( | HiNoteAppInfo_t * | appinfo, | |
| unsigned char * | record, | |||
| size_t | len | |||
| ) |
Definition at line 154 of file hinote.c.
References HiNoteAppInfo::category, pack_CategoryAppInfo(), and HiNoteAppInfo::reserved.
00155 { 00156 int i, 00157 idx; 00158 unsigned char *start = record; 00159 00160 i = pack_CategoryAppInfo(&appinfo->category, record, len); 00161 if (i == 0) /* category pack failed */ 00162 return 0; 00163 if (!record) 00164 return i + 48; 00165 record += i; 00166 len -= i; 00167 if (len < 48) 00168 return (record - start); 00169 for (idx = 0; i < 48; i++) 00170 *record++ = appinfo->reserved[i]; 00171 00172 return (record - start); 00173 }
Here is the call graph for this function:

| int pack_HiNoteNote | ( | HiNoteNote_t * | hinote, | |
| unsigned char * | buffer, | |||
| int | len | |||
| ) |
Definition at line 85 of file hinote.c.
References HiNoteNote::flags, HiNoteNote::level, and HiNoteNote::text.
Referenced by main().
00086 { 00087 int destlen; 00088 00089 destlen = 3; 00090 if (hinote->text) 00091 destlen += strlen(hinote->text); 00092 00093 if (!buffer) 00094 return destlen; 00095 if (len < destlen) 00096 return 0; 00097 00098 buffer[0] = hinote->flags; 00099 buffer[1] = hinote->level; 00100 00101 if (hinote->text) 00102 strcpy((char *) &buffer[2], hinote->text); 00103 else { 00104 buffer[2] = 0; 00105 } 00106 return destlen; 00107 }
| int unpack_HiNoteAppInfo | ( | HiNoteAppInfo_t * | appinfo, | |
| unsigned char * | record, | |||
| size_t | len | |||
| ) |
Definition at line 122 of file hinote.c.
References HiNoteAppInfo::category, HiNoteAppInfo::reserved, and unpack_CategoryAppInfo().
Referenced by main().
00123 { 00124 int i, 00125 idx; 00126 unsigned char *start; 00127 00128 start = record; 00129 i = unpack_CategoryAppInfo(&appinfo->category, record, len); 00130 if (!i) 00131 return i; 00132 record += i; 00133 len -= i; 00134 if (len < 48) 00135 return 0; 00136 for (idx = 0; i < 48; i++) 00137 appinfo->reserved[i] = *record++; 00138 return (record - start); 00139 }
Here is the call graph for this function:

| int unpack_HiNoteNote | ( | HiNoteNote_t * | hinote, | |
| unsigned char * | buffer, | |||
| int | len | |||
| ) |
Definition at line 61 of file hinote.c.
References HiNoteNote::flags, HiNoteNote::level, strdup(), and HiNoteNote::text.
Referenced by main().
00062 { 00063 if (len < 3) 00064 return 0; 00065 00066 hinote->flags = buffer[0]; 00067 hinote->level = buffer[1]; 00068 hinote->text = strdup((char *) &buffer[2]); 00069 00070 return strlen((char *) &buffer[2]) + 3; 00071 }
Here is the call graph for this function:
