# Changeset 2451

- Timestamp:
- 10/27/13 21:08:10 (4 years ago)
- Files:

### Legend:

- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved

## trunk/libffado/src/fireworks/efc/efc_cmds_hardware.cpp

r1763 r2451 191 191 EfcPolledValuesCmd::deserialize( Util::Cmd::IISDeserialize& de ) 192 192 { 193 bool result=true; 194 195 result &= EfcCmd::deserialize ( de ); 193 int i, nb_meters; 194 bool result; 195 196 if (!EfcCmd::deserialize(de)) 197 return false; 196 198 197 199 // the serialization is different from the deserialization 200 result = true; 198 201 EFC_DESERIALIZE_AND_SWAP(de, &m_status, result); 199 202 … … 208 211 EFC_DESERIALIZE_AND_SWAP(de, &m_reserved6, result); 209 212 210 int i=0; 211 int nb_meters=m_nb_output_meters+m_nb_input_meters; 212 213 assert(nb_meters<POLLED_MAX_NB_METERS); 214 for (i=0; i<nb_meters; i++) { 213 if (!result) 214 return result; 215 216 nb_meters = m_nb_output_meters + m_nb_input_meters; 217 if (nb_meters > POLLED_MAX_NB_METERS) { 218 m_nb_output_meters = 0; 219 m_nb_input_meters = 0; 220 return false; 221 } 222 223 result = true; 224 for (i = 0; i < nb_meters; i++) 215 225 EFC_DESERIALIZE_AND_SWAP(de, (uint32_t *)&m_meters[i], result); 216 ~~}~~217 226 218 227 return result; … … 222 231 EfcPolledValuesCmd::showEfcCmd() 223 232 { 233 unsigned int i; 234 224 235 EfcCmd::showEfcCmd(); 225 236 … … 228 239 debugOutput(DEBUG_LEVEL_NORMAL, " Detect SPDIF : 0x%08X\n", m_detect_spdif); 229 240 debugOutput(DEBUG_LEVEL_NORMAL, " Detect ADAT : 0x%08X\n", m_detect_adat); 230 231 unsigned int i=0; 232 debugOutput(DEBUG_LEVEL_NORMAL, " # Output Meters : %d\n", m_nb_output_meters); 233 for (i=0;i<m_nb_output_meters;i++) { 234 debugOutput(DEBUG_LEVEL_NORMAL, " Meter %d: %d\n", i, m_meters[i]); 235 } 236 237 debugOutput(DEBUG_LEVEL_NORMAL, " # Input Meters : %d\n", m_nb_input_meters); 238 for (;i<m_nb_output_meters+m_nb_input_meters;i++) { 239 debugOutput(DEBUG_LEVEL_NORMAL, " Meter %d: %d\n", i, m_meters[i]); 241 242 /* prevent buffer over run */ 243 if (m_nb_output_meters + m_nb_input_meters > POLLED_MAX_NB_METERS) 244 return; 245 246 if (m_nb_output_meters > 0) { 247 debugOutput(DEBUG_LEVEL_NORMAL, " # Output Meters : %d\n", m_nb_output_meters); 248 for (i = 0; i < m_nb_output_meters; i++) 249 debugOutput(DEBUG_LEVEL_NORMAL, " Meter %d: %d\n", i, m_meters[i]); 250 } 251 252 if (m_nb_input_meters > 0) { 253 debugOutput(DEBUG_LEVEL_NORMAL, " # Input Meters : %d\n", m_nb_input_meters); 254 for (; i < m_nb_output_meters + m_nb_input_meters; i++) 255 debugOutput(DEBUG_LEVEL_NORMAL, " Meter %d: %d\n", i, m_meters[i]); 240 256 } 241 257 }