1 /* 2 * Copyright (c) 2017 Cyril Hrubis <chrubis (at) suse.cz> 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 2 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 12 * the GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 */ 18 19 #ifndef LTP_AIODIO_COMMON_CHECKZERO 20 #define LTP_AIODIO_COMMON_CHECKZERO 21 22 static char *check_zero(char *buf, int size) 23 { 24 char *p; 25 26 p = buf; 27 28 while (size > 0) { 29 if (*buf != 0) { 30 fprintf(stderr, "non zero buffer at buf[%u] => 0x%02x,%02x,%02x,%02x\n", 31 (unsigned int)(buf - p), 32 (unsigned int)buf[0], 33 size > 1 ? (unsigned int)buf[1] : 0, 34 size > 2 ? (unsigned int)buf[2] : 0, 35 size > 3 ? (unsigned int)buf[3] : 0); 36 return buf; 37 } 38 buf++; 39 size--; 40 } 41 42 return NULL; 43 } 44 45 #endif /* LTP_AIODIO_COMMON_CHECKZERO */ 46