static void block( int el ) { int i, idx = 0, row, col; rb->yield(); /* Find first unknown square */ for( i = 0 ; i < 9 && !IS_EMPTY( idx = idx_block( el, i ) ) ; ++i ) ; if( i < 9 ) { assert( IS_EMPTY( idx ) ); row = ROW( idx ); col = COLUMN( idx ); for( ++i ; i < 9 ; ++i ) { idx = idx_block( el, i ); if( IS_EMPTY( idx ) ) { if( ROW( idx ) != row ) row = -1; if( COLUMN( idx ) != col ) col = -1; } } if( 0 <= row ) exblock( el, row, idx_row ); if( 0 <= col ) exblock( el, col, idx_column ); } }
void receive_IMG(RX_CQ* queue) { short i, j; turn_Power_OUTER_Display(OFF); init_IMG_CQ(&IMG_Queue); IMG_Queue.total_img = *dequeue_RX(queue); for(j = 0; j < IMG_Queue.total_img; j++) { for(i = 0; i < OUTER_DISPLAY_COLOR_BYTE_LENGTH; i++) { while(IS_EMPTY(queue)) ; IMG_Queue.item[j].line_color_info[i] = *dequeue_RX(queue); } for(i = 0; i < OUTER_DISPLAY_TOTAL_DOT_BYTE; i++) { while(IS_EMPTY(queue)) ; IMG_Queue.item[j].dots[i / OUTER_DISPLAY_HEIGHT_IN_BYTE][i % OUTER_DISPLAY_HEIGHT_IN_BYTE] = *dequeue_RX(queue); } } OUTER_Status.content.mode = IMG; turn_Power_OUTER_Display(ON); }
static unsigned int match(char *s1, char *s2) { if (IS_EMPTY(s1) && IS_EMPTY(s2)) return TRUE; if (s1==NULL || s2==NULL) return FALSE; if (!strcmp(s1, s2)) return TRUE; return FALSE; }
void deliver_String(RX_CQ* queue) { unsigned short i, length; while(IS_EMPTY(queue)) ; length = *dequeue_RX(queue); for(i = 0; i < length; i++) { while(IS_EMPTY(queue)) ; //전달 = *dequeue_RX(queue); } }
bool sprite_mapscroll(sprite_t *spr) { int16_t screenx = spr->x + spr->xv; int16_t screeny = spr->y + spr->yv; int16_t worldx = (mapx << 3) + screenx; int16_t worldy = (mapy << 3) + screeny; uint8_t sprx = worldx >> 3; uint8_t spry = worldy >> 3; if (!ptInRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, screenx, screeny) || !ptInRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, screenx+8, screeny) || !ptInRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, screenx, screeny+8) || !ptInRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, screenx+8, screeny+8)) { if (worldx >= 0 && worldx <= (MAP_WIDTH << 3) && worldy >= 0 && worldy <= (MAP_HEIGHT << 3)) { // printf("OUT worldx=%d worldy=%d mapx=%d mapy=%d\n", worldx, worldy, mapx, mapy); if (worldy >= ((mapy + 7)<<3) && IS_EMPTY(map[(spry+1)*MAP_WIDTH+sprx]) ) { // printf("DOWN\n"); mapy += 8; spr->y = 0; return true; } if (worldy < (mapy<<3) && IS_EMPTY(map[(spry-1)*MAP_WIDTH+sprx])) { // printf("UP\n"); mapy -= 8; spr->y = SCREEN_HEIGHT - 8; return true; } if (worldx > ((mapx + 7)<<3) && IS_EMPTY(map[(spry)*MAP_WIDTH+(sprx+1)])) { // printf("RIGHT\n"); mapx += 16; spr->x = 0; return true; } if (worldx < (mapx<<3) && IS_EMPTY(map[(spry)*MAP_WIDTH+(sprx-1)])) { // printf("LEFT\n"); mapx -= 16; spr->x = SCREEN_WIDTH - 8; return true; } } } return false; }
bool Player::move() { sf::Vector2u newPos; bool valid; newPos = m_position; if (m_orientation == right) ++newPos.x; else if (m_orientation == down) ++newPos.y; else if (m_orientation == left) --newPos.x; else if (m_orientation == up) --newPos.y; valid = IS_EMPTY(this->getServerData()->getHoopla(newPos)); if (valid) { this->getServerData()->getHoopla(m_position).hasPlayer = false; m_position = newPos; this->getServerData()->getHoopla(m_position).hasPlayer = true; } return (valid); }
t_valor_variable POP_SIZE_CHECK_POSITION(t_stack* pila, int pos) { if(IS_EMPTY(pila)) return STACK_UNDERFLOW; else { return POP_POSITION(pila,pos); } }
t_valor_variable POP_SIZE_CHECK(t_stack* pila) { if(IS_EMPTY(pila)) return STACK_UNDERFLOW; else { return POP(pila); } }
void View_Board::paintEvent(QPaintEvent *event) { QPainter paint(this); // draw coordinate lines paint.setPen(QPen(Qt::white, 1)); paint.setBrush(QBrush(QColor(0x55, 0x55, 0x55))); for (int i = 1; i <= 8; i++) { paint.drawRect(QRect(i * 44, 0, 44, 44)); } for (int j = 1; j <= 8; j++) { paint.drawRect(QRect(0, j * 44, 44, 44)); } paint.drawText(60 + 44*0, 30, "1"); paint.drawText(60 + 44*1, 30, "2"); paint.drawText(60 + 44*2, 30, "3"); paint.drawText(60 + 44*3, 30, "4"); paint.drawText(60 + 44*4, 30, "5"); paint.drawText(60 + 44*5, 30, "6"); paint.drawText(60 + 44*6, 30, "7"); paint.drawText(60 + 44*7, 30, "8"); paint.drawText(15, 75 + 44*0, "1"); paint.drawText(15, 75 + 44*1, "2"); paint.drawText(15, 75 + 44*2, "3"); paint.drawText(15, 75 + 44*3, "4"); paint.drawText(15, 75 + 44*4, "5"); paint.drawText(15, 75 + 44*5, "6"); paint.drawText(15, 75 + 44*6, "7"); paint.drawText(15, 75 + 44*7, "8"); // draw cells paint.setPen(QPen(Qt::white, 1)); for (int i = 0, x0 = 44; i < 8; i++) { for (int j = 0, y0 = 44; j < 8; j++) { paint.setBrush(QBrush(( (i + j) % 2 ? QColor(0x77, 0xdd, 0x77) : QColor(0xba, 0xdb, 0xad) ))); paint.drawRect(QRect(x0 + i * 44, y0 + j * 44, 44, 44)); } } // draw figures for (int i = 0, x0 = 44; i < 8; i++) { for (int j = 0, y0 = 44; j < 8; j++) { FIGURE f = board->gcell(i, j); if (IS_EMPTY(f)) continue; paint.setBrush(QBrush(IS_WHITE(f) ? Qt::white : Qt::black)); paint.setPen(QPen(IS_WHITE(f) ? Qt::black : Qt::white, 1)); paint.drawEllipse(QRect(x0 + i * 44 + 4, y0 + j * 44 + 4, 36, 36)); if (IS_KNG(f)) { paint.setPen(QPen(IS_WHITE(f) ? Qt::black : Qt::white, 3)); paint.drawEllipse(QRect(x0 + i * 44 + 10, y0 + j * 44 + 10, 24, 24)); } } } // move indication if (!end_flag) { paint.setBrush(QBrush(Qt::yellow)); paint.setPen(QPen(Qt::white, 2)); if (board->getCurrentColor() != WHITE) { paint.drawEllipse(QRect(410, 60, 20, 20)); } else { paint.drawEllipse(QRect(410, 360, 20, 20)); } } }
static int choice( void ) { int i, n; rb->yield(); for( n = i = 0 ; i < 81 ; ++i ) if( IS_EMPTY( i ) ) { possible[ n ] = SET_INDEX( i ) | SET_DIGIT( numset( board[ i ] ) ); /* Inconsistency if square unknown, but nothing possible */ if( 9 == GET_DIGIT( possible[ n ] ) ) return -2; ++n; } if( 0 == n ) return -1; /* All squares known */ rb->qsort( possible, n, sizeof( possible[ 0 ] ), cmp ); return GET_INDEX( possible[ 0 ] ); }
/* * Find directory entry in specified sector. * The fat vnode data is filled if success. * * @fmp: fatfs mount point * @sec: sector# * @name: file name * @node: pointer to fat node */ static int fat_lookup_dirent(struct fatfsmount *fmp, u_long sec, char *name, struct fatfs_node *np) { struct fat_dirent *de; u_long i; int err; err = fat_read_dirent(fmp, sec); if (err) return err; de = (struct fat_dirent *)fmp->dir_buf; for (i = 0; i < DIR_PER_SEC; i++) { /* Find specific file or directory name */ if (IS_EMPTY(de)) return ENOENT; if (!IS_VOL(de) && !fat_compare_name((char *)de->name, name)) { /* Found. Fill the fat vnode data. */ *(&np->dirent) = *de; np->sector = sec; np->offset = sizeof(struct fat_dirent) * i; DPRINTF(("fat_lookup_dirent: found sec=%d\n", sec)); return 0; } if (!IS_DELETED(de)) DPRINTF(("fat_lookup_dirent: %s\n", de->name)); de++; } return EAGAIN; }
/* * Find empty directory entry and put new entry on it. * * @fmp: fatfs mount point * @sec: sector# * @np: pointer to fat node */ static int fat_add_dirent(struct fatfsmount *fmp, u_long sec, struct fatfs_node *np) { struct fat_dirent *de; int err; u_long i; err = fat_read_dirent(fmp, sec); if (err) return err; de = (struct fat_dirent *)fmp->dir_buf; for (i = 0; i < DIR_PER_SEC; i++) { if (IS_DELETED(de) || IS_EMPTY(de)) goto found; DPRINTF(("fat_add_dirent: scan %s\n", de->name)); de++; } return ENOENT; found: DPRINTF(("fat_add_dirent: found. sec=%d\n", sec)); memcpy(de, &np->dirent, sizeof(struct fat_dirent)); err = fat_write_dirent(fmp, sec); return err; }
/* * Get directory entry for specified index in sector. * The directory entry is filled if success. * * @fmp: fatfs mount point * @sec: sector# * @target: target index * @index: current index * @np: pointer to fat node */ static int fat_get_dirent(struct fatfsmount *fmp, u_long sec, int target, int *index, struct fatfs_node *np) { struct fat_dirent *de; u_long i; int err; err = fat_read_dirent(fmp, sec); if (err) return err; de = (struct fat_dirent *)fmp->dir_buf; for (i = 0; i < DIR_PER_SEC; i++) { if (IS_EMPTY(de)) return ENOENT; if (!IS_DELETED(de) && !IS_VOL(de)) { /* valid file */ if (*index == target) { *(&np->dirent) = *de; np->sector = sec; np->offset = sizeof(struct fat_dirent) * i; DPRINTF(("fat_get_dirent: found index=%d\n", *index)); return 0; } (*index)++; } DPRINTF(("fat_get_dirent: %s\n", de->name)); de++; } return EAGAIN; }
void fast_mblock_destroy(struct fast_mblock_man *mblock) { struct fast_mblock_malloc *pMallocNode; struct fast_mblock_malloc *pMallocTmp; if (IS_EMPTY(&mblock->trunks.head)) { delete_from_mblock_list(mblock); return; } pMallocNode = mblock->trunks.head.next; while (pMallocNode != &mblock->trunks.head) { pMallocTmp = pMallocNode; pMallocNode = pMallocNode->next; free(pMallocTmp); } INIT_HEAD(&mblock->trunks.head); mblock->info.trunk_total_count = 0; mblock->info.trunk_used_count = 0; mblock->free_chain_head = NULL; mblock->info.element_used_count = 0; mblock->info.element_total_count = 0; if (mblock->need_lock) pthread_mutex_destroy(&(mblock->lock)); delete_from_mblock_list(mblock); }
Ret_t buildDevInfDevInfCmd(XltDecoderPtr_t pDecoder, VoidPtr_t *ppElem) { XltDecScannerPtr_t pScanner; SmlDevInfDevInfPtr_t pElem = NULL; Ret_t rc; pScanner = pDecoder->scanner; if (*ppElem != NULL) return SML_ERR_XLT_INVAL_SYNCML_DOC; if (IS_EMPTY(pScanner->curtok)) { *ppElem = pElem; return SML_ERR_OK; } if (((rc = nextToken(pDecoder)) != SML_ERR_OK)) { smlLibFree(pElem); return rc; } switch (pScanner->curtok->tagid) { case TN_DEVINF_DEVINF: rc = buildDevInfDevInfContent(pDecoder, (VoidPtr_t)&pElem); break; default: rc = SML_ERR_XLT_INVAL_SYNCML_DOC; } if (rc != SML_ERR_OK) { smlLibFree(pElem); return rc; } *ppElem = pElem; return SML_ERR_OK; }
/** * Get next id. * * @param[in] idset idset structure * @return id (#END_OF_ID: end of id) * */ unsigned int idset_next(IDSET *idset) { unsigned int i, limit; int index0, index1; if (IS_EMPTY(idset)) return END_OF_ID; if (idset->lastid >= idset->max) return END_OF_ID; limit = idset->max / LONG_BIT + 1; index0 = idset->lastid / LONG_BIT; index1 = idset->lastid % LONG_BIT; for (i = ++index1; i < LONG_BIT; i++) if (bit[i] & idset->set[index0]) return idset->lastid = index0 * LONG_BIT + i; index0++; for (i = index0; i < limit && idset->set[i] == 0; i++) ; if (i >= limit) die("idset_next: internal error."); index0 = i; for (i = 0; i < LONG_BIT; i++) if (bit[i] & idset->set[index0]) return idset->lastid = index0 * LONG_BIT + i; die("idset_next: internal error."); }
t_valor_variable POP_RETORNAR (t_stack *pila, t_puntero posicionValor) { if(IS_EMPTY(pila)) { return STACK_UNDERFLOW; } else { int top = posicionValor; return pila->elementos[top-1];} }
void clear_square(square_t sq) { /*if (!IS_EMPTY(sq)) {*/ /*b.material_score -= evaluate_piece(b.colors[sq], b.pieces[sq], sq);*/ /*}*/ color_t c = b.colors[sq]; piece_t p = b.pieces[sq]; if (IS_EMPTY(sq)) { return; } b.hash ^= hash_keys[c][p][sq]; if (p == PAWN) { for (int i = 0; i < b.pawn_count[c]; i++) { if (b.pawn_sqs[c][i] == sq) { b.pawn_sqs[c][i] = b.pawn_sqs[c][b.pawn_count[c] - 1]; break; } } b.pawn_counts[c][SQFILE(sq)]--; b.pawnhash ^= hash_keys[c][PAWN][sq]; b.pawn_count[c]--; } else if (p != KING) { for (int i = 0; i < b.piece_count[c]; i++) { if (b.piece_sqs[c][i] == sq) { b.piece_sqs[c][i] = b.piece_sqs[c][b.piece_count[c] - 1]; break; } } b.piece_count[c]--; } b.pieces[sq] = PIECE_EMPTY; b.colors[sq] = COLOR_EMPTY; }
t_list_single find_aux(t_list_words l, t_websearch search_engine, t_list_single sites) { if (IS_EMPTY(l)) { return sites; } else { char *results[NBR_WEBSITES]; int count; char *request; int i; INFO("Construction de la requête"); request = build_request(HEAD(l)); INFO("Requête : %s", request); count = websearch(search_engine, request, results, NBR_WEBSITES); INFO("Documents trouvés : %d", count); INFO("Stockage des sites trouvés"); for(i=0;i<count;i++) { if (add_single_sorted(results[i], NBR_WEBSITES-i, &sites) == 0) { free(results[i]); } } INFO("Libération de la requête"); free_request(request); return find_aux(NEXT(l), search_engine, sites); } }
/* decoder callbacks */ Ret_t buildDmTndCmd(XltDecoderPtr_t pDecoder, VoidPtr_t *ppElem) { XltDecScannerPtr_t pScanner; SmlDmTndPtr_t pDmTnd; Ret_t rc; pScanner = pDecoder->scanner; if (*ppElem != NULL) return SML_ERR_XLT_INVAL_SYNCML_DOC; if ((pDmTnd = (SmlDmTndPtr_t)smlLibMalloc(sizeof(SmlDmTnd_t))) == NULL) return SML_ERR_NOT_ENOUGH_SPACE; smlLibMemset(pDmTnd, 0, sizeof(SmlDmTnd_t)); if (IS_EMPTY(pScanner->curtok)) { *ppElem = pDmTnd; return SML_ERR_OK; } if (((rc = nextToken(pDecoder)) != SML_ERR_OK)) { smlFreeDmTnd(pDmTnd); return rc; } while (pScanner->curtok->type != TOK_TAG_END) { switch (pScanner->curtok->tagid) { case TN_DMTND_MgmtTree: break; case TN_DMTND_VerDTD: rc = buildPCData(pDecoder, (VoidPtr_t)&pDmTnd->verdtd); break; case TN_DMTND_Man: rc = buildPCData(pDecoder, (VoidPtr_t)&pDmTnd->man); break; case TN_DMTND_Mod: rc = buildPCData(pDecoder, (VoidPtr_t)&pDmTnd->mod); break; case TN_DMTND_Node: rc = buildDmTndNodeList(pDecoder, (VoidPtr_t)&pDmTnd->nodelist); break; default: KCDBG(">>>>> buildDmTndDFPropsCmd: Unkown token: %d <<<<<\n", pScanner->curtok->tagid); rc = SML_ERR_XLT_INVAL_SYNCML_DOC; } if (rc != SML_ERR_OK) { smlFreeDmTnd(pDmTnd); return rc; } if (((rc = nextToken(pDecoder)) != SML_ERR_OK)) { smlFreeDmTnd(pDmTnd); return rc; } } *ppElem = pDmTnd; return SML_ERR_OK; }
BOOL visor_charqueue_is_empty(CHARQUEUE *charqueue) { BOOL b; spin_lock(&charqueue->lock); b = IS_EMPTY(charqueue); spin_unlock(&charqueue->lock); return b; }
static void dbrelay_db_free_connection(dbrelay_connection_t *conn, dbrelay_request_t *request) { conn->in_use--; if (IS_EMPTY(conn->connection_name)) { if (conn->db) api->assign_request(conn->db, NULL); dbrelay_db_close_connection(conn, request); } }
static int charqueue_dequeue_1(struct charqueue *charqueue) { int alloc_slots = charqueue->nslots + 1; /* 1 slot is always empty */ if (IS_EMPTY(charqueue)) return -1; charqueue->tail = (charqueue->tail+1) % alloc_slots; return charqueue->buf[charqueue->tail]; }
BOOL visor_charqueue_is_empty(struct charqueue *charqueue) { BOOL b; spin_lock(&charqueue->lock); b = IS_EMPTY(charqueue); spin_unlock(&charqueue->lock); return b; }
/** * Whether or not @a idset includes specified @a id. * * @param[in] idset idset structure * @param[in] id id number * @return true: contains, false: doesn't contain */ int idset_contains(IDSET *idset, unsigned int id) { if (IS_EMPTY(idset)) return 0; if (id < idset->min || id > idset->max) return 0; return (idset->set[id / LONG_BIT] & bit[id % LONG_BIT]) != 0; }
void sprite_move(sprite_t *spr) { // screen edge x if (spr->x + spr->xv > (SCREEN_WIDTH - 8) || spr->x + spr->xv < 0) { if (spr->flags & SPRITE_FLAG_BOUNCE) spr->xv = -spr->xv; else spr->xv = 0; } else { uint8_t tile; if ( (!gridAt(spr->x + spr->xv + 0, spr->y + spr->yv + 0, &tile)) || !IS_EMPTY(tile) || (!gridAt(spr->x + spr->xv + 7, spr->y + spr->yv + 0, &tile)) || !IS_EMPTY(tile) || (!gridAt(spr->x + spr->xv + 0, spr->y + spr->yv + 7, &tile)) || !IS_EMPTY(tile) || (!gridAt(spr->x + spr->xv + 7, spr->y + spr->yv + 7, &tile)) || !IS_EMPTY(tile) ) { // FIXME, budge edge if (spr->flags & SPRITE_FLAG_BOUNCE) spr->xv = -spr->xv; } else { spr->x += spr->xv; } } // screen edge y if (spr->y + spr->yv > (SCREEN_HEIGHT - 8) || spr->y + spr->yv < 0) { if (spr->flags & SPRITE_FLAG_BOUNCE) spr->yv = -spr->yv; else spr->yv = 0; } else { uint8_t tile; if ( (!gridAt(spr->x + spr->xv + 0, spr->y + spr->yv + 0, &tile)) || !IS_EMPTY(tile) || (!gridAt(spr->x + spr->xv + 7, spr->y + spr->yv + 0, &tile)) || !IS_EMPTY(tile) || (!gridAt(spr->x + spr->xv + 0, spr->y + spr->yv + 7, &tile)) || !IS_EMPTY(tile) || (!gridAt(spr->x + spr->xv + 7, spr->y + spr->yv + 7, &tile)) || !IS_EMPTY(tile) ) { // FIXME, budge edge if (spr->flags & SPRITE_FLAG_BOUNCE) spr->yv = -spr->yv; } else { spr->y += spr->yv; } } }
void receive_MUSIC(RX_CQ* queue) { short i; unsigned char length[2]; for(i = 0; i < 2; i++) { while(IS_EMPTY(queue)) ; length[i] = *dequeue_RX(queue); } OUTER_Music.length = *(short*)length; for(i = 0; i < OUTER_Music.length; i++) { while(IS_EMPTY(queue)) ; OUTER_Music.LEVEL_Data[i] = *dequeue_RX(queue); } }
/* decoder callbacks */ Ret_t buildDmTndTypeCmd(XltDecoderPtr_t pDecoder, VoidPtr_t *ppElem) { XltDecScannerPtr_t pScanner; SmlDmTndTypePtr_t pDmTndType; Ret_t rc; pScanner = pDecoder->scanner; if (*ppElem != NULL) return SML_ERR_XLT_INVAL_SYNCML_DOC; if ((pDmTndType = (SmlDmTndTypePtr_t)smlLibMalloc(sizeof(SmlDmTndType_t))) == NULL) return SML_ERR_NOT_ENOUGH_SPACE; smlLibMemset(pDmTndType, 0, sizeof(SmlDmTndType_t)); if (IS_EMPTY(pScanner->curtok)) { *ppElem = pDmTndType; return SML_ERR_OK; } if (((rc = nextToken(pDecoder)) != SML_ERR_OK)) { smlFreeDmTndType(pDmTndType); return rc; } while (pScanner->curtok->type != TOK_TAG_END) { switch (pScanner->curtok->tagid) { case TN_DMTND_MIME: rc = buildPCData(pDecoder, (VoidPtr_t)&pDmTndType->mime); break; case TN_DMTND_DDFName: rc = buildPCData(pDecoder, (VoidPtr_t)&pDmTndType->ddfname); break; default: KCDBG(">>>>> Unkown token: %d <<<<<\n", pScanner->curtok->tagid); rc = SML_ERR_XLT_INVAL_SYNCML_DOC; } if (rc != SML_ERR_OK) { smlFreeDmTndType(pDmTndType); return rc; } if (((rc = nextToken(pDecoder)) != SML_ERR_OK)) { smlFreeDmTndType(pDmTndType); return rc; } if (pScanner->curtok->type != TOK_TAG_END) { smlFreeDmTndType(pDmTndType); return SML_ERR_XLT_INVAL_SYNCML_DOC; } } *ppElem = pDmTndType; return SML_ERR_OK; }
Ret_t buildMetInfMemCmd(XltDecoderPtr_t pDecoder, VoidPtr_t *ppElem) { XltDecScannerPtr_t pScanner; SmlMetInfMemPtr_t pMem; Ret_t rc; pScanner = pDecoder->scanner; if (*ppElem != NULL) return SML_ERR_XLT_INVAL_SYNCML_DOC; if ((pMem = (SmlMetInfMemPtr_t)smlLibMalloc(sizeof(SmlMetInfMem_t))) == NULL) return SML_ERR_NOT_ENOUGH_SPACE; smlLibMemset(pMem, 0, sizeof(SmlMetInfMem_t)); if (IS_EMPTY(pScanner->curtok)) { *ppElem = pMem; return SML_ERR_OK; } if (((rc = nextToken(pDecoder)) != SML_ERR_OK)) { smlFreeMetinfMem(pMem); //smlLibFree(pMem); return rc; } while (pScanner->curtok->type != TOK_TAG_END) { switch (pScanner->curtok->tagid) { /* PCDATA elements */ case TN_METINF_SHAREDMEM: rc = buildPCData(pDecoder, (VoidPtr_t)&pMem->shared); break; case TN_METINF_FREEMEM: rc = buildPCData(pDecoder, (VoidPtr_t)&pMem->free); break; case TN_METINF_FREEID: rc = buildPCData(pDecoder, (VoidPtr_t)&pMem->freeid); break; default: rc = SML_ERR_XLT_INVAL_SYNCML_DOC; } if (rc != SML_ERR_OK) { smlFreeMetinfMem(pMem); //smlLibFree(pMem); return rc; } if (((rc = nextToken(pDecoder)) != SML_ERR_OK)) { smlFreeMetinfMem(pMem); //smlLibFree(pMem); return rc; } } *ppElem = pMem; return SML_ERR_OK; }
Ret_t buildDevInfDSMemCmd(XltDecoderPtr_t pDecoder, VoidPtr_t *ppElem) { XltDecScannerPtr_t pScanner; SmlDevInfDSMemPtr_t pElem; Ret_t rc; pScanner = pDecoder->scanner; if (*ppElem != NULL) return SML_ERR_XLT_INVAL_SYNCML_DOC; if ((pElem = (SmlDevInfDSMemPtr_t)smlLibMalloc(sizeof(SmlDevInfDSMem_t))) == NULL) return SML_ERR_NOT_ENOUGH_SPACE; smlLibMemset(pElem, 0, sizeof(SmlDevInfDSMem_t)); if (IS_EMPTY(pScanner->curtok)) { *ppElem = pElem; return SML_ERR_OK; } if (((rc = nextToken(pDecoder)) != SML_ERR_OK)) { smlLibFree(pElem); return rc; } while (pScanner->curtok->type != TOK_TAG_END) { switch (pScanner->curtok->tagid) { /* PCDATA elements */ case TN_DEVINF_SHAREDMEM: // %%% luz:2003-04-28: made work as a flag pElem->flags |= SmlDevInfSharedMem_f; // rc = buildPCData(pDecoder, (VoidPtr_t)&pElem->shared); break; case TN_DEVINF_MAXMEM: rc = buildPCData(pDecoder, (VoidPtr_t)&pElem->maxmem); break; case TN_DEVINF_MAXID: rc = buildPCData(pDecoder, (VoidPtr_t)&pElem->maxid); break; default: rc = SML_ERR_XLT_INVAL_SYNCML_DOC; } if (rc != SML_ERR_OK) { smlLibFree(pElem); return rc; } if (((rc = nextToken(pDecoder)) != SML_ERR_OK)) { smlLibFree(pElem); return rc; } } *ppElem = pElem; return SML_ERR_OK; }