search for: _truncate

Displaying 12 results from an estimated 12 matches for "_truncate".

Did you mean: truncate
2014 Sep 20
2
vsnprintf_s and vsnprintf
lvqcl wrote: > I wrote a small program that fills a buffer[] with "abcdefghijklmnopqrstuvwxyz\0" > pattern and then tries to write "0123456789" string into it. > It calls either > ret = vsnprintf_s(buffer, buf_size, _TRUNCATE, fmt, va); > or > ret = vsnprintf(buffer, buf_size, fmt, va); <snip> > vsnprintf (MSVC, MinGW): > > buf_size = 8; ret = -1; buffer = "01234567ijklmnopqrstuvwxyz" > buf_size = 9; ret = -1; buffer = "012345678jklmnopqrstuvwx...
2014 Aug 08
4
[PATCH] for win_utf8_io.c
For better readability the patch is divided by 3 parts. Part #1: for a bit better security replace vsprintf(utmp, format, argptr) with vsnprintf_s(utmp, 32768, _TRUNCATE, format, argptr) Part #2: potential memleak fixed: utf8argv[i] are not freed when utf8argv itself is freed. Part #3: 'if (ret != 0) break;' line seems redundant. -------------- next part -------------- A non-text attachment was scrubbed... Name: win_utf8_io.zip Type: application/zip Siz...
2014 Sep 18
3
patch for win_utf8_io.c: vsnprintf_s vs. MinGW
lvqcl wrote: > Oops. It seems that vsnprintf_s isn't always available on MinGW platform: > MinGW declares this function only if MINGW_HAS_SECURE_API macro is defined. > That's because WinXP version of msvcrt.dll doesn't contain secure functions > like vsnprintf_s. > > Maybe it's better to revert vsnprintf_s to vsprintf or to use vnsprintf? Ok, we need to drop
2014 Sep 20
0
vsnprintf_s and vsnprintf
...he requirements if the ISO C specs. > > I'm basically think of something like the (untested) diff below. > > @@ -62,8 +62,11 @@ flac_snprintf(char *str, size_t size, const char *fmt, ...) > va_start (va, fmt); > #ifdef _MSC_VER > - rc = vsnprintf_s (str, size, _TRUNCATE, fmt, va); > - rc = (rc > 0) ? rc : (size == 0 ? 1024 : size * 2); > + rc = vsnprintf (str, size, fmt, va); > + if (rc < 0) { > + rc = size - 1; > + str [rc] = 0; > + } > #else > rc = vsnprintf (str, size, fm...
2014 Sep 20
3
vsnprintf_s and vsnprintf
...thing that came into my head version of the code :-). > What about this version -- > > int flac_snprintf(char *str, size_t size, const char *fmt, ...) > { > va_list va; > int rc; > > va_start (va, fmt); > > #if defined _MSC_VER > rc = vsnprintf_s (str, size, _TRUNCATE, fmt, va); > if (rc < 0) > rc = size - 1; > #elif defined __MINGW32__ && (!defined __USE_MINGW_ANSI_STDIO || __USE_MINGW_ANSI_STDIO == 0) > rc = vsnprintf (str, size, fmt, va); > if (rc < 0 || rc == size) { > rc = size - 1; > str [rc] = '\0'; /* a...
2014 Aug 08
0
[PATCH] for win_utf8_io.c
...if something failed so not exiting from the loop is wasted effort. On 8.8.2014 18:18, lvqcl wrote: > For better readability the patch is divided by 3 parts. > > Part #1: for a bit better security replace > vsprintf(utmp, format, argptr) > with > vsnprintf_s(utmp, 32768, _TRUNCATE, format, argptr) > > > Part #2: potential memleak fixed: utf8argv[i] are not freed > when utf8argv itself is freed. > > > Part #3: 'if (ret != 0) break;' line seems redundant. > > > _______________________________________________ > flac-dev mailing list >...
2014 Sep 12
2
win_utf8_io.c: Use fputws instead of fwprintf
Hi On MSVCRT, wprintf expects that %s is wide char string, but for not MSVCRT, this is not true. When using -D__USE_MINGW_ANSI_STDIO=1 on MINGW, mingw doesn't use MSVCRT. Therefore, compiling on mingw with -D__USE_MINGW_ANSI_STDIO=1 and redirecting stderr to a file, the printing result is corrupt. We should use fputws simply. A patch is attached. -------------- next part
2014 Sep 12
0
patch for win_utf8_io.c: vsnprintf_s vs. MinGW
...sion of msvcrt.dll doesn't contain secure functions like vsnprintf_s. Maybe it's better to revert vsnprintf_s to vsprintf or to use vnsprintf? (Of course it's also possible to write something like #if defined _MSC_VER || defined MINGW_HAS_SECURE_API ret = vsnprintf_s(buf, bufsize, _TRUNCATE, format, arglist); #else ret = vsnprintf(buf, bufsize, format, arglist); if (ret < 0) buf[bufsize-1] = '\0'; #endif but it probably just adds unnecessary complexity)
2014 Sep 19
0
vsnprintf_s and vsnprintf
...fer vsnprintf > over vsprintf but have no way of testing any of these options. I wrote a small program that fills a buffer[] with "abcdefghijklmnopqrstuvwxyz\0" pattern and then tries to write "0123456789" string into it. It calls either ret = vsnprintf_s(buffer, buf_size, _TRUNCATE, fmt, va); or ret = vsnprintf(buffer, buf_size, fmt, va); The results are: --------------------------------------------------------------------------- vsnprintf_s (MSVC, MinGW): buf_size = 8; ret = -1; buffer = "0123456" buf_size = 9; ret = -1; buf...
2014 Aug 09
3
[PATCH] for win_utf8_io.c
Janne Hyv?rinen wrote: > Some comments for patch #1, I chose the non-secure versions because they > are faster and produce smaller binary. The functions where these > printings are performed can't in my opinion ever exceed the safety > margin of 32 KB. They print short help and error texts and occasionally > filename, which with APIs is restricted to 260 characters. And you
2010 Jun 11
0
Wine release 1.2-rc3
...ate Japanese translation. Alex Balut (1): comctl32/tests: Added a test that checks whether setting a custom default button in a property sheet works. Alexander Scott-Johns (8): msvcrt: Fix comments. msvcrt/tests: Properly skip if functions are not available. msvcrt: Rename _TRUNCATE to MSVCRT__TRUNCATE. include/msvcrt: Define _TRUNCATE; use it in the tests. msvcrt: The sizeOfBuffer argument of _vsnwprintf_s is measured in wide characters, not bytes. msvcrt: Fix spec file. msvcrt/test: Add some simple _vsnwprintf_s tests. msvcrt/tests: Move functio...
2012 Apr 13
0
Wine release 1.5.2
...ion. msvcrt: Rewrite wasctime function. msvcrt: Set correct date and time format for C locale. msvcrt: Added field names to MSVCRT___lc_time_data structure. msvcrt: Added _Strftime implementation. msvcrt/tests: Added more strftime tests. msvcrt: Added support for _TRUNCATE flag in wcsncpy_s. msvcrt: Fix months and weekday names in C locale. wininet: Store correct urlcache file size. Robert van Herk (1): msi: Fixed MsiGetFileHashW for empty files. Stefan Leichter (2): atl80: New dll. atl80: Add stub for AtlCreateRegistrar. Vincent Povi...