Reduce the scope of variables
This commit is contained in:
parent
dc7eb5008b
commit
2d1e1fe6ef
@ -921,10 +921,9 @@ namespace Jzon
|
|||||||
std::string valueBuffer;
|
std::string valueBuffer;
|
||||||
bool saveBuffer;
|
bool saveBuffer;
|
||||||
|
|
||||||
char c = '\0';
|
|
||||||
for (; cursor < jsonSize; ++cursor)
|
for (; cursor < jsonSize; ++cursor)
|
||||||
{
|
{
|
||||||
c = json.at(cursor);
|
char c = json.at(cursor);
|
||||||
|
|
||||||
if (IsWhitespace(c))
|
if (IsWhitespace(c))
|
||||||
continue;
|
continue;
|
||||||
@ -1218,10 +1217,10 @@ namespace Jzon
|
|||||||
void Parser::jumpToCommentEnd()
|
void Parser::jumpToCommentEnd()
|
||||||
{
|
{
|
||||||
++cursor;
|
++cursor;
|
||||||
char c1 = '\0', c2 = '\0';
|
char c1 = '\0';
|
||||||
for (; cursor < jsonSize; ++cursor)
|
for (; cursor < jsonSize; ++cursor)
|
||||||
{
|
{
|
||||||
c2 = json.at(cursor);
|
char c2 = json.at(cursor);
|
||||||
|
|
||||||
if (c1 == '*' && c2 == '/')
|
if (c1 == '*' && c2 == '/')
|
||||||
break;
|
break;
|
||||||
@ -1239,10 +1238,10 @@ namespace Jzon
|
|||||||
|
|
||||||
++cursor;
|
++cursor;
|
||||||
|
|
||||||
char c1 = '\0', c2 = '\0';
|
char c1 = '\0';
|
||||||
for (; cursor < jsonSize; ++cursor)
|
for (; cursor < jsonSize; ++cursor)
|
||||||
{
|
{
|
||||||
c2 = json.at(cursor);
|
char c2 = json.at(cursor);
|
||||||
|
|
||||||
if (c1 != '\\' && c2 == '"')
|
if (c1 != '\\' && c2 == '"')
|
||||||
{
|
{
|
||||||
|
|||||||
@ -656,12 +656,14 @@ int readFile(const char* path,Options /* options */)
|
|||||||
FILE* f = fopen(path,"r");
|
FILE* f = fopen(path,"r");
|
||||||
int nResult = f ? typeFile : typeUnknown;
|
int nResult = f ? typeFile : typeUnknown;
|
||||||
if ( f ) {
|
if ( f ) {
|
||||||
const char* docs[] = { ".doc",".txt", NULL };
|
|
||||||
const char* code[] = { ".cpp",".h" ,".pl" ,".py" ,".pyc", NULL };
|
|
||||||
const char* ext = strstr(path,".");
|
const char* ext = strstr(path,".");
|
||||||
if ( ext ) {
|
if ( ext ) {
|
||||||
if ( sina(ext,docs) ) nResult = typeDoc;
|
const char* docs[] = { ".doc",".txt", NULL };
|
||||||
if ( sina(ext,code) ) nResult = typeCode;
|
const char* code[] = { ".cpp",".h" ,".pl" ,".py" ,".pyc", NULL };
|
||||||
|
if ( sina(ext,docs) )
|
||||||
|
nResult = typeDoc;
|
||||||
|
if ( sina(ext,code) )
|
||||||
|
nResult = typeCode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( f ) fclose(f) ;
|
if ( f ) fclose(f) ;
|
||||||
|
|||||||
@ -2049,16 +2049,21 @@ namespace Exiv2 {
|
|||||||
const ExifData* metadata)
|
const ExifData* metadata)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
long lensID = 0x1c;
|
|
||||||
long index = 0;
|
long index = 0;
|
||||||
|
|
||||||
std::string model = getKeyString("Exif.Image.Model" ,metadata);
|
std::string model = getKeyString("Exif.Image.Model" ,metadata);
|
||||||
std::string lens = getKeyString("Exif.Photo.LensModel",metadata);
|
std::string lens = getKeyString("Exif.Photo.LensModel",metadata);
|
||||||
|
|
||||||
if ( model == "SLT-A77V" && lens == "100mm F2.8 Macro" ) index=2;
|
if ( model == "SLT-A77V" && lens == "100mm F2.8 Macro" ) {
|
||||||
|
index=2;
|
||||||
|
}
|
||||||
|
|
||||||
if ( index > 0 ) return resolvedLens(os,lensID,index);
|
if ( index > 0 ) {
|
||||||
} catch (...) {}
|
const long lensID = 0x1c;
|
||||||
|
return resolvedLens(os,lensID,index);
|
||||||
|
}
|
||||||
|
} catch (...) {
|
||||||
|
}
|
||||||
return EXV_PRINT_TAG(minoltaSonyLensID)(os, value, metadata);
|
return EXV_PRINT_TAG(minoltaSonyLensID)(os, value, metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2066,16 +2071,22 @@ namespace Exiv2 {
|
|||||||
const ExifData* metadata)
|
const ExifData* metadata)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
long lensID = 0x29;
|
|
||||||
long index = 0;
|
long index = 0;
|
||||||
|
|
||||||
std::string model = getKeyString("Exif.Image.Model" ,metadata);
|
std::string model = getKeyString("Exif.Image.Model" ,metadata);
|
||||||
std::string lens = getKeyString("Exif.Photo.LensModel",metadata);
|
std::string lens = getKeyString("Exif.Photo.LensModel",metadata);
|
||||||
|
|
||||||
if ( model == "SLT-A77V" && lens == "DT 11-18mm F4.5-5.6" ) index=2;
|
if ( model == "SLT-A77V" && lens == "DT 11-18mm F4.5-5.6" ) {
|
||||||
|
index=2;
|
||||||
|
}
|
||||||
|
|
||||||
if ( index > 0 ) return resolvedLens(os,lensID,index);
|
if ( index > 0 ) {
|
||||||
} catch (...) {}
|
const long lensID = 0x29;
|
||||||
|
return resolvedLens(os,lensID,index);
|
||||||
|
}
|
||||||
|
} catch (...) {
|
||||||
|
|
||||||
|
}
|
||||||
return EXV_PRINT_TAG(minoltaSonyLensID)(os, value, metadata);
|
return EXV_PRINT_TAG(minoltaSonyLensID)(os, value, metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2083,7 +2094,6 @@ namespace Exiv2 {
|
|||||||
const ExifData* metadata)
|
const ExifData* metadata)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
long lensID = 0x34;
|
|
||||||
long index = 0;
|
long index = 0;
|
||||||
|
|
||||||
std::string model = getKeyString("Exif.Image.Model" ,metadata);
|
std::string model = getKeyString("Exif.Image.Model" ,metadata);
|
||||||
@ -2091,11 +2101,19 @@ namespace Exiv2 {
|
|||||||
long focalLength = getKeyLong ("Exif.Photo.FocalLength" ,metadata);
|
long focalLength = getKeyLong ("Exif.Photo.FocalLength" ,metadata);
|
||||||
std::string F2_8 = "760/256" ;
|
std::string F2_8 = "760/256" ;
|
||||||
|
|
||||||
if ( model == "SLT-A77V" && maxAperture == F2_8 ) index=4;
|
if ( model == "SLT-A77V" && maxAperture == F2_8 ) {
|
||||||
if ( model == "SLT-A77V" && inRange(focalLength,70,300) ) index=3;
|
index=4;
|
||||||
|
}
|
||||||
|
if ( model == "SLT-A77V" && inRange(focalLength,70,300) ) {
|
||||||
|
index=3;
|
||||||
|
}
|
||||||
|
|
||||||
if ( index > 0 ) return resolvedLens(os,lensID,index);
|
if ( index > 0 ) {
|
||||||
} catch (...) {}
|
const long lensID = 0x34;
|
||||||
|
return resolvedLens(os,lensID,index);
|
||||||
|
}
|
||||||
|
} catch (...) {
|
||||||
|
}
|
||||||
return EXV_PRINT_TAG(minoltaSonyLensID)(os, value, metadata);
|
return EXV_PRINT_TAG(minoltaSonyLensID)(os, value, metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2103,7 +2121,6 @@ namespace Exiv2 {
|
|||||||
const ExifData* metadata)
|
const ExifData* metadata)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
long lensID = 0x80;
|
|
||||||
long index = 0;
|
long index = 0;
|
||||||
|
|
||||||
std::string model = getKeyString("Exif.Image.Model" ,metadata);
|
std::string model = getKeyString("Exif.Image.Model" ,metadata);
|
||||||
@ -2111,9 +2128,14 @@ namespace Exiv2 {
|
|||||||
long focalLength = getKeyLong ("Exif.Photo.FocalLength" ,metadata);
|
long focalLength = getKeyLong ("Exif.Photo.FocalLength" ,metadata);
|
||||||
std::string F4 = "1024/256";
|
std::string F4 = "1024/256";
|
||||||
|
|
||||||
if ( model == "SLT-A77V" && maxAperture == F4 && inRange(focalLength,18,200) ) index=2;
|
if ( model == "SLT-A77V" && maxAperture == F4 && inRange(focalLength,18,200) ) {
|
||||||
|
index=2;
|
||||||
|
}
|
||||||
|
|
||||||
if ( index > 0 ) return resolvedLens(os,lensID,index);
|
if ( index > 0 ) {
|
||||||
|
const long lensID = 0x80;
|
||||||
|
return resolvedLens(os,lensID,index);
|
||||||
|
}
|
||||||
} catch (...) {}
|
} catch (...) {}
|
||||||
return EXV_PRINT_TAG(minoltaSonyLensID)(os, value, metadata);
|
return EXV_PRINT_TAG(minoltaSonyLensID)(os, value, metadata);
|
||||||
}
|
}
|
||||||
@ -2122,7 +2144,6 @@ namespace Exiv2 {
|
|||||||
const ExifData* metadata)
|
const ExifData* metadata)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
long lensID = 0xff;
|
|
||||||
long index = 0 ;
|
long index = 0 ;
|
||||||
|
|
||||||
std::string model = getKeyString("Exif.Image.Model" ,metadata);
|
std::string model = getKeyString("Exif.Image.Model" ,metadata);
|
||||||
@ -2130,10 +2151,16 @@ namespace Exiv2 {
|
|||||||
std::string maxAperture = getKeyString("Exif.Photo.MaxApertureValue" ,metadata);
|
std::string maxAperture = getKeyString("Exif.Photo.MaxApertureValue" ,metadata);
|
||||||
std::string F2_8 = "760/256" ;
|
std::string F2_8 = "760/256" ;
|
||||||
|
|
||||||
if ( model == "SLT-A77V" && maxAperture == F2_8 && inRange(focalLength,17,50) ) index = 1 ;
|
if ( model == "SLT-A77V" && maxAperture == F2_8 && inRange(focalLength,17,50) ) {
|
||||||
|
index = 1 ;
|
||||||
|
}
|
||||||
|
|
||||||
if ( index > 0 ) return resolvedLens(os,lensID,index);
|
if ( index > 0 ) {
|
||||||
} catch (...) {}
|
const long lensID = 0xff;
|
||||||
|
return resolvedLens(os,lensID,index);
|
||||||
|
}
|
||||||
|
} catch (...) {
|
||||||
|
}
|
||||||
return EXV_PRINT_TAG(minoltaSonyLensID)(os, value, metadata);
|
return EXV_PRINT_TAG(minoltaSonyLensID)(os, value, metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2141,7 +2168,6 @@ namespace Exiv2 {
|
|||||||
const ExifData* metadata)
|
const ExifData* metadata)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
long lensID = 0xffff;
|
|
||||||
long index = 1 ;
|
long index = 1 ;
|
||||||
|
|
||||||
// #1153
|
// #1153
|
||||||
@ -2170,7 +2196,10 @@ namespace Exiv2 {
|
|||||||
if ( inRange(focalRatio,145,155) ) index = 3 ;
|
if ( inRange(focalRatio,145,155) ) index = 3 ;
|
||||||
} catch (...) {}
|
} catch (...) {}
|
||||||
|
|
||||||
if ( index > 0 ) return resolvedLens(os,lensID,index);
|
if ( index > 0 ) {
|
||||||
|
const long lensID = 0xffff;
|
||||||
|
return resolvedLens(os,lensID,index);
|
||||||
|
}
|
||||||
} catch (...) {}
|
} catch (...) {}
|
||||||
|
|
||||||
return EXV_PRINT_TAG(minoltaSonyLensID)(os, value, metadata);
|
return EXV_PRINT_TAG(minoltaSonyLensID)(os, value, metadata);
|
||||||
|
|||||||
@ -1124,14 +1124,12 @@ namespace Exiv2 {
|
|||||||
|
|
||||||
if (value.count() == 2) {
|
if (value.count() == 2) {
|
||||||
long l1 = value.toLong(1);
|
long l1 = value.toLong(1);
|
||||||
long type;
|
|
||||||
long range;
|
|
||||||
os << " (";
|
os << " (";
|
||||||
if (l1 == 0) {
|
if (l1 == 0) {
|
||||||
os << _("No extended bracketing");
|
os << _("No extended bracketing");
|
||||||
} else {
|
} else {
|
||||||
type = l1 >> 8;
|
long type = l1 >> 8;
|
||||||
range = l1 & 0xff;
|
long range = l1 & 0xff;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 1:
|
case 1:
|
||||||
os << _("WB-BA");
|
os << _("WB-BA");
|
||||||
@ -1221,16 +1219,18 @@ namespace Exiv2 {
|
|||||||
const ExifData* metadata)
|
const ExifData* metadata)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
unsigned long lensID = 0x32c;
|
|
||||||
unsigned long index = 0;
|
unsigned long index = 0;
|
||||||
|
|
||||||
long focalLength = getKeyLong ("Exif.Photo.FocalLength",metadata);
|
long focalLength = getKeyLong ("Exif.Photo.FocalLength",metadata);
|
||||||
bool bFL10_20 = 10 <= focalLength && focalLength <= 20;
|
bool bFL10_20 = 10 <= focalLength && focalLength <= 20;
|
||||||
|
|
||||||
// std::cout << "model,focalLength = " << model << "," << focalLength << std::endl;
|
// std::cout << "model,focalLength = " << model << "," << focalLength << std::endl;
|
||||||
if ( bFL10_20 ) index = 1;
|
if ( bFL10_20 ) {
|
||||||
|
index = 1;
|
||||||
|
}
|
||||||
|
|
||||||
if ( index > 0 ) {
|
if ( index > 0 ) {
|
||||||
|
const unsigned long lensID = 0x32c;
|
||||||
const TagDetails* td = find(pentaxLensType, lensID);
|
const TagDetails* td = find(pentaxLensType, lensID);
|
||||||
os << exvGettext(td[index].label_);
|
os << exvGettext(td[index].label_);
|
||||||
return os;
|
return os;
|
||||||
@ -1247,7 +1247,6 @@ namespace Exiv2 {
|
|||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
unsigned long lensID = 0x3ff;
|
|
||||||
unsigned long index = 0;
|
unsigned long index = 0;
|
||||||
|
|
||||||
// http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Pentax.html#LensData
|
// http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Pentax.html#LensData
|
||||||
@ -1291,6 +1290,7 @@ namespace Exiv2 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( index > 0 ) {
|
if ( index > 0 ) {
|
||||||
|
const unsigned long lensID = 0x3ff;
|
||||||
const TagDetails* td = find(pentaxLensType, lensID);
|
const TagDetails* td = find(pentaxLensType, lensID);
|
||||||
os << exvGettext(td[index].label_);
|
os << exvGettext(td[index].label_);
|
||||||
return os;
|
return os;
|
||||||
@ -1306,7 +1306,6 @@ namespace Exiv2 {
|
|||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
unsigned long lensID = 0x8ff;
|
|
||||||
unsigned long index = 0;
|
unsigned long index = 0;
|
||||||
|
|
||||||
const ExifData::const_iterator lensInfo = metadata->findKey(ExifKey("Exif.PentaxDng.LensInfo")) != metadata->end()
|
const ExifData::const_iterator lensInfo = metadata->findKey(ExifKey("Exif.PentaxDng.LensInfo")) != metadata->end()
|
||||||
@ -1319,6 +1318,7 @@ namespace Exiv2 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( index > 0 ) {
|
if ( index > 0 ) {
|
||||||
|
const unsigned long lensID = 0x8ff;
|
||||||
const TagDetails* td = find(pentaxLensType, lensID);
|
const TagDetails* td = find(pentaxLensType, lensID);
|
||||||
os << exvGettext(td[index].label_);
|
os << exvGettext(td[index].label_);
|
||||||
return os;
|
return os;
|
||||||
@ -1334,7 +1334,6 @@ namespace Exiv2 {
|
|||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
unsigned long lensID = 0x319;
|
|
||||||
unsigned long index = 0;
|
unsigned long index = 0;
|
||||||
|
|
||||||
const ExifData::const_iterator lensInfo = metadata->findKey(ExifKey("Exif.PentaxDng.LensInfo")) != metadata->end()
|
const ExifData::const_iterator lensInfo = metadata->findKey(ExifKey("Exif.PentaxDng.LensInfo")) != metadata->end()
|
||||||
@ -1355,6 +1354,7 @@ namespace Exiv2 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( index > 0 ) {
|
if ( index > 0 ) {
|
||||||
|
const unsigned long lensID = 0x319;
|
||||||
const TagDetails* td = find(pentaxLensType, lensID);
|
const TagDetails* td = find(pentaxLensType, lensID);
|
||||||
os << exvGettext(td[index].label_);
|
os << exvGettext(td[index].label_);
|
||||||
return os;
|
return os;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user