diff options
| author | Javier <dev.git@javispedro.com> | 2026-11-22 19:02:35 +0100 |
|---|---|---|
| committer | Javier <dev.git@javispedro.com> | 2026-11-22 19:02:35 +0100 |
| commit | bc437f9709a7a48865bae2a4aa40536bfc80ebbc (patch) | |
| tree | 94f152361f4ab8e4964419a350100c71e737c9ad /vboxshfl.h | |
| parent | 186879bf4f702beaa687037197aec39715454ede (diff) | |
| download | vbados-bc437f9709a7a48865bae2a4aa40536bfc80ebbc.tar.gz vbados-bc437f9709a7a48865bae2a4aa40536bfc80ebbc.zip | |
vbsf: when resolving lfn, list only files starting with the same prefix as the short filenameHEADmaster
Diffstat (limited to 'vboxshfl.h')
| -rw-r--r-- | vboxshfl.h | 24 |
1 files changed, 23 insertions, 1 deletions
@@ -43,18 +43,21 @@ static inline unsigned shflstring_size_with_buf(const SHFLSTRING *str) static inline unsigned shflstring_size_optional_in(const SHFLSTRING *str) { - if (str->u16Length > 0) { + if (str && str->u16Length > 0) { return sizeof(SHFLSTRING) + str->u16Size; } else { return 0; } } +/** Set str to the empty string. */ static inline void shflstring_clear(SHFLSTRING *str) { str->u16Length = 0; + str->ach[str->u16Length] = '\0'; } +/** Initialize str by copying src. */ static void shflstring_strcpy(SHFLSTRING *str, const char __far *src) { str->u16Length = MIN(_fstrlen(src), str->u16Size - 1); @@ -62,6 +65,7 @@ static void shflstring_strcpy(SHFLSTRING *str, const char __far *src) str->ach[str->u16Length] = '\0'; } +/** Initialize str by copying len first characters of src. */ static void shflstring_strncpy(SHFLSTRING *str, const char __far *src, unsigned len) { str->u16Length = MIN(len, str->u16Size - 1); @@ -69,6 +73,24 @@ static void shflstring_strncpy(SHFLSTRING *str, const char __far *src, unsigned str->ach[str->u16Length] = '\0'; } +/** Append single character to str (if space) */ +static void shflstring_append(SHFLSTRING *str, char c) +{ + if (str->u16Length < str->u16Size - 1) { + str->ach[str->u16Length++] = c; + str->ach[str->u16Length] = '\0'; + } +} + +/** Append len characters of src to str. */ +static void shflstring_strncat(SHFLSTRING *str, const char __far *src, unsigned len) +{ + len = MIN(len, (str->u16Size - 1) - str->u16Length); + _fmemcpy(&str->ach[str->u16Length], src, len); + str->u16Length += len; + str->ach[str->u16Length] = '\0'; +} + static inline void vbox_hgcm_set_parameter_shflroot(VMMDevHGCMCall __far *req, unsigned arg, SHFLROOT root) { vbox_hgcm_set_parameter_uint32(req, arg, root); |
