1/** 2 * @copyright 3 * ==================================================================== 4 * Licensed to the Apache Software Foundation (ASF) under one 5 * or more contributor license agreements. See the NOTICE file 6 * distributed with this work for additional information 7 * regarding copyright ownership. The ASF licenses this file 8 * to you under the Apache License, Version 2.0 (the 9 * "License"); you may not use this file except in compliance 10 * with the License. You may obtain a copy of the License at 11 * 12 * http://www.apache.org/licenses/LICENSE-2.0 13 * 14 * Unless required by applicable law or agreed to in writing, 15 * software distributed under the License is distributed on an 16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 * KIND, either express or implied. See the License for the 18 * specific language governing permissions and limitations 19 * under the License. 20 * ==================================================================== 21 * @endcopyright 22 * 23 * @file svn_eol_private.h 24 * @brief Subversion's EOL functions - Internal routines 25 */ 26 27#ifndef SVN_EOL_PRIVATE_H 28#define SVN_EOL_PRIVATE_H 29 30#include <apr_pools.h> 31#include <apr_hash.h> 32 33#include "svn_types.h" 34#include "svn_error.h" 35 36#ifdef __cplusplus 37extern "C" { 38#endif /* __cplusplus */ 39 40/* Constants used by various chunky string processing functions. 41 */ 42#if APR_SIZEOF_VOIDP == 8 43# define SVN__LOWER_7BITS_SET 0x7f7f7f7f7f7f7f7f 44# define SVN__BIT_7_SET 0x8080808080808080 45# define SVN__R_MASK 0x0a0a0a0a0a0a0a0a 46# define SVN__N_MASK 0x0d0d0d0d0d0d0d0d 47#else 48# define SVN__LOWER_7BITS_SET 0x7f7f7f7f 49# define SVN__BIT_7_SET 0x80808080 50# define SVN__R_MASK 0x0a0a0a0a 51# define SVN__N_MASK 0x0d0d0d0d 52#endif 53 54/* Generic EOL character helper routines */ 55 56/* Look for the start of an end-of-line sequence (i.e. CR or LF) 57 * in the array pointed to by @a buf , of length @a len. 58 * If such a byte is found, return the pointer to it, else return NULL. 59 * 60 * @since New in 1.7 61 */ 62char * 63svn_eol__find_eol_start(char *buf, apr_size_t len); 64 65/* Return the first eol marker found in buffer @a buf as a NUL-terminated 66 * string, or NULL if no eol marker is found. Do not examine more than 67 * @a len bytes in @a buf. 68 * 69 * If the last valid character of @a buf is the first byte of a 70 * potentially two-byte eol sequence, just return that single-character 71 * sequence, that is, assume @a buf represents a CR-only or LF-only file. 72 * This is correct for callers that pass an entire file at once, and is 73 * no more likely to be incorrect than correct for any caller that doesn't. 74 * 75 * The returned string is statically allocated, i.e. it is NOT a pointer 76 * to an address within @a buf. 77 * 78 * If an eol marker is found and @a eolp is not NULL, store in @a *eolp 79 * the address within @a buf of the first byte of the eol marker. 80 * This allows callers to tell whether there might be more than one eol 81 * sequence in @a buf, as well as detect two-byte eol sequences that 82 * span buffer boundaries. 83 * 84 * @since New in 1.7 85 */ 86const char * 87svn_eol__detect_eol(char *buf, apr_size_t len, char **eolp); 88 89#ifdef __cplusplus 90} 91#endif /* __cplusplus */ 92 93#endif /* SVN_EOL_PRIVATE_H */ 94