Changeset 60156 in vbox for trunk/include/VBox
- Timestamp:
- Mar 23, 2016 11:44:24 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/usblib.h
r60155 r60156 127 127 DECLINLINE(size_t) USBLibPurgeEncoding(char *psz) 128 128 { 129 size_t offSrc; 129 if (psz) 130 { 131 size_t offSrc; 130 132 131 /* Beat it into valid UTF-8 encoding. */132 RTStrPurgeEncoding(psz);133 /* Beat it into valid UTF-8 encoding. */ 134 RTStrPurgeEncoding(psz); 133 135 134 /* Look for control characters. */ 135 for (offSrc = 0; ; offSrc++) 136 { 137 char ch = psz[offSrc]; 138 if (RT_UNLIKELY(RT_C_IS_CNTRL(ch))) 136 /* Look for control characters. */ 137 for (offSrc = 0; ; offSrc++) 139 138 { 140 /* Found a control character! Replace tab by space and remove all others. */ 141 size_t offDst = offSrc; 142 for (;; offSrc++) 139 char ch = psz[offSrc]; 140 if (RT_UNLIKELY(RT_C_IS_CNTRL(ch))) 143 141 { 144 ch = psz[offSrc]; 145 if (RT_C_IS_CNTRL(ch)) 142 /* Found a control character! Replace tab by space and remove all others. */ 143 size_t offDst = offSrc; 144 for (;; offSrc++) 146 145 { 147 if (ch == '\t') 148 ch = ' '; 149 else 150 continue; 146 ch = psz[offSrc]; 147 if (RT_C_IS_CNTRL(ch)) 148 { 149 if (ch == '\t') 150 ch = ' '; 151 else 152 continue; 153 } 154 psz[offDst++] = ch; 155 if (ch == '\0') 156 break; 151 157 } 152 psz[offDst++] = ch; 153 if (ch == '\0') 154 break; 158 return offDst - 1; 155 159 } 156 return offDst - 1; 160 if (ch == '\0') 161 break; 157 162 } 158 if (ch == '\0') 159 break; 163 return offSrc - 1; 160 164 } 161 return offSrc - 1;165 return 0; 162 166 } 163 167
Note:
See TracChangeset
for help on using the changeset viewer.