MCPcopy Create free account
hub / github.com/OSGeo/gdal / CPLvsnprintf_get_end_of_formatting

Function CPLvsnprintf_get_end_of_formatting

port/cpl_string.cpp:1054–1104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1052/************************************************************************/
1053
1054static const char *CPLvsnprintf_get_end_of_formatting(const char *fmt)
1055{
1056 char ch = '\0';
1057 // Flag.
1058 for (; (ch = *fmt) != '\0'; ++fmt)
1059 {
1060 if (ch == '\'')
1061 continue; // Bad idea as this is locale specific.
1062 if (ch == '-' || ch == '+' || ch == ' ' || ch == '#' || ch == '0')
1063 continue;
1064 break;
1065 }
1066
1067 // Field width.
1068 for (; (ch = *fmt) != '\0'; ++fmt)
1069 {
1070 if (ch == '$')
1071 return nullptr; // Do not support this.
1072 if (*fmt >= '0' && *fmt <= '9')
1073 continue;
1074 break;
1075 }
1076
1077 // Precision.
1078 if (ch == '.')
1079 {
1080 ++fmt;
1081 for (; (ch = *fmt) != '\0'; ++fmt)
1082 {
1083 if (ch == '$')
1084 return nullptr; // Do not support this.
1085 if (*fmt >= '0' && *fmt <= '9')
1086 continue;
1087 break;
1088 }
1089 }
1090
1091 // Length modifier.
1092 for (; (ch = *fmt) != '\0'; ++fmt)
1093 {
1094 if (ch == 'h' || ch == 'l' || ch == 'j' || ch == 'z' || ch == 't' ||
1095 ch == 'L')
1096 continue;
1097 else if (ch == 'I' && fmt[1] == '6' && fmt[2] == '4')
1098 fmt += 2;
1099 else
1100 return fmt;
1101 }
1102
1103 return nullptr;
1104}
1105
1106/************************************************************************/
1107/* CPLvsnprintf() */

Callers 1

CPLvsnprintfFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected