Changeset - r11870:92eb16f6d311
[Not reviewed]
master
0 21 0
smatz - 15 years ago 2009-05-10 17:27:25
smatz@openttd.org
(svn r16269) -Codechange: use gcc's ability to check parameters sent to printf-like functions
-Fix: wrong number of parameters or wrong parameter types sent to printf-like functions at several places
21 files changed with 72 insertions and 61 deletions:
0 comments (0 inline, 0 general)
src/console.cpp
Show inline comments
 
@@ -116,13 +116,13 @@ void IConsolePrint(ConsoleColour colour_
 
 * by any other means. Uses printf() style format, for more information look
 
 * at IConsolePrint()
 
 */
 
void CDECL IConsolePrintF(ConsoleColour colour_code, const char *s, ...)
 
void CDECL IConsolePrintF(ConsoleColour colour_code, const char *format, ...)
 
{
 
	va_list va;
 
	char buf[ICON_MAX_STREAMSIZE];
 

	
 
	va_start(va, s);
 
	vsnprintf(buf, sizeof(buf), s, va);
 
	va_start(va, format);
 
	vsnprintf(buf, sizeof(buf), format, va);
 
	va_end(va);
 

	
 
	IConsolePrint(colour_code, buf);
src/console_cmds.cpp
Show inline comments
 
@@ -1209,7 +1209,7 @@ DEF_CONSOLE_CMD(ConInfoVar)
 

	
 
	IConsolePrintF(CC_DEFAULT, "variable name: %s", var->name);
 
	IConsolePrintF(CC_DEFAULT, "variable type: %s", _icon_vartypes[var->type]);
 
	IConsolePrintF(CC_DEFAULT, "variable addr: 0x%X", var->addr);
 
	IConsolePrintF(CC_DEFAULT, "variable addr: %p", var->addr);
 

	
 
	if (var->hook.access) IConsoleWarning("variable is access hooked");
 
	if (var->hook.pre) IConsoleWarning("variable is pre hooked");
 
@@ -1236,7 +1236,7 @@ DEF_CONSOLE_CMD(ConInfoCmd)
 
	}
 

	
 
	IConsolePrintF(CC_DEFAULT, "command name: %s", cmd->name);
 
	IConsolePrintF(CC_DEFAULT, "command proc: 0x%X", cmd->proc);
 
	IConsolePrintF(CC_DEFAULT, "command proc: %p", cmd->proc);
 

	
 
	if (cmd->hook.access) IConsoleWarning("command is access hooked");
 
	if (cmd->hook.pre) IConsoleWarning("command is pre hooked");
 
@@ -1441,7 +1441,7 @@ DEF_CONSOLE_CMD(ConCompanies)
 
		const NetworkCompanyStats *stats = &company_stats[c->index];
 

	
 
		GetString(buffer, STR_COLOUR_DARK_BLUE + _company_colours[c->index], lastof(buffer));
 
		IConsolePrintF(CC_INFO, "#:%d(%s) Company Name: '%s'  Year Founded: %d  Money: %" OTTD_PRINTF64 "d  Loan: %" OTTD_PRINTF64 "d  Value: %" OTTD_PRINTF64 "d  (T:%d, R:%d, P:%d, S:%d) %sprotected",
 
		IConsolePrintF(CC_INFO, "#:%d(%s) Company Name: '%s'  Year Founded: %d  Money: " OTTD_PRINTF64 "  Loan: " OTTD_PRINTF64 "  Value: " OTTD_PRINTF64 "  (T:%d, R:%d, P:%d, S:%d) %sprotected",
 
			c->index + 1, buffer, company_name, c->inaugurated_year, (int64)c->money, (int64)c->current_loan, (int64)CalculateCompanyValue(c),
 
			/* trains      */ stats->num_vehicle[0],
 
			/* lorry + bus */ stats->num_vehicle[1] + stats->num_vehicle[2],
src/console_func.h
Show inline comments
 
@@ -17,7 +17,7 @@ void IConsoleClose();
 

	
 
/* console output */
 
void IConsolePrint(ConsoleColour colour_code, const char *string);
 
void CDECL IConsolePrintF(ConsoleColour colour_code, const char *s, ...);
 
void CDECL IConsolePrintF(ConsoleColour colour_code, const char *format, ...) WARN_FORMAT(2, 3);
 
void IConsoleDebug(const char *dbg, const char *string);
 
void IConsoleWarning(const char *string);
 
void IConsoleError(const char *string);
src/core/alloc_func.cpp
Show inline comments
 
@@ -11,7 +11,7 @@
 
 */
 
void NORETURN MallocError(size_t size)
 
{
 
	error("Out of memory. Cannot allocate %i bytes", size);
 
	error("Out of memory. Cannot allocate " PRINTF_SIZE " bytes", size);
 
}
 

	
 
/**
 
@@ -20,5 +20,5 @@ void NORETURN MallocError(size_t size)
 
 */
 
void NORETURN ReallocError(size_t size)
 
{
 
	error("Out of memory. Cannot reallocate %i bytes", size);
 
	error("Out of memory. Cannot reallocate " PRINTF_SIZE " bytes", size);
 
}
src/debug.cpp
Show inline comments
 
@@ -92,15 +92,13 @@ static void debug_print(const char *dbg,
 
	}
 
}
 

	
 
void CDECL debug(const char *dbg, ...)
 
void CDECL debug(const char *dbg, const char *format, ...)
 
{
 
	va_list va;
 
	va_start(va, dbg);
 
	const char *s;
 
	char buf[1024];
 

	
 
	s = va_arg(va, const char*);
 
	vsnprintf(buf, lengthof(buf), s, va);
 
	va_list va;
 
	va_start(va, format);
 
	vsnprintf(buf, lengthof(buf), format, va);
 
	va_end(va);
 

	
 
	debug_print(dbg, buf);
 
@@ -149,7 +147,7 @@ void SetDebugString(const char *s)
 
		if (p != NULL) {
 
			*p = v;
 
		} else {
 
			ShowInfoF("Unknown debug level '%.*s'", s - t, t);
 
			ShowInfoF("Unknown debug level '%.*s'", (int)(s - t), t);
 
			return;
 
		}
 
	}
src/debug.h
Show inline comments
 
@@ -50,19 +50,12 @@
 
	extern int _debug_gamelog_level;
 
	extern int _debug_desync_level;
 

	
 
	void CDECL debug(const char *dbg, ...);
 
	void CDECL debug(const char *dbg, const char *format, ...) WARN_FORMAT(2, 3);
 
#endif /* NO_DEBUG_MESSAGES */
 

	
 
void SetDebugString(const char *s);
 
const char *GetDebugString();
 

	
 
/* MSVCRT of course has to have a different syntax for long long *sigh* */
 
#if defined(_MSC_VER) || defined(__MINGW32__)
 
	#define OTTD_PRINTF64 "I64"
 
#else
 
	#define OTTD_PRINTF64 "ll"
 
#endif
 

	
 
/* Used for profiling
 
 *
 
 * Usage:
 
@@ -100,6 +93,6 @@ const char *GetDebugString();
 
}
 

	
 
void ShowInfo(const char *str);
 
void CDECL ShowInfoF(const char *str, ...);
 
void CDECL ShowInfoF(const char *str, ...) WARN_FORMAT(1, 2);
 

	
 
#endif /* DEBUG_H */
src/fileio.cpp
Show inline comments
 
@@ -595,7 +595,7 @@ bool TarListAddFile(const char *filename
 
		/* Calculate the size of the file.. for some strange reason this is stored as a string */
 
		memcpy(buf, th.size, sizeof(th.size));
 
		buf[sizeof(th.size)] = '\0';
 
		int skip = strtol(buf, &end, 8);
 
		size_t skip = strtoul(buf, &end, 8);
 

	
 
		switch (th.typeflag) {
 
			case '\0':
 
@@ -614,7 +614,7 @@ bool TarListAddFile(const char *filename
 
				/* Convert to lowercase and our PATHSEPCHAR */
 
				SimplifyFileName(name);
 

	
 
				DEBUG(misc, 6, "Found file in tar: %s (%d bytes, %d offset)", name, skip, pos);
 
				DEBUG(misc, 6, "Found file in tar: %s (" PRINTF_SIZE " bytes, " PRINTF_SIZE " offset)", name, skip, pos);
 
				if (_tar_filelist.insert(TarFileList::value_type(name, entry)).second) num++;
 

	
 
				break;
 
@@ -702,7 +702,7 @@ bool TarListAddFile(const char *filename
 
		pos += skip;
 
	}
 

	
 
	DEBUG(misc, 1, "Found tar '%s' with %d new files", filename, num);
 
	DEBUG(misc, 1, "Found tar '%s' with " PRINTF_SIZE " new files", filename, num);
 
	fclose(f);
 

	
 
	/* Resolve file links and store directory links.
src/gamelog.cpp
Show inline comments
 
@@ -85,6 +85,8 @@ enum {
 

	
 
static int _dbgofs = 0; ///< offset in current output buffer
 

	
 
static void AddDebugText(char *buf, const char *s, ...) WARN_FORMAT(2, 3);
 

	
 
static void AddDebugText(char *buf, const char *s, ...)
 
{
 
	if (GAMELOG_BUF_LEN <= _dbgofs) return;
 
@@ -277,7 +279,7 @@ static int _gamelog_print_level = 0; ///
 

	
 
static void GamelogPrintDebugProc(const char *s)
 
{
 
	DEBUG(gamelog, _gamelog_print_level, s);
 
	DEBUG(gamelog, _gamelog_print_level, "%s", s);
 
}
 

	
 

	
src/gfxinit.cpp
Show inline comments
 
@@ -250,7 +250,7 @@ void CheckExternalFiles()
 
		add_pos += seprintf(add_pos, last, "Your 'sample.cat' file is corrupted or missing! You can find 'sample.cat' on your Transport Tycoon Deluxe CD-ROM.\n");
 
	}
 

	
 
	if (add_pos != error_msg) ShowInfoF(error_msg);
 
	if (add_pos != error_msg) ShowInfoF("%s", error_msg);
 
}
 

	
 

	
src/network/network_command.cpp
Show inline comments
 
@@ -179,7 +179,7 @@ void NetworkClientSocket::Send_Command(P
 
	}
 

	
 
	if (callback == _callback_table_count) {
 
		DEBUG(net, 0, "Unknown callback. (Pointer: %p) No callback sent", callback);
 
		DEBUG(net, 0, "Unknown callback. (Pointer: %p) No callback sent", cp->callback);
 
		callback = 0; // _callback_table[0] == NULL
 
	}
 
	p->Send_uint8 (callback);
src/network/network_func.h
Show inline comments
 
@@ -74,7 +74,7 @@ void NetworkServerKickClient(ClientID cl
 
void NetworkServerBanIP(const char *banip);
 

	
 
void NetworkInitChatMessage();
 
void CDECL NetworkAddChatMessage(TextColour colour, uint8 duration, const char *message, ...);
 
void CDECL NetworkAddChatMessage(TextColour colour, uint8 duration, const char *message, ...) WARN_FORMAT(3, 4);
 
void NetworkUndrawChatMessage();
 
void NetworkChatMessageDailyLoop();
 

	
src/newgrf.cpp
Show inline comments
 
@@ -150,7 +150,7 @@ void CDECL grfmsg(int severity, const ch
 
static inline bool check_length(size_t real, size_t wanted, const char *str)
 
{
 
	if (real >= wanted) return true;
 
	grfmsg(0, "%s: Invalid pseudo sprite length %d (expected %d)!", str, real, wanted);
 
	grfmsg(0, "%s: Invalid pseudo sprite length " PRINTF_SIZE " (expected " PRINTF_SIZE ")!", str, real, wanted);
 
	return false;
 
}
 

	
 
@@ -4227,7 +4227,7 @@ static void GRFInfo(byte *buf, size_t le
 
	_cur_grfconfig->status = _cur_stage < GLS_RESERVE ? GCS_INITIALISED : GCS_ACTIVATED;
 

	
 
	/* Do swap the GRFID for displaying purposes since people expect that */
 
	DEBUG(grf, 1, "GRFInfo: Loaded GRFv%d set %08lX - %s (palette: %s)", version, BSWAP32(grfid), name, _cur_grfconfig->windows_paletted ? "Windows" : "DOS");
 
	DEBUG(grf, 1, "GRFInfo: Loaded GRFv%d set %08X - %s (palette: %s)", version, BSWAP32(grfid), name, _cur_grfconfig->windows_paletted ? "Windows" : "DOS");
 
}
 

	
 
/* Action 0x0A */
 
@@ -4404,7 +4404,7 @@ static void GRFComment(byte *buf, size_t
 

	
 
	size_t text_len = len - 1;
 
	const char *text = (const char*)(buf + 1);
 
	grfmsg(2, "GRFComment: %.*s", text_len, text);
 
	grfmsg(2, "GRFComment: %.*s", (int)text_len, text);
 
}
 

	
 
/* Action 0x0D (GLS_SAFETYSCAN) */
 
@@ -4946,7 +4946,7 @@ static void FeatureTownName(byte *buf, s
 
	if (!check_length(len, 1, "FeatureTownName: number of parts")) return;
 
	byte nb = grf_load_byte(&buf);
 
	len--;
 
	grfmsg(6, "FeatureTownName: %d parts", nb, nb);
 
	grfmsg(6, "FeatureTownName: %u parts", nb);
 

	
 
	townname->nbparts[id] = nb;
 
	townname->partlist[id] = CallocT<NamePartList>(nb);
src/newgrf.h
Show inline comments
 
@@ -129,7 +129,7 @@ void LoadNewGRFFile(GRFConfig *config, u
 
void LoadNewGRF(uint load_index, uint file_index);
 
void ReloadNewGRFData(); // in saveload/afterload.cpp
 

	
 
void CDECL grfmsg(int severity, const char *str, ...);
 
void CDECL grfmsg(int severity, const char *str, ...) WARN_FORMAT(2, 3);
 

	
 
bool HasGrfMiscBit(GrfMiscBit bit);
 
bool GetGlobalVariable(byte param, uint32 *value);
src/newgrf_engine.cpp
Show inline comments
 
@@ -803,7 +803,7 @@ static uint32 VehicleGetVariable(const R
 
		default: break;
 
	}
 

	
 
	DEBUG(grf, 1, "Unhandled vehicle property 0x%X, type 0x%X", variable, v->type);
 
	DEBUG(grf, 1, "Unhandled vehicle property 0x%X, type 0x%X", variable, (uint)v->type);
 

	
 
	*available = false;
 
	return UINT_MAX;
src/saveload/saveload.cpp
Show inline comments
 
@@ -1640,7 +1640,7 @@ static SaveOrLoadResult SaveFileToDisk(b
 
		if (_sl.excpt_uninit != NULL) _sl.excpt_uninit();
 

	
 
		/* Skip the "colour" character */
 
		DEBUG(sl, 0, GetSaveLoadErrorString() + 3);
 
		DEBUG(sl, 0, "%s", GetSaveLoadErrorString() + 3);
 

	
 
		if (threaded) {
 
			SetAsyncSaveFinish(SaveFileError);
 
@@ -1840,7 +1840,7 @@ SaveOrLoadResult SaveOrLoad(const char *
 
		if (_sl.excpt_uninit != NULL) _sl.excpt_uninit();
 

	
 
		/* Skip the "colour" character */
 
		DEBUG(sl, 0, GetSaveLoadErrorString() + 3);
 
		DEBUG(sl, 0, "%s", GetSaveLoadErrorString() + 3);
 

	
 
		/* A saver/loader exception!! reinitialize all variables to prevent crash! */
 
		return (mode == SL_LOAD) ? SL_REINIT : SL_ERROR;
src/spritecache.cpp
Show inline comments
 
@@ -52,7 +52,7 @@ static SpriteCache *AllocateSpriteCache(
 
		/* Add another 1024 items to the 'pool' */
 
		uint items = Align(index + 1, 1024);
 

	
 
		DEBUG(sprite, 4, "Increasing sprite cache to %d items (%d bytes)", items, items * sizeof(*_spritecache));
 
		DEBUG(sprite, 4, "Increasing sprite cache to %u items (" PRINTF_SIZE " bytes)", items, items * sizeof(*_spritecache));
 

	
 
		_spritecache = ReallocT(_spritecache, items);
 

	
 
@@ -333,7 +333,7 @@ void IncreaseSpriteLRU()
 
	if (_sprite_lru_counter > 16384) {
 
		SpriteID i;
 

	
 
		DEBUG(sprite, 3, "Fixing lru %d, inuse=%d", _sprite_lru_counter, GetSpriteCacheUsage());
 
		DEBUG(sprite, 3, "Fixing lru %u, inuse=" PRINTF_SIZE, _sprite_lru_counter, GetSpriteCacheUsage());
 

	
 
		for (i = 0; i != _spritecache_items; i++) {
 
			SpriteCache *sc = GetSpriteCache(i);
 
@@ -361,7 +361,7 @@ static void CompactSpriteCache()
 
{
 
	MemBlock *s;
 

	
 
	DEBUG(sprite, 3, "Compacting sprite cache, inuse=%d", GetSpriteCacheUsage());
 
	DEBUG(sprite, 3, "Compacting sprite cache, inuse=" PRINTF_SIZE, GetSpriteCacheUsage());
 

	
 
	for (s = _spritecache_ptr; s->size != 0;) {
 
		if (s->size & S_FREE_MASK) {
 
@@ -404,7 +404,7 @@ static void DeleteEntryFromSpriteCache()
 
	MemBlock *s;
 
	int cur_lru;
 

	
 
	DEBUG(sprite, 3, "DeleteEntryFromSpriteCache, inuse=%d", GetSpriteCacheUsage());
 
	DEBUG(sprite, 3, "DeleteEntryFromSpriteCache, inuse=" PRINTF_SIZE, GetSpriteCacheUsage());
 

	
 
	cur_lru = 0xffff;
 
	for (i = 0; i != _spritecache_items; i++) {
src/stdafx.h
Show inline comments
 
@@ -126,6 +126,9 @@
 
	#define CDECL
 
	#define __int64 long long
 
	#define GCC_PACK __attribute__((packed))
 
	/* Warn about functions using 'printf' format syntax. First argument determines which parameter
 
	 * is the format string, second argument is start of values passed to printf. */
 
	#define WARN_FORMAT(string, args) __attribute__ ((format (printf, string, args)))
 

	
 
	#if (__GNUC__ == 2)
 
		#undef VARARRAY_SIZE
 
@@ -138,6 +141,7 @@
 
	#define FORCEINLINE inline
 
	#define CDECL
 
	#define GCC_PACK
 
	#define WARN_FORMAT(string, args)
 
	#include <malloc.h>
 
#endif /* __WATCOMC__ */
 

	
 
@@ -177,6 +181,7 @@
 
	#pragma warning(disable: 6031)   // code analyzer: Return value ignored: 'ReadFile'
 
	#pragma warning(disable: 6255)   // code analyzer: _alloca indicates failure by raising a stack overflow exception. Consider using _malloca instead
 
	#pragma warning(disable: 6246)   // code analyzer: Local declaration of 'statspec' hides declaration of the same name in outer scope. For additional information, see previous declaration at ...
 
	#define WARN_FORMAT(string, args)
 

	
 
	#include <malloc.h> // alloca()
 
	#define NORETURN __declspec(noreturn)
 
@@ -187,7 +192,7 @@
 
		#define CDECL _cdecl
 
	#endif
 

	
 
	int CDECL snprintf(char *str, size_t size, const char *format, ...);
 
	int CDECL snprintf(char *str, size_t size, const char *format, ...) WARN_FORMAT(3, 4);
 
	#if defined(WINCE)
 
		int CDECL vsnprintf(char *str, size_t size, const char *format, va_list ap);
 
	#endif
 
@@ -224,7 +229,7 @@
 
		#define strncasecmp strnicmp
 
	#endif
 

	
 
	void SetExceptionString(const char *s, ...);
 
	void SetExceptionString(const char *s, ...) WARN_FORMAT(1, 2);
 

	
 
	#if defined(NDEBUG) && defined(WITH_ASSERT)
 
		#undef assert
 
@@ -272,6 +277,15 @@
 
	#define PATHSEPCHAR '/'
 
#endif
 

	
 
/* MSVCRT of course has to have a different syntax for long long *sigh* */
 
#if defined(_MSC_VER) || defined(__MINGW32__)
 
	#define OTTD_PRINTF64 "%I64d"
 
	#define PRINTF_SIZE "%Iu"
 
#else
 
	#define OTTD_PRINTF64 "%lld"
 
	#define PRINTF_SIZE "%zu"
 
#endif
 

	
 
typedef unsigned char byte;
 

	
 
/* This is already defined in unix, but not in QNX Neutrino (6.x)*/
 
@@ -346,8 +360,8 @@ assert_compile(sizeof(uint8)  == 1);
 
	#define CloseConnection OTTD_CloseConnection
 
#endif /* __APPLE__ */
 

	
 
void NORETURN CDECL usererror(const char *str, ...);
 
void NORETURN CDECL error(const char *str, ...);
 
void NORETURN CDECL usererror(const char *str, ...) WARN_FORMAT(1, 2);
 
void NORETURN CDECL error(const char *str, ...) WARN_FORMAT(1, 2);
 
#define NOT_REACHED() error("NOT_REACHED triggered at line %i of %s", __LINE__, __FILE__)
 

	
 
#if defined(MORPHOS) || defined(__NDS__) || defined(__DJGPP__)
src/strgen/strgen.cpp
Show inline comments
 
@@ -136,6 +136,8 @@ static LangString *HashFind(const char *
 
# define LINE_NUM_FMT ":%d"
 
#endif
 

	
 
static void CDECL strgen_warning(const char *s, ...) WARN_FORMAT(1, 2);
 

	
 
static void CDECL strgen_warning(const char *s, ...)
 
{
 
	char buf[1024];
 
@@ -147,6 +149,8 @@ static void CDECL strgen_warning(const c
 
	_warnings++;
 
}
 

	
 
static void CDECL strgen_error(const char *s, ...) WARN_FORMAT(1, 2);
 

	
 
static void CDECL strgen_error(const char *s, ...)
 
{
 
	char buf[1024];
 
@@ -463,7 +467,7 @@ static const CmdStruct *ParseCommandStri
 

	
 
	cmd = FindCmd(start, s - start - 1);
 
	if (cmd == NULL) {
 
		strgen_error("Undefined command '%.*s'", s - start - 1, start);
 
		strgen_error("Undefined command '%.*s'", (int)(s - start - 1), start);
 
		return NULL;
 
	}
 

	
 
@@ -600,7 +604,7 @@ static void ExtractCommandString(ParsedC
 

	
 
			p->cmd[argidx++] = ar;
 
		} else if (!(ar->flags & C_DONTCOUNT)) { // Ignore some of them
 
			if (p->np >= lengthof(p->pairs)) error("too many commands in string, max %d", lengthof(p->pairs));
 
			if (p->np >= lengthof(p->pairs)) error("too many commands in string, max " PRINTF_SIZE, lengthof(p->pairs));
 
			p->pairs[p->np].a = ar;
 
			p->pairs[p->np].v = param[0] != '\0' ? strdup(param) : "";
 
			p->np++;
 
@@ -734,7 +738,7 @@ static void HandleString(char *str, bool
 

	
 
		if (ent == NULL) {
 
			if (_strings[_next_string_id]) {
 
				strgen_error("String ID 0x%X for '%s' already in use by '%s'", ent, str, _strings[_next_string_id]->name);
 
				strgen_error("String ID 0x%X for '%s' already in use by '%s'", _next_string_id, str, _strings[_next_string_id]->name);
 
				return;
 
			}
 

	
src/string_func.h
Show inline comments
 
@@ -89,9 +89,9 @@ char *strecat(char *dst, const char *src
 
 */
 
char *strecpy(char *dst, const char *src, const char *last);
 

	
 
int CDECL seprintf(char *str, const char *last, const char *format, ...);
 
int CDECL seprintf(char *str, const char *last, const char *format, ...) WARN_FORMAT(3, 4);
 

	
 
char *CDECL str_fmt(const char *str, ...);
 
char *CDECL str_fmt(const char *str, ...) WARN_FORMAT(1, 2);
 

	
 
/**
 
 * Scans the string for valid characters and if it finds invalid ones,
src/win32.cpp
Show inline comments
 
@@ -1082,13 +1082,13 @@ void DetermineBasePaths(const char *exe)
 
	_searchpaths[SP_WORKING_DIR] = strdup(tmp);
 

	
 
	if (!GetModuleFileName(NULL, path, lengthof(path))) {
 
		DEBUG(misc, 0, "GetModuleFileName failed (%d)\n", GetLastError());
 
		DEBUG(misc, 0, "GetModuleFileName failed (%lu)\n", GetLastError());
 
		_searchpaths[SP_BINARY_DIR] = NULL;
 
	} else {
 
		TCHAR exec_dir[MAX_PATH];
 
		_tcsncpy(path, MB_TO_WIDE_BUFFER(exe, path, lengthof(path)), lengthof(path));
 
		if (!GetFullPathName(path, lengthof(exec_dir), exec_dir, NULL)) {
 
			DEBUG(misc, 0, "GetFullPathName failed (%d)\n", GetLastError());
 
			DEBUG(misc, 0, "GetFullPathName failed (%lu)\n", GetLastError());
 
			_searchpaths[SP_BINARY_DIR] = NULL;
 
		} else {
 
			strecpy(tmp, WIDE_TO_MB_BUFFER(exec_dir, tmp, lengthof(tmp)), lastof(tmp));
 
@@ -1281,7 +1281,7 @@ char *convert_from_fs(const wchar_t *nam
 
{
 
	int len = WideCharToMultiByte(CP_UTF8, 0, name, -1, utf8_buf, (int)buflen, NULL, NULL);
 
	if (len == 0) {
 
		DEBUG(misc, 0, "[utf8] W2M error converting wide-string. Errno %d", GetLastError());
 
		DEBUG(misc, 0, "[utf8] W2M error converting wide-string. Errno %lu", GetLastError());
 
		utf8_buf[0] = '\0';
 
	}
 

	
 
@@ -1300,7 +1300,7 @@ wchar_t *convert_to_fs(const char *name,
 
{
 
	int len = MultiByteToWideChar(CP_UTF8, 0, name, -1, utf16_buf, (int)buflen);
 
	if (len == 0) {
 
		DEBUG(misc, 0, "[utf8] M2W error converting '%s'. Errno %d", name, GetLastError());
 
		DEBUG(misc, 0, "[utf8] M2W error converting '%s'. Errno %lu", name, GetLastError());
 
		utf16_buf[0] = '\0';
 
	}
 

	
src/yapf/yapf_base.hpp
Show inline comments
 
@@ -155,10 +155,10 @@ public:
 
				int cost = bDestFound ? m_pBestDestNode->m_cost : -1;
 
				int dist = bDestFound ? m_pBestDestNode->m_estimate - m_pBestDestNode->m_cost : -1;
 

	
 
				DEBUG(yapf, 3, "[YAPF%c]%c%4d- %d us - %d rounds - %d open - %d closed - CHR %4.1f%% - c%d(sc%d, ts%d, o%d) -- ",
 
				  ttc, bDestFound ? '-' : '!', veh_idx, t, m_num_steps, m_nodes.OpenCount(), m_nodes.ClosedCount(),
 
				  cache_hit_ratio, cost, dist, m_perf_cost.Get(1000000), m_perf_slope_cost.Get(1000000),
 
				  m_perf_ts_cost.Get(1000000), m_perf_other_cost.Get(1000000)
 
				DEBUG(yapf, 3, "[YAPF%c]%c%4d- %d us - %d rounds - %d open - %d closed - CHR %4.1f%% - C %d D %d - c%d(sc%d, ts%d, o%d) -- ",
 
					ttc, bDestFound ? '-' : '!', veh_idx, t, m_num_steps, m_nodes.OpenCount(), m_nodes.ClosedCount(),
 
					cache_hit_ratio, cost, dist, m_perf_cost.Get(1000000), m_perf_slope_cost.Get(1000000),
 
					m_perf_ts_cost.Get(1000000), m_perf_other_cost.Get(1000000)
 
				);
 
			}
 
		}
0 comments (0 inline, 0 general)