mirror of
https://github.com/oopuuu/zTC1.git
synced 2025-12-17 15:38:14 +08:00
88 lines
3.3 KiB
C
88 lines
3.3 KiB
C
/* Copyright Statement:
|
|
*
|
|
* (C) 2005-2016 MediaTek Inc. All rights reserved.
|
|
*
|
|
* This software/firmware and related documentation ("MediaTek Software") are
|
|
* protected under relevant copyright laws. The information contained herein
|
|
* is confidential and proprietary to MediaTek Inc. ("MediaTek") and/or its licensors.
|
|
* Without the prior written permission of MediaTek and/or its licensors,
|
|
* any reproduction, modification, use or disclosure of MediaTek Software,
|
|
* and information contained herein, in whole or in part, shall be strictly prohibited.
|
|
* You may only use, reproduce, modify, or distribute (as applicable) MediaTek Software
|
|
* if you have agreed to and been bound by the applicable license agreement with
|
|
* MediaTek ("License Agreement") and been granted explicit permission to do so within
|
|
* the License Agreement ("Permitted User"). If you are not a Permitted User,
|
|
* please cease any access or use of MediaTek Software immediately.
|
|
* BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
|
|
* THAT MEDIATEK SOFTWARE RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES
|
|
* ARE PROVIDED TO RECEIVER ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
|
|
* WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
|
|
* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
|
|
* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
|
|
* SUPPLIED WITH MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH
|
|
* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES
|
|
* THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES
|
|
* CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK
|
|
* SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
|
|
* STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND
|
|
* CUMULATIVE LIABILITY WITH RESPECT TO MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
|
|
* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE MEDIATEK SOFTWARE AT ISSUE,
|
|
* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO
|
|
* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
|
|
*/
|
|
|
|
#ifndef __TOI_H__
|
|
#define __TOI_H__
|
|
|
|
#include <stdint.h>
|
|
|
|
/**
|
|
* @file: toi.h
|
|
*
|
|
* This file contains the APIs for converting strings to integers.
|
|
*/
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
enum {
|
|
TOI_BIN,
|
|
TOI_OCT,
|
|
TOI_DEC,
|
|
TOI_HEX,
|
|
TOI_ERR
|
|
};
|
|
|
|
/**
|
|
* Convert octal, binary, hex, decimal integer strings into a variable and
|
|
* returns it. The string type and failure is notified in parameter
|
|
* <i>type</i>.
|
|
*
|
|
* @param b input buffer.
|
|
* @param type the detected string type of the input buffer.
|
|
*
|
|
* @return the value of the string.
|
|
*/
|
|
uint32_t toi(char *b, uint8_t *type);
|
|
|
|
|
|
/**
|
|
* Convert octal, binary, hex, decimal integer strings into a variable and
|
|
* pass the result in pointer <i>value</i>. The string type or failure number
|
|
* is notified by return value.
|
|
*
|
|
* @param b input buffer.
|
|
* @param value the converted value.
|
|
* @return the string type or TOI_ERR if an error occurred.
|
|
*/
|
|
uint8_t tov(char *b, uint32_t *value);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* __TOI_H__ */
|
|
|