ref: e0da5a1686026e6c41695d1e13918acba8fe5cc7
parent: 208f033bcd542bb204ef7eb96a790469d1c51afb
author: Martin Storsjö <martin@martin.st>
date: Tue Jan 28 07:24:57 EST 2014
Remove the now unused STRCAT macro
--- a/codec/common/crt_util_safe_x.h
+++ b/codec/common/crt_util_safe_x.h
@@ -96,169 +96,4 @@
}
#endif
-
-/*
- * Safe Lib specific errno codes. These can be added to the errno.h file
- * if desired.
- */
-#define ESNULLP ( 400 ) /* null ptr */
-#define ESZEROL ( 401 ) /* length is zero */
-#define ESLEMIN ( 402 ) /* length is below min */
-#define ESLEMAX ( 403 ) /* length exceeds max */
-#define ESOVRLP ( 404 ) /* overlap undefined */
-#define ESEMPTY ( 405 ) /* empty string */
-#define ESNOSPC ( 406 ) /* not enough space for s2 */
-#define ESUNTERM ( 407 ) /* unterminated string */
-#define ESNODIFF ( 408 ) /* no difference */
-#define ESNOTFND ( 409 ) /* not found */
-
-/* EOK may or may not be defined in errno.h */
-#ifndef EOK
-#define EOK 0
-#endif
-
-#if (defined(WIN32) && defined(_MSC_VER) && (_MSC_VER<1500)) || defined(__GNUC__)
-
-static inline int wels_strcat_s (char* dest, int dmax, const char* src) {
- int orig_dmax;
- char* orig_dest;
- const char* overlap_bumper;
-
- if (dest == NULL) {
-// invoke_safe_lib_constraint_handler("strcat_s: dest is null",
-// NULL, ESNULLP);
- return (ESNULLP);
- }
-
- if (src == NULL) {
-// invoke_safe_lib_constraint_handler("strcat_s: src is null",
-// NULL, ESNULLP);
- return (ESNULLP);
- }
-
- if (dmax <= 0) {
-// invoke_safe_lib_constraint_handler("strcat_s: dmax is 0",
-// NULL, ESZEROL);
- return (ESZEROL);
- }
-
-// if (dmax > RSIZE_MAX_STR) {
-// invoke_safe_lib_constraint_handler("strcat_s: dmax exceeds max",
-// NULL, ESLEMAX);
-// return (ESLEMAX);
-// }
-
- /* hold base of dest in case src was not copied */
- orig_dmax = dmax;
- orig_dest = dest;
-
- if (dest < src) {
- overlap_bumper = src;
-
- /* Find the end of dest */
- while (*dest != '\0') {
-
- if (dest == overlap_bumper) {
-// handle_error(orig_dest, orig_dmax, "strcat_s: overlapping objects", ESOVRLP);
- return (ESOVRLP);
- }
-
- dest++;
- dmax--;
- if (dmax == 0) {
-// handle_error(orig_dest, orig_dmax, "strcat_s: dest unterminated", ESUNTERM);
- return (ESUNTERM);
- }
- }
-
- while (dmax > 0) {
- if (dest == overlap_bumper) {
-// handle_error(orig_dest, orig_dmax, "strcat_s: overlapping objects", ESOVRLP);
- return (ESOVRLP);
- }
-
- *dest = *src;
- if (*dest == '\0') {
-#ifdef SAFE_LIB_STR_NULL_SLACK
- /* null slack to clear any data */
- while (dmax) {
- *dest = '\0';
- dmax--;
- dest++;
- }
-#endif
- return (EOK);
- }
-
- dmax--;
- dest++;
- src++;
- }
-
- } else {
- overlap_bumper = dest;
-
- /* Find the end of dest */
- while (*dest != '\0') {
-
- /*
- * NOTE: no need to check for overlap here since src comes first
- * in memory and we're not incrementing src here.
- */
- dest++;
- dmax--;
- if (dmax == 0) {
-// handle_error(orig_dest, orig_dmax, "strcat_s: dest unterminated", ESUNTERM);
- return (ESUNTERM);
- }
- }
-
- while (dmax > 0) {
- if (src == overlap_bumper) {
-// handle_error(orig_dest, orig_dmax, "strcat_s: overlapping objects", ESOVRLP);
- return (ESOVRLP);
- }
-
- *dest = *src;
- if (*dest == '\0') {
-#ifdef SAFE_LIB_STR_NULL_SLACK
- /* null slack to clear any data */
- while (dmax) {
- *dest = '\0';
- dmax--;
- dest++;
- }
-#endif
- return (EOK);
- }
-
- dmax--;
- dest++;
- src++;
- }
- }
-
- /*
- * the entire src was not copied, so null the string
- */
-// handle_error(orig_dest, orig_dmax, "strcat_s: not enough space for src", ESNOSPC);
-
- return (ESNOSPC);
-}
-
-#endif//(WIN32 && _MSC_VER && _MSC_VER<1500) || __GNUC__
-
-#if defined(WIN32) && defined(_MSC_VER)
-#if _MSC_VER >= 1500 // VS2008
-#define STRCAT strcat_s
-#else // mainly for VC6
-#define STRCAT wels_strcat_s // override s.t.r.c.a.t here for safe
-#endif//_MSC_VER >= 1500
-
-#else//__GNUC__
-
-#define STRCAT wels_strcat_s // override s.t.r.c.a.t here for safe
-
-#endif//WIN32
-
#endif//WELS_CRT_UTIL_SAFE_CROSS_PLATFORMS_H__