Skip to content

Commit

Permalink
textlayout: declare variables when they are used
Browse files Browse the repository at this point in the history
Fixes various -Wunused warnings.
  • Loading branch information
MaxKellermann committed Oct 5, 2021
1 parent 66d3a17 commit 4173810
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 19 deletions.
27 changes: 10 additions & 17 deletions mapogcfilter.cpp
Expand Up @@ -2187,18 +2187,14 @@ char *FLTGetSQLExpression(FilterEncodingNode *psFilterNode, layerObj *lp)
/* TODO */
} else if (psFilterNode->eType == FILTER_NODE_TYPE_FEATUREID) {
#if defined(USE_WMS_SVR) || defined (USE_WFS_SVR) || defined (USE_WCS_SVR) || defined(USE_SOS_SVR)
const char *pszAttribute = NULL;
char szTmp[256];
char **tokens = NULL;
int nTokens = 0, i=0, bString=0;

if (psFilterNode->pszValue) {
pszAttribute = msOWSLookupMetadata(&(lp->metadata), "OFG", "featureid");
const char *pszAttribute = msOWSLookupMetadata(&(lp->metadata), "OFG", "featureid");
if (pszAttribute) {
tokens = msStringSplit(psFilterNode->pszValue,',', &nTokens);
bString = 0;
int nTokens = 0;
char **tokens = msStringSplit(psFilterNode->pszValue,',', &nTokens);
int bString = 0;
if (tokens && nTokens > 0) {
for (i=0; i<nTokens; i++) {
for (int i=0; i<nTokens; i++) {
char *pszEscapedStr = NULL;
const char* pszId = tokens[i];
const char* pszDot = strchr(pszId, '.');
Expand All @@ -2212,6 +2208,7 @@ char *FLTGetSQLExpression(FilterEncodingNode *psFilterNode, layerObj *lp)
bString = 1;

pszEscapedStr = msLayerEscapeSQLParam(lp, pszId);
char szTmp[256];
if (bString)
{
if( lp->connectiontype == MS_OGR || lp->connectiontype == MS_POSTGIS )
Expand Down Expand Up @@ -3103,17 +3100,12 @@ void FLTPreParseFilterForAliasAndGroup(FilterEncodingNode *psFilterNode,
mapObj *map, int i, const char *namespaces)
{
#if defined(USE_WMS_SVR) || defined (USE_WFS_SVR) || defined (USE_WCS_SVR) || defined(USE_SOS_SVR)
layerObj *lp=NULL;
char szTmp[256];
const char *pszFullName = NULL;
int layerWasOpened = MS_FALSE;

if (psFilterNode && map && i>=0 && i<map->numlayers) {
/*strip name spaces before hand*/
FLTStripNameSpacesFromPropertyName(psFilterNode);

lp = GET_LAYER(map, i);
layerWasOpened = msLayerIsOpen(lp);
layerObj *lp = GET_LAYER(map, i);
int layerWasOpened = msLayerIsOpen(lp);
if (msLayerOpen(lp) == MS_SUCCESS && msLayerGetItems(lp) == MS_SUCCESS) {

/* Remove group names from property names if using groupname/itemname syntax */
Expand All @@ -3125,8 +3117,9 @@ void FLTPreParseFilterForAliasAndGroup(FilterEncodingNode *psFilterNode,
for(i=0; i<lp->numitems; i++) {
if (!lp->items[i] || strlen(lp->items[i]) <= 0)
continue;
char szTmp[256];
snprintf(szTmp, sizeof(szTmp), "%s_alias", lp->items[i]);
pszFullName = msOWSLookupMetadata(&(lp->metadata), namespaces, szTmp);
const char *pszFullName = msOWSLookupMetadata(&(lp->metadata), namespaces, szTmp);
if (pszFullName) {
FLTReplacePropertyName(psFilterNode, pszFullName,
lp->items[i]);
Expand Down
2 changes: 1 addition & 1 deletion mapogcfiltercommon.cpp
Expand Up @@ -518,7 +518,6 @@ static std::string FLTGetFeatureIdCommonExpression(FilterEncodingNode *psFilterN
std::string expr;

#if defined(USE_WMS_SVR) || defined(USE_WFS_SVR) || defined(USE_WCS_SVR) || defined(USE_SOS_SVR)
bool bString= false;
if (psFilterNode->pszValue) {
const char* pszAttribute = msOWSLookupMetadata(&(lp->metadata), "OFG", "featureid");
if (pszAttribute) {
Expand All @@ -530,6 +529,7 @@ static std::string FLTGetFeatureIdCommonExpression(FilterEncodingNode *psFilterN
if( pszDot )
pszId = pszDot + 1;

bool bString = false;
if (i == 0) {
if(FLTIsNumeric(pszId) == MS_FALSE)
bString = true;
Expand Down
3 changes: 2 additions & 1 deletion textlayout.c
Expand Up @@ -732,7 +732,6 @@ int msLayoutTextSymbol(mapObj *map, textSymbolObj *ts, textPathObj *tgret) {


for(i=0;i<nruns;i++) {
unsigned int glyph_count;
if(!runs[i].face) continue;
peny = (1 - tgret->numlines + runs[i].line_number) * tgret->line_height;
if(peny != oldpeny) {
Expand Down Expand Up @@ -782,6 +781,8 @@ int msLayoutTextSymbol(mapObj *map, textSymbolObj *ts, textPathObj *tgret) {
hb_buffer_set_direction(buf, (runs[i].rtl%2) ? HB_DIRECTION_RTL :HB_DIRECTION_LTR);
hb_buffer_add_utf32(buf,glyphs.unicodes + runs[i].offset, runs[i].length, 0, runs[i].length);
hb_shape(font,buf,hbfeatures,2);

unsigned int glyph_count;
glyph_info = hb_buffer_get_glyph_infos(buf, &glyph_count);
glyph_pos = hb_buffer_get_glyph_positions(buf, &glyph_count);
alloc_glyphs += glyph_count;
Expand Down

0 comments on commit 4173810

Please sign in to comment.