btstack_util.c (6535961a1f105e850ecdf294c128b9fc982ee05a) | btstack_util.c (ff3cc4a5378c2f681cc9b75cf54d154a12a3051e) |
---|---|
1/* 2 * Copyright (C) 2014 BlueKitchen GmbH 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright --- 359 unchanged lines hidden (view full) --- 368 if (result){ 369 bd_addr_copy(addr, buffer); 370 } 371 return result; 372} 373 374uint32_t btstack_atoi(const char *str){ 375 uint32_t val = 0; | 1/* 2 * Copyright (C) 2014 BlueKitchen GmbH 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright --- 359 unchanged lines hidden (view full) --- 368 if (result){ 369 bd_addr_copy(addr, buffer); 370 } 371 return result; 372} 373 374uint32_t btstack_atoi(const char *str){ 375 uint32_t val = 0; |
376 while (1){ | 376 while (true){ |
377 char chr = *str; 378 if (!chr || (chr < '0') || (chr > '9')) 379 return val; 380 val = (val * 10) + (uint8_t)(chr - '0'); 381 str++; 382 } 383} 384 --- 75 unchanged lines hidden --- | 377 char chr = *str; 378 if (!chr || (chr < '0') || (chr > '9')) 379 return val; 380 val = (val * 10) + (uint8_t)(chr - '0'); 381 str++; 382 } 383} 384 --- 75 unchanged lines hidden --- |