- Added the C99 printf size specifiers 't' (ptrdiff_t) and 'z' (size_t) to

FString::Format() so that I can fix all the problem printf strings that a
  64-bit GCC compile finds.



SVN r968 (trunk)
This commit is contained in:
Randy Heit 2008-05-14 03:39:30 +00:00
parent 99f55e8b8f
commit a0d5463b49
22 changed files with 85 additions and 42 deletions

View file

@ -5,6 +5,15 @@ CXX ?= g++
CC ?= gcc CC ?= gcc
NASM ?= nasm NASM ?= nasm
CCDV = @./ccdv CCDV = @./ccdv
ifndef X64
ifeq (x86_64,$(shell uname -m))
X64=64
else
X64=
endif
endif
ifdef DEBUG ifdef DEBUG
CFLAGS ?= -pipe -Wall -Wno-unused -fno-strict-aliasing CFLAGS ?= -pipe -Wall -Wno-unused -fno-strict-aliasing
else else
@ -17,7 +26,7 @@ endif
#endif #endif
CFLAGS += -MMD -DHAVE_FILELENGTH -D__forceinline=inline `sdl-config --cflags` `pkg-config gtk+-2.0 --cflags` CFLAGS += -MMD -DHAVE_FILELENGTH -D__forceinline=inline `sdl-config --cflags` `pkg-config gtk+-2.0 --cflags`
CFLAGS += -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -DNEED_STRUPR CFLAGS += -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -DNEED_STRUPR
LDFLAGS += -lz -ljpeg `sdl-config --libs` `pkg-config gtk+-2.0 --libs` $(FMOD_PREFIX)/lib/libfmodex.so LDFLAGS += -lz -ljpeg `sdl-config --libs` `pkg-config gtk+-2.0 --libs` $(FMOD_PREFIX)/lib/libfmodex${X64}.so
NASMFLAGS += -f elf -DM_TARGET_LINUX NASMFLAGS += -f elf -DM_TARGET_LINUX
SRCDIRS = src/ $(addprefix src/,g_doom/ g_heretic/ g_hexen/ g_raven/ g_shared/ g_strife/ oplsynth/ sound/ sdl/ textures/ thingdef/ xlat/ timidity/) SRCDIRS = src/ $(addprefix src/,g_doom/ g_heretic/ g_hexen/ g_raven/ g_shared/ g_strife/ oplsynth/ sound/ sdl/ textures/ thingdef/ xlat/ timidity/)
@ -31,6 +40,9 @@ DEBUGOBJ ?= debugobj
CPPSRCS = $(wildcard $(addsuffix *.cpp,$(SRCDIRS))) CPPSRCS = $(wildcard $(addsuffix *.cpp,$(SRCDIRS)))
CSRCS = $(filter-out src/xlat/xlat_parser.c, $(wildcard $(addsuffix *.c,$(SRCDIRS)))) CSRCS = $(filter-out src/xlat/xlat_parser.c, $(wildcard $(addsuffix *.c,$(SRCDIRS))))
ifdef X64
NOASM=1
endif
ifdef NOASM ifdef NOASM
CFLAGS += -DNOASM CFLAGS += -DNOASM
else else

View file

@ -1,3 +1,8 @@
May 13, 2008
- Added the C99 printf size specifiers 't' (ptrdiff_t) and 'z' (size_t) to
FString::Format() so that I can fix all the problem printf strings that a
64-bit GCC compile finds.
May 12, 2008 (Changes by Graf Zahl) May 12, 2008 (Changes by Graf Zahl)
- Added Skulltag's PUFFGETSOWNER flag. - Added Skulltag's PUFFGETSOWNER flag.
- Fixed: Parsing sector special bit masks must be done backwards so that later - Fixed: Parsing sector special bit masks must be done backwards so that later
@ -272,7 +277,7 @@ April 15, 2008 (Changes by Graf Zahl)
check being done manually. check being done manually.
April 14, 2008 (Changes by Graf Zahl) April 14, 2008 (Changes by Graf Zahl)
- Added rotation 90° angles only) and mirroring to the Multipatch texture - Added rotation 90<EFBFBD> angles only) and mirroring to the Multipatch texture
composition code. composition code.
- Fixed: The game crashed when a level was ended while a player was morphed - Fixed: The game crashed when a level was ended while a player was morphed
by a powerup. by a powerup.
@ -5476,7 +5481,7 @@ April 22, 2006 (Changes by Graf Zahl)
- Fixed the issues with .96x's railgun code and added it to the current - Fixed the issues with .96x's railgun code and added it to the current
version. version.
- Fixed: Setting of the friendly Minotaur's angle was inconsistent and - Fixed: Setting of the friendly Minotaur's angle was inconsistent and
could cause it to move backwards in a féw situation. could cause it to move backwards in a f<EFBFBD>w situation.
- Fixed: The minotaur did checks for type by checking for the MF_FRIENDLY - Fixed: The minotaur did checks for type by checking for the MF_FRIENDLY
flag, not by checking for the actor class. That made it impossible to flag, not by checking for the actor class. That made it impossible to
spawn friendly 'normal' minotaurs. spawn friendly 'normal' minotaurs.
@ -16442,7 +16447,7 @@ September 12, 1998
September 4, 1998 September 4, 1998
- Added weapnext and weapprev commands courtesy of - Added weapnext and weapprev commands courtesy of
Papst Johannes Jörg IV. [which were later completely Papst Johannes J<EFBFBD>rg IV. [which were later completely
rewritten by me] rewritten by me]
- Add support for suspending and resuming scripts (easy when - Add support for suspending and resuming scripts (easy when
you know you can only have one copy running at a time). you know you can only have one copy running at a time).

View file

@ -644,7 +644,7 @@ ADD_STAT(gc)
" Sweep ", " Sweep ",
"Finalize " }; "Finalize " };
FString out; FString out;
out.Format("[%s] Alloc:%6uK Thresh:%6uK Est:%6uK Steps: %d", out.Format("[%s] Alloc:%6zuK Thresh:%6zuK Est:%6zuK Steps: %d",
StateStrings[GC::State], StateStrings[GC::State],
(GC::AllocBytes + 1023) >> 10, (GC::AllocBytes + 1023) >> 10,
(GC::Threshold + 1023) >> 10, (GC::Threshold + 1023) >> 10,
@ -652,7 +652,7 @@ ADD_STAT(gc)
GC::StepCount); GC::StepCount);
if (GC::State != GC::GCS_Pause) if (GC::State != GC::GCS_Pause)
{ {
out.AppendFormat(" %uK", (GC::Dept + 1023) >> 10); out.AppendFormat(" %zuK", (GC::Dept + 1023) >> 10);
} }
return out; return out;
} }

View file

@ -961,7 +961,7 @@ void F_BunnyScroll (void)
laststage = stage; laststage = stage;
} }
sprintf (name, "END%i", stage); sprintf (name, "END%d", (int)stage);
screen->DrawTexture (TexMan(name), (320-13*8)/2, (200-8*8)/2, DTA_320x200, true, TAG_DONE); screen->DrawTexture (TexMan(name), (320-13*8)/2, (200-8*8)/2, DTA_320x200, true, TAG_DONE);
} }
} }

View file

@ -128,7 +128,7 @@ void ASkyPicker::PostBeginPlay ()
if (box == NULL && args[0] != 0) if (box == NULL && args[0] != 0)
{ {
Printf ("Can't find SkyViewpoint %d for sector %d\n", Printf ("Can't find SkyViewpoint %d for sector %td\n",
args[0], Sector - sectors); args[0], Sector - sectors);
} }
else else

View file

@ -851,7 +851,7 @@ CCMD (addslot)
if (!LocalWeapons.Slots[slot].AddWeapon (argv[2])) if (!LocalWeapons.Slots[slot].AddWeapon (argv[2]))
{ {
Printf ("Could not add %s to slot %d\n", argv[2], slot); Printf ("Could not add %s to slot %zu\n", argv[2], slot);
} }
} }

View file

@ -50,7 +50,7 @@ void *M_Malloc(size_t size)
void *block = malloc(size); void *block = malloc(size);
if (block == NULL) if (block == NULL)
I_FatalError("Could not malloc %u bytes", size); I_FatalError("Could not malloc %zu bytes", size);
GC::AllocBytes += _msize(block); GC::AllocBytes += _msize(block);
return block; return block;
@ -65,7 +65,7 @@ void *M_Realloc(void *memblock, size_t size)
void *block = realloc(memblock, size); void *block = realloc(memblock, size);
if (block == NULL) if (block == NULL)
{ {
I_FatalError("Could not realloc %u bytes", size); I_FatalError("Could not realloc %zu bytes", size);
} }
GC::AllocBytes += _msize(block); GC::AllocBytes += _msize(block);
return block; return block;
@ -80,7 +80,7 @@ void *M_Malloc_Dbg(size_t size, const char *file, int lineno)
void *block = _malloc_dbg(size, _NORMAL_BLOCK, file, lineno); void *block = _malloc_dbg(size, _NORMAL_BLOCK, file, lineno);
if (block == NULL) if (block == NULL)
I_FatalError("Could not malloc %u bytes", size); I_FatalError("Could not malloc %zu bytes", size);
GC::AllocBytes += _msize(block); GC::AllocBytes += _msize(block);
return block; return block;
@ -95,7 +95,7 @@ void *M_Realloc_Dbg(void *memblock, size_t size, const char *file, int lineno)
void *block = _realloc_dbg(memblock, size, _NORMAL_BLOCK, file, lineno); void *block = _realloc_dbg(memblock, size, _NORMAL_BLOCK, file, lineno);
if (block == NULL) if (block == NULL)
{ {
I_FatalError("Could not realloc %u bytes", size); I_FatalError("Could not realloc %zu bytes", size);
} }
GC::AllocBytes += _msize(block); GC::AllocBytes += _msize(block);
return block; return block;

View file

@ -751,7 +751,7 @@ void FNodeBuilder::SplitSegs (DWORD set, node_t &node, DWORD splitseg, DWORD &ou
if (seg->loopnum) if (seg->loopnum)
{ {
Printf (" Split seg %u (%d,%d)-(%d,%d) of sector %d in loop %d\n", Printf (" Split seg %u (%d,%d)-(%d,%d) of sector %td in loop %d\n",
set, set,
Vertices[seg->v1].x>>16, Vertices[seg->v1].y>>16, Vertices[seg->v1].x>>16, Vertices[seg->v1].y>>16,
Vertices[seg->v2].x>>16, Vertices[seg->v2].y>>16, Vertices[seg->v2].x>>16, Vertices[seg->v2].y>>16,
@ -991,7 +991,7 @@ void FNodeBuilder::PrintSet (int l, DWORD set)
Printf ("set %d:\n", l); Printf ("set %d:\n", l);
for (; set != DWORD_MAX; set = Segs[set].next) for (; set != DWORD_MAX; set = Segs[set].next)
{ {
Printf ("\t%u(%d):%d(%d,%d)-%d(%d,%d) ", set, Segs[set].frontsector-sectors, Printf ("\t%u(%td):%d(%d,%d)-%d(%d,%d) ", set, Segs[set].frontsector-sectors,
Segs[set].v1, Segs[set].v1,
Vertices[Segs[set].v1].x>>16, Vertices[Segs[set].v1].y>>16, Vertices[Segs[set].v1].x>>16, Vertices[Segs[set].v1].y>>16,
Segs[set].v2, Segs[set].v2,

View file

@ -522,7 +522,7 @@ sector_t *AActor::LinkToWorldForMapThing ()
if (distance < radius) if (distance < radius)
{ {
DPrintf ("%s at (%d,%d) lies on %s line %d, distance = %f\n", DPrintf ("%s at (%d,%d) lies on %s line %td, distance = %f\n",
this->GetClass()->TypeName.GetChars(), x>>FRACBITS, y>>FRACBITS, this->GetClass()->TypeName.GetChars(), x>>FRACBITS, y>>FRACBITS,
ldef->dx == 0? "vertical" : ldef->dy == 0? "horizontal" : "diagonal", ldef->dx == 0? "vertical" : ldef->dy == 0? "horizontal" : "diagonal",
ldef-lines, FIXED2FLOAT(distance)); ldef-lines, FIXED2FLOAT(distance));

View file

@ -499,7 +499,7 @@ int AActor::GetTics(FState * newstate)
bool AActor::SetState (FState *newstate) bool AActor::SetState (FState *newstate)
{ {
if (debugfile && player && (player->cheats & CF_PREDICTING)) if (debugfile && player && (player->cheats & CF_PREDICTING))
fprintf (debugfile, "for pl %d: SetState while predicting!\n", player-players); fprintf (debugfile, "for pl %td: SetState while predicting!\n", player-players);
do do
{ {
if (newstate == NULL) if (newstate == NULL)
@ -3096,7 +3096,7 @@ bool AActor::UpdateWaterLevel (fixed_t oldz, bool dosplash)
} }
// some additional checks to make deep sectors à la Boom splash without setting // some additional checks to make deep sectors <EFBFBD> la Boom splash without setting
// the water flags. // the water flags.
if (boomwaterlevel == 0 && waterlevel != 0 && dosplash) P_HitWater(this, Sector, fh); if (boomwaterlevel == 0 && waterlevel != 0 && dosplash) P_HitWater(this, Sector, fh);
boomwaterlevel=waterlevel; boomwaterlevel=waterlevel;

View file

@ -1282,7 +1282,7 @@ void P_LoadNodes (MapData * map)
} }
else if (child >= numnodes) else if (child >= numnodes)
{ {
Printf ("BSP node %d references invalid node %d.\n" Printf ("BSP node %d references invalid node %td.\n"
"The BSP will be rebuilt.\n", i, (node_t *)no->children[j] - nodes); "The BSP will be rebuilt.\n", i, (node_t *)no->children[j] - nodes);
ForceNodeBuild = true; ForceNodeBuild = true;
delete[] nodes; delete[] nodes;

View file

@ -542,7 +542,7 @@ struct UDMFParser
if (v1i >= numvertexes || v2i >= numvertexes || v1i < 0 || v2i < 0) if (v1i >= numvertexes || v2i >= numvertexes || v1i < 0 || v2i < 0)
{ {
I_Error ("Line %d has invalid vertices: %d and/or %d.\nThe map only contains %d vertices.", i+skipped, v1i, v2i, numvertexes); I_Error ("Line %d has invalid vertices: %zd and/or %zd.\nThe map only contains %d vertices.", i+skipped, v1i, v2i, numvertexes);
} }
else if (v1i == v2i || else if (v1i == v2i ||
(vertexes[v1i].x == vertexes[v2i].x && vertexes[v1i].y == vertexes[v2i].y)) (vertexes[v1i].x == vertexes[v2i].x && vertexes[v1i].y == vertexes[v2i].y))

View file

@ -1639,13 +1639,13 @@ void P_MovePlayer (player_t *player)
if (debugfile) if (debugfile)
{ {
fprintf (debugfile, "move player for pl %d%c: (%d,%d,%d) (%d,%d) %d %d w%d [", player-players, fprintf (debugfile, "move player for pl %d%c: (%d,%d,%d) (%d,%d) %d %d w%d [", int(player-players),
player->cheats&CF_PREDICTING?'p':' ', player->cheats&CF_PREDICTING?'p':' ',
player->mo->x, player->mo->y, player->mo->z,forwardmove, sidemove, movefactor, friction, player->mo->waterlevel); player->mo->x, player->mo->y, player->mo->z,forwardmove, sidemove, movefactor, friction, player->mo->waterlevel);
msecnode_t *n = player->mo->touching_sectorlist; msecnode_t *n = player->mo->touching_sectorlist;
while (n != NULL) while (n != NULL)
{ {
fprintf (debugfile, "%d ", n->m_sector-sectors); fprintf (debugfile, "%td ", n->m_sector-sectors);
n = n->m_tnext; n = n->m_tnext;
} }
fprintf (debugfile, "]\n"); fprintf (debugfile, "]\n");
@ -1918,12 +1918,12 @@ void P_PlayerThink (player_t *player)
if (player->mo == NULL) if (player->mo == NULL)
{ {
I_Error ("No player %d start\n", player - players + 1); I_Error ("No player %td start\n", player - players + 1);
} }
if (debugfile && !(player->cheats & CF_PREDICTING)) if (debugfile && !(player->cheats & CF_PREDICTING))
{ {
fprintf (debugfile, "tic %d for pl %d: (%d, %d, %d, %u) b:%02x p:%d y:%d f:%d s:%d u:%d\n", fprintf (debugfile, "tic %d for pl %td: (%d, %d, %d, %u) b:%02x p:%d y:%d f:%d s:%d u:%d\n",
gametic, player-players, player->mo->x, player->mo->y, player->mo->z, gametic, player-players, player->mo->x, player->mo->y, player->mo->z,
player->mo->angle>>ANGLETOFINESHIFT, player->cmd.ucmd.buttons, player->mo->angle>>ANGLETOFINESHIFT, player->cmd.ucmd.buttons,
player->cmd.ucmd.pitch, player->cmd.ucmd.yaw, player->cmd.ucmd.forwardmove, player->cmd.ucmd.pitch, player->cmd.ucmd.yaw, player->cmd.ucmd.forwardmove,

View file

@ -1048,7 +1048,7 @@ void R_Subsector (subsector_t *sub)
#ifdef RANGECHECK #ifdef RANGECHECK
if (sub - subsectors >= (ptrdiff_t)numsubsectors) if (sub - subsectors >= (ptrdiff_t)numsubsectors)
I_Error ("R_Subsector: ss %i with numss = %i", sub - subsectors, numsubsectors); I_Error ("R_Subsector: ss %ti with numss = %i", sub - subsectors, numsubsectors);
#endif #endif
frontsector = sub->sector; frontsector = sub->sector;

View file

@ -1480,7 +1480,7 @@ void R_CheckDrawSegs ()
firstdrawseg = drawsegs + firstofs; firstdrawseg = drawsegs + firstofs;
ds_p = drawsegs + MaxDrawSegs; ds_p = drawsegs + MaxDrawSegs;
MaxDrawSegs = newdrawsegs; MaxDrawSegs = newdrawsegs;
DPrintf ("MaxDrawSegs increased to %d\n", MaxDrawSegs); DPrintf ("MaxDrawSegs increased to %zu\n", MaxDrawSegs);
} }
} }
@ -1498,7 +1498,7 @@ void R_CheckOpenings (size_t need)
maxopenings = maxopenings ? maxopenings*2 : 16384; maxopenings = maxopenings ? maxopenings*2 : 16384;
while (need > maxopenings); while (need > maxopenings);
openings = (short *)M_Realloc (openings, maxopenings * sizeof(*openings)); openings = (short *)M_Realloc (openings, maxopenings * sizeof(*openings));
DPrintf ("MaxOpenings increased to %u\n", maxopenings); DPrintf ("MaxOpenings increased to %zu\n", maxopenings);
} }
} }

View file

@ -467,7 +467,7 @@ void R_InitSkins (void)
strncpy (key, sc.String, sizeof(key)-1); strncpy (key, sc.String, sizeof(key)-1);
if (!sc.GetString() || sc.String[0] != '=') if (!sc.GetString() || sc.String[0] != '=')
{ {
Printf (PRINT_BOLD, "Bad format for skin %d: %s\n", i, key); Printf (PRINT_BOLD, "Bad format for skin %d: %s\n", (int)i, key);
break; break;
} }
sc.GetString (); sc.GetString ();
@ -478,7 +478,7 @@ void R_InitSkins (void)
{ {
if (stricmp (skins[i].name, skins[j].name) == 0) if (stricmp (skins[i].name, skins[j].name) == 0)
{ {
sprintf (skins[i].name, "skin%d", i); sprintf (skins[i].name, "skin%d", (int)i);
Printf (PRINT_BOLD, "Skin %s duplicated as %s\n", Printf (PRINT_BOLD, "Skin %s duplicated as %s\n",
skins[j].name, skins[i].name); skins[j].name, skins[i].name);
break; break;
@ -659,7 +659,7 @@ void R_InitSkins (void)
if (!remove) if (!remove)
{ {
if (skins[i].name[0] == 0) if (skins[i].name[0] == 0)
sprintf (skins[i].name, "skin%d", i); sprintf (skins[i].name, "skin%d", (int)i);
// Now collect the sprite frames for this skin. If the sprite name was not // Now collect the sprite frames for this skin. If the sprite name was not
// specified, use whatever immediately follows the specifier lump. // specified, use whatever immediately follows the specifier lump.
@ -710,7 +710,7 @@ void R_InitSkins (void)
if (spr == 0 && maxframe <= 0) if (spr == 0 && maxframe <= 0)
{ {
Printf (PRINT_BOLD, "Skin %s (#%d) has no frames. Removing.\n", skins[i].name, i); Printf (PRINT_BOLD, "Skin %s (#%d) has no frames. Removing.\n", skins[i].name, (int)i);
remove = true; remove = true;
break; break;
} }

View file

@ -602,7 +602,7 @@ bool FMODSoundRenderer::Init()
if (!ShowedBanner) if (!ShowedBanner)
{ {
Printf("FMOD Sound System, copyright © Firelight Technologies Pty, Ltd., 1994-2008.\n"); Printf("FMOD Sound System, copyright <EFBFBD> Firelight Technologies Pty, Ltd., 1994-2008.\n");
ShowedBanner = true; ShowedBanner = true;
} }
#ifdef _WIN32 #ifdef _WIN32
@ -1597,7 +1597,7 @@ void FMODSoundRenderer::LoadSound(sfxinfo_t *sfx)
{ {
if (sfx->data == NULL) if (sfx->data == NULL)
{ {
DPrintf("loading sound \"%s\" (%d)\n", sfx->name.GetChars(), sfx - &S_sfx[0]); DPrintf("Loading sound \"%s\" (%td)\n", sfx->name.GetChars(), sfx - &S_sfx[0]);
getsfx(sfx); getsfx(sfx);
} }
} }
@ -1614,7 +1614,7 @@ void FMODSoundRenderer::UnloadSound(sfxinfo_t *sfx)
{ {
((FMOD::Sound *)sfx->data)->release(); ((FMOD::Sound *)sfx->data)->release();
sfx->data = NULL; sfx->data = NULL;
DPrintf("Unloaded sound \"%s\" (%d)\n", sfx->name.GetChars(), sfx - &S_sfx[0]); DPrintf("Unloaded sound \"%s\" (%td)\n", sfx->name.GetChars(), sfx - &S_sfx[0]);
} }
} }

View file

@ -58,9 +58,9 @@ inline cycle_t GetClockCycle ()
#endif #endif
} }
#elif defined(__GNUG__) && defined(__i386__) #elif defined(__GNUC__) && (defined(__i386__) || defined(__amd64__))
typedef QWORD cycle_t; typedef unsigned long long cycle_t;
inline cycle_t GetClockCycle() inline cycle_t GetClockCycle()
{ {
@ -78,7 +78,7 @@ inline cycle_t GetClockCycle()
#else #else
typedef DWORD cycle_t; typedef QWORD cycle_t;
inline cycle_t GetClockCycle () inline cycle_t GetClockCycle ()
{ {

View file

@ -120,7 +120,7 @@ void *safe_malloc(size_t count)
void *p; void *p;
if (count > (1 << 21)) if (count > (1 << 21))
{ {
I_Error("Timidity: Tried allocating %u bytes. This must be a bug.", count); I_Error("Timidity: Tried allocating %zu bytes. This must be a bug.", count);
} }
else if ((p = malloc(count))) else if ((p = malloc(count)))
{ {
@ -128,7 +128,7 @@ void *safe_malloc(size_t count)
} }
else else
{ {
I_Error("Timidity: Couldn't malloc %u bytes.", count); I_Error("Timidity: Couldn't malloc %zu bytes.", count);
} }
return 0; // Unreachable. return 0; // Unreachable.
} }

View file

@ -278,7 +278,7 @@ static bool check_release(double RateMul, double sec)
bool SF2Envelope::Update(Voice *v) bool SF2Envelope::Update(Voice *v)
{ {
double sec; double sec;
double newvolume; double newvolume = 0;
switch (stage) switch (stage)
{ {

View file

@ -218,6 +218,16 @@ namespace StringFormat
flags |= F_BIGI; flags |= F_BIGI;
} }
} }
else if (*c == 't')
{
flags |= F_PTRDIFF;
++c;
}
else if (*c == 'z')
{
flags |= F_SIZE;
++c;
}
base = c+1; base = c+1;
@ -278,7 +288,11 @@ namespace StringFormat
} }
else else
{ {
if (size == F_HALFHALF) if (size == 0)
{
intarg = va_arg (arglist, int);
}
else if (size == F_HALFHALF)
{ {
intarg = va_arg (arglist, int); intarg = va_arg (arglist, int);
intarg = (signed char)intarg; intarg = (signed char)intarg;
@ -302,6 +316,16 @@ namespace StringFormat
{ {
int64arg = va_arg (arglist, int64_t); int64arg = va_arg (arglist, int64_t);
} }
else if (size == F_PTRDIFF)
{
if (sizeof(ptrdiff_t) == sizeof(int)) intarg = va_arg (arglist, int);
else { int64arg = va_arg (arglist, int64_t); size = F_LONGLONG; }
}
else if (size == F_SIZE)
{
if (sizeof(size_t) == sizeof(int)) intarg = va_arg (arglist, int);
else { int64arg = va_arg (arglist, int64_t); size = F_LONGLONG; }
}
else else
{ {
intarg = va_arg (arglist, int); intarg = va_arg (arglist, int);

View file

@ -284,7 +284,9 @@ namespace StringFormat
F_HALF = 0x2000, // h F_HALF = 0x2000, // h
F_LONG = 0x3000, // l F_LONG = 0x3000, // l
F_LONGLONG = 0x4000, // ll or I64 F_LONGLONG = 0x4000, // ll or I64
F_BIGI = 0x5000 // I F_BIGI = 0x5000, // I
F_PTRDIFF = 0x6000, // t
F_SIZE = 0x7000, // z
}; };
typedef int (*OutputFunc)(void *data, const char *str, int len); typedef int (*OutputFunc)(void *data, const char *str, int len);