From: Jean-Michel A. <au...@us...> - 2009-02-10 20:47:56
|
Update of /cvsroot/ipmitool/ipmitool/lib In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv4797/lib Modified Files: ipmi_fru.c Log Message: - Clean most of the warnings Index: ipmi_fru.c =================================================================== RCS file: /cvsroot/ipmitool/ipmitool/lib/ipmi_fru.c,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** ipmi_fru.c 29 Sep 2008 17:13:50 -0000 1.53 --- ipmi_fru.c 10 Feb 2009 20:47:47 -0000 1.54 *************** *** 299,303 **** if (fru_data == NULL) { lprintf(LOG_ERR, " Out of memory!"); ! return; } --- 299,303 ---- if (fru_data == NULL) { lprintf(LOG_ERR, " Out of memory!"); ! return NULL; } *************** *** 356,363 **** // Common header bloc_count = 0; ! p_bloc[bloc_count].start= 0; p_bloc[bloc_count].size = 8; ! strcpy(p_bloc[bloc_count].blocId, "Common Header Section"); bloc_count ++; --- 356,363 ---- // Common header bloc_count = 0; ! p_bloc[bloc_count].start= 0; p_bloc[bloc_count].size = 8; ! strcpy((char *)p_bloc[bloc_count].blocId, "Common Header Section"); bloc_count ++; *************** *** 367,371 **** p_bloc[bloc_count].start = (header.offset.internal * 8); p_bloc[bloc_count].size = 0; // Will be fillup later ! strcpy(p_bloc[bloc_count].blocId, "Internal Use Section"); bloc_count ++; } --- 367,371 ---- p_bloc[bloc_count].start = (header.offset.internal * 8); p_bloc[bloc_count].size = 0; // Will be fillup later ! strcpy((char *)p_bloc[bloc_count].blocId, "Internal Use Section"); bloc_count ++; } *************** *** 375,379 **** p_bloc[bloc_count].start = (header.offset.chassis * 8); p_bloc[bloc_count].size = 0; // Will be fillup later ! strcpy(p_bloc[bloc_count].blocId, "Chassis Section"); bloc_count ++; } --- 375,379 ---- p_bloc[bloc_count].start = (header.offset.chassis * 8); p_bloc[bloc_count].size = 0; // Will be fillup later ! strcpy((char *)p_bloc[bloc_count].blocId, "Chassis Section"); bloc_count ++; } *************** *** 383,387 **** p_bloc[bloc_count].start = (header.offset.board * 8); p_bloc[bloc_count].size = 0; // Will be fillup later ! strcpy(p_bloc[bloc_count].blocId, "Board Section"); bloc_count ++; } --- 383,387 ---- p_bloc[bloc_count].start = (header.offset.board * 8); p_bloc[bloc_count].size = 0; // Will be fillup later ! strcpy((char *)p_bloc[bloc_count].blocId, "Board Section"); bloc_count ++; } *************** *** 391,395 **** p_bloc[bloc_count].start = (header.offset.product * 8); p_bloc[bloc_count].size = 0; // Will be fillup later ! strcpy(p_bloc[bloc_count].blocId, "Product Section"); bloc_count ++; } --- 391,395 ---- p_bloc[bloc_count].start = (header.offset.product * 8); p_bloc[bloc_count].size = 0; // Will be fillup later ! strcpy((char *)p_bloc[bloc_count].blocId, "Product Section"); bloc_count ++; } *************** *** 410,414 **** p_bloc[bloc_count].start = i; p_bloc[bloc_count].size = h->len + sizeof (struct fru_multirec_header); ! sprintf(p_bloc[bloc_count].blocId, "Multi-Rec Aread: Type %i", h->type); bloc_count ++; /*printf("Bloc Start: %i\n", i); --- 410,414 ---- p_bloc[bloc_count].start = i; p_bloc[bloc_count].size = h->len + sizeof (struct fru_multirec_header); ! sprintf((char *)p_bloc[bloc_count].blocId, "Multi-Rec Aread: Type %i", h->type); bloc_count ++; /*printf("Bloc Start: %i\n", i); *************** *** 428,432 **** p_bloc[bloc_count].start = i; p_bloc[bloc_count].size = (fru->size - i); ! sprintf(p_bloc[bloc_count].blocId, "Unused space"); bloc_count ++; } --- 428,432 ---- p_bloc[bloc_count].start = i; p_bloc[bloc_count].size = (fru->size - i); ! sprintf((char *)p_bloc[bloc_count].blocId, "Unused space"); bloc_count ++; } *************** *** 1227,1231 **** { uint8_t * fru_data; ! uint32_t fru_len, i, j, toff; struct fru_multirec_header * h; struct fru_multirec_powersupply * ps; --- 1227,1231 ---- { uint8_t * fru_data; ! uint32_t fru_len, i; struct fru_multirec_header * h; struct fru_multirec_powersupply * ps; *************** *** 1233,1237 **** struct fru_multirec_dcload * dl; uint16_t peak_capacity; ! uint8_t peak_hold_up_time, bn; uint32_t last_off, len; --- 1233,1237 ---- struct fru_multirec_dcload * dl; uint16_t peak_capacity; ! uint8_t peak_hold_up_time; uint32_t last_off, len; *************** *** 1568,1573 **** uint8_t blockCount; uint8_t blockIndex=0; - unsigned long blockCrc = 0; - unsigned int blockLen = 0; unsigned int matchInstance = 0; --- 1568,1571 ---- *************** *** 1580,1584 **** tOemKontronInformationRecord *recordData; uint8_t nameLen; - uint8_t fieldLength; blockstart = offset; --- 1578,1581 ---- *************** *** 1586,1591 **** nameLen = ( fru_data[offset++] &= 0x3F ); ! if(!strncmp(argv[OEM_KONTRON_NAME_ARG_POS], ! fru_data+offset,nameLen)&& (matchInstance == instance)){ printf ("Found : %s\n",argv[OEM_KONTRON_NAME_ARG_POS]); --- 1583,1588 ---- nameLen = ( fru_data[offset++] &= 0x3F ); ! if(!strncmp((char *)argv[OEM_KONTRON_NAME_ARG_POS], ! (const char *)(fru_data+offset),nameLen)&& (matchInstance == instance)){ printf ("Found : %s\n",argv[OEM_KONTRON_NAME_ARG_POS]); *************** *** 1611,1616 **** hasChanged = TRUE; } ! else if(!strncmp(argv[OEM_KONTRON_NAME_ARG_POS],fru_data+offset, ! nameLen)){ printf ("Skipped : %s\n",argv[OEM_KONTRON_NAME_ARG_POS]); matchInstance++; --- 1608,1613 ---- hasChanged = TRUE; } ! else if(!strncmp((char *)argv[OEM_KONTRON_NAME_ARG_POS], ! (const char *)(fru_data+offset), nameLen)){ printf ("Skipped : %s\n",argv[OEM_KONTRON_NAME_ARG_POS]); matchInstance++; *************** *** 1924,1928 **** printf("\n"); ! for (offset; offset < off + length; offset += sizeof(struct fru_picmgext_link_desc)) { /* to solve little endian /big endian problem */ --- 1921,1925 ---- printf("\n"); ! for (; offset < off + length; offset += sizeof(struct fru_picmgext_link_desc)) { /* to solve little endian /big endian problem */ *************** *** 2040,2044 **** case FRU_AMC_CURRENT: { - unsigned char recVersion; unsigned char current; printf(" FRU_AMC_CURRENT\n"); --- 2037,2040 ---- *************** *** 2084,2088 **** uint16_t index; ! for(offset; offset < off + length; ) { struct fru_picmgext_carrier_p2p_record * h = --- 2080,2084 ---- uint16_t index; ! for(; offset < off + length; ) { struct fru_picmgext_carrier_p2p_record * h = *************** *** 2178,2182 **** } ! for ( offset; offset < off + length;) { struct fru_picmgext_amc_link_desc_record * l = --- 2174,2178 ---- } ! for ( ; offset < off + length;) { struct fru_picmgext_amc_link_desc_record * l = *************** *** 2436,2440 **** printf(" Family: 0x%02x - AccLVL: 0x%02x\n", family, accuracy); printf(" FRQ: %-9d - min: %-9d - max: %-9d\n", ! freq, min_freq, max_freq); } printf("\n"); --- 2432,2436 ---- printf(" Family: 0x%02x - AccLVL: 0x%02x\n", family, accuracy); printf(" FRQ: %-9d - min: %-9d - max: %-9d\n", ! (int)freq, (int)min_freq, (int)max_freq); } printf("\n"); *************** *** 2870,2877 **** uint32_t offFruMultiRec; uint32_t fruMultiRecSize = 0; - uint32_t offFileMultiRec = 0; - uint32_t fileMultiRecSize = 0; struct fru_info fruInfo; - uint8_t *buf = NULL; retStatus = ipmi_fru_get_multirec_location_from_fru(intf, id, &fruInfo, &offFruMultiRec, --- 2866,2870 ---- *************** *** 2937,2941 **** if (fru_data == NULL) { lprintf(LOG_ERR, " Out of memory!"); ! return; } memset(fru_data, 0, fru.size + 1); --- 2930,2934 ---- if (fru_data == NULL) { lprintf(LOG_ERR, " Out of memory!"); ! return -1; } memset(fru_data, 0, fru.size + 1); *************** *** 3488,3492 **** --- 3481,3487 ---- { lprintf(LOG_ERR, "Cannot access internal use area"); + return -1; } + return 0; } *************** *** 3548,3552 **** lprintf(LOG_ERR, "Error opening file %s\n", pFileName); free(frubuf); ! return; } fclose(pFile); --- 3543,3547 ---- lprintf(LOG_ERR, "Error opening file %s\n", pFileName); free(frubuf); ! return -1; } fclose(pFile); *************** *** 3563,3566 **** --- 3558,3562 ---- lprintf(LOG_ERR, "Cannot access internal use area"); } + return 0; } *************** *** 3647,3650 **** --- 3643,3647 ---- lprintf(LOG_ERR, "Cannot access internal use area"); } + return 0; } *************** *** 3844,3850 **** struct fru_header header; uint8_t msg_data[4]; ! uint8_t sn_size, checksum,prev_lun; ! int ret = 0, i = 0; ! uint8_t *fru_data, *fru_area; uint32_t fru_field_offset, fru_field_offset_tmp; uint32_t fru_section_len, header_offset; --- 3841,3847 ---- struct fru_header header; uint8_t msg_data[4]; ! uint8_t checksum; ! int i = 0; ! uint8_t *fru_data, *fru_area = NULL; uint32_t fru_field_offset, fru_field_offset_tmp; uint32_t fru_section_len, header_offset; *************** *** 3967,3973 **** for( i=0; i<f_index; i++ ) { ! fru_area = get_fru_area_str(fru_data, &fru_field_offset); } ! if ( strlen(fru_area) == 0 ) { printf("Field not found!\n"); return -1; --- 3964,3970 ---- for( i=0; i<f_index; i++ ) { ! fru_area = (uint8_t *) get_fru_area_str(fru_data, &fru_field_offset); } ! if ( strlen((const char *)fru_area) == 0 ) { printf("Field not found!\n"); return -1; *************** *** 3975,3981 **** /* Get original field string */ fru_field_offset_tmp = fru_field_offset; ! fru_area = get_fru_area_str(fru_data, &fru_field_offset); ! if ( strlen(fru_area) == strlen(f_string) ) { printf("Updating Field...\n"); --- 3972,3978 ---- /* Get original field string */ fru_field_offset_tmp = fru_field_offset; ! fru_area = (uint8_t *) get_fru_area_str(fru_data, &fru_field_offset); ! if ( strlen((const char *)fru_area) == strlen((const char *)f_string) ) { printf("Updating Field...\n"); |