Skip to content

Commit

Permalink
Fixed: Errors with string formatting
Browse files Browse the repository at this point in the history
With QString-based classes, sprintf() is not needed: just
use the arg() methods to replace any %1, %2, etc. markers.
arg() handles pretty much any type given to it, so casting
it also not necessary.

Also fixed other problems with variable initialization and
log message arguments.
  • Loading branch information
skyjake committed Aug 9, 2012
1 parent c0648b5 commit ef2a98e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion doomsday/engine/portable/src/resource/texture.cpp
Expand Up @@ -88,7 +88,7 @@ void de::Texture::setUserDataPointer(void* newUserData)
textureid_t textureId = Textures_Id(reinterpret_cast<struct texture_s*>(this));
LOG_AS("Texture::setUserDataPointer");
LOG_DEBUG("User data is already present for [%p id:%i], it will be replaced.")
<< (void*)this, int(textureId);
<< (void*)this << int(textureId);
}
userData = newUserData;
}
Expand Down
6 changes: 3 additions & 3 deletions doomsday/engine/portable/src/resource/textures.cpp
Expand Up @@ -507,7 +507,7 @@ texturenamespaceid_t Textures_ParseNamespace(const char* str)
{ TN_MODELREFLECTIONSKINS_NAME, sizeof(TN_MODELREFLECTIONSKINS_NAME)-1, TN_MODELREFLECTIONSKINS },
{ TN_LIGHTMAPS_NAME, sizeof(TN_LIGHTMAPS_NAME)-1, TN_LIGHTMAPS },
{ TN_FLAREMAPS_NAME, sizeof(TN_FLAREMAPS_NAME)-1, TN_FLAREMAPS },
{ NULL }
{ NULL, 0, TN_INVALID }
};

// Special case: zero-length string means "any namespace".
Expand Down Expand Up @@ -701,8 +701,8 @@ static void rebuildUniqueIdMap(texturenamespaceid_t namespaceId)
if(!tn->uniqueIdMap && tn->uniqueIdMapSize)
{
throw de::Error("Textures::rebuildUniqueIdMap",
de::String().sprintf("Failed on (re)allocation of %1 bytes resizing the map.")
.arg((unsigned long) sizeof *tn->uniqueIdMap * tn->uniqueIdMapSize));
de::String("Failed on (re)allocation of %1 bytes resizing the map.")
.arg(sizeof(*tn->uniqueIdMap) * tn->uniqueIdMapSize));
}

if(tn->uniqueIdMapSize)
Expand Down

0 comments on commit ef2a98e

Please sign in to comment.