Bläddra i källkod

Fixed catch warnings in FilterChain

master
Pete McNeil 4 år sedan
förälder
incheckning
8d838bfd26
1 ändrade filer med 38 tillägg och 38 borttagningar
  1. 38
    38
      FilterChain.cpp

+ 38
- 38
FilterChain.cpp Visa fil

@@ -40,14 +40,14 @@ unsigned char FilterChainBase64::GetByte() {

while(true) { // Search for our startup string or get out.

try { // Try this...
try { // Try this...
ValidBuffer = false; // No valid buffer yet.
x=FilterChain::GetByte(); // Get the next byte from source.
} // If we get the empty signal
// here, we've failed to match.
catch(Empty) { // If so - and we haven't
if(0==ScanIx) throw Empty("FilterChainBase64: No more data"); // started then just throw Empty.
State=DEQUEING;DequeIx=0; // If we have then we'll dequeue
catch(const Empty&) { // If so - and we haven't
if(0==ScanIx) throw Empty("FilterChainBase64: No more data"); // started then just throw Empty.
State=DEQUEING;DequeIx=0; // If we have then we'll dequeue
return GetByte(); // it and throw when that's done
} // because Buffer is not valid.

@@ -167,13 +167,13 @@ unsigned char FilterChainBase64::GetByte() {

} else { // When we're done with that part,
State=SCANNING; // we set our mode back to scanning,
ScanIx=DequeIx=0; // reset our indexes to start again,
// Here we either have a buffered byte to dequeue, or we ran out
// of data while attempting to match our startup sequence. If we
// have a vaild byte we return it. If not, we throw No More Data!
if(ValidBuffer) return Buffer;
ScanIx=DequeIx=0; // reset our indexes to start again,
// Here we either have a buffered byte to dequeue, or we ran out
// of data while attempting to match our startup sequence. If we
// have a vaild byte we return it. If not, we throw No More Data!
if(ValidBuffer) return Buffer;
else throw Empty("FilterChainBase64: No more data");
}

@@ -451,19 +451,19 @@ unsigned char FilterChainQuotedPrintable::GetByte() {
/////////////////////////////////////////////////////////////////////////////////////////
// FilterChainDefunker
/////////////////////////////////////////////////////////////////////////////////////////
const char* DefunkerPreamble = " ----[DEFUNKER]---- ";
// Patterns to match
const char* patMatchBR = "<br>";
const char* patMatchP = "<p>";
const char* patNBSP = "&nbsp;";
const char* patAMP = "&amp;";
const char* patAPOS = "&apos;";
const char* patLT = "&lt;";
const char* patGT = "&gt;";
const char* patQUOT = "&quot;";
const char* DefunkerPreamble = " ----[DEFUNKER]---- ";
// Patterns to match
const char* patMatchBR = "<br>";
const char* patMatchP = "<p>";
const char* patNBSP = "&nbsp;";
const char* patAMP = "&amp;";
const char* patAPOS = "&apos;";
const char* patLT = "&lt;";
const char* patGT = "&gt;";
const char* patQUOT = "&quot;";

// SkipHeaders() waits for the headers to go by before launching Store().

@@ -490,7 +490,7 @@ unsigned char FilterChainDefunker::Store() { // While in Store mod
StoreBuffer[InputPosition++] = x; // and storing it.
}

catch(Empty) { // When we get the Empty
catch(const Empty&) { // When we get the Empty
Master = &FilterChainDefunker::ReadOut; // signal it is time for us
return GetByte(); // to read out our data.
}
@@ -533,27 +533,27 @@ unsigned char FilterChainDefunker::Preamble() { // Emit the preamble.
return GetInternal(); // and return the next byte.
}

unsigned char FilterChainDefunker::DefunkRoot() { // While in DefunkRoot state...
unsigned char x = 0; // One byte at a time via x.
do { // Loop through any emptiness.
ReturnNothing = false; // Be ready to return a byte.
x = GetStore(); // Grab the next byte to process.
unsigned char FilterChainDefunker::DefunkRoot() { // While in DefunkRoot state...
unsigned char x = 0; // One byte at a time via x.
do { // Loop through any emptiness.
ReturnNothing = false; // Be ready to return a byte.
x = GetStore(); // Grab the next byte to process.

if(x == '<') { // If it matches < then
Internal = &FilterChainDefunker::OpenTag; // go to OpenTag state and
x = GetInternal(); // return the converted byte.
} else
if(x == '&') { // If it matches & then
Internal = &FilterChainDefunker::OpenAmp; // go to OpenAnd state and
EnQueue(x); // push in the amphersand.
x = GetInternal(); // return the converted byte.
}
// If x is none of the above then x is just x.
} while (true == ReturnNothing); // Returning nothing? Go again!
}
// If x is none of the above then x is just x.
} while (true == ReturnNothing); // Returning nothing? Go again!
return x; // otherwise return a funkless x.
}

@@ -777,7 +777,7 @@ unsigned char FilterChainDefunker::MatchAMP() { // If our mode is Mat
unsigned char FilterChainDefunker::EatTag() { // If our mode is EatTag
if(LastGetStore != '>') { // and our last byte was not
while(GetStore()!='>')continue; // endtag then eat through
} // the end tag. Then set our
} // the end tag. Then set our
ReturnNothing = true; // ReturnNothing flag, set our
Internal = &FilterChainDefunker::DefunkRoot; // mode to DefunkRoot and
return 0; // return 0 (nothing, really).

Laddar…
Avbryt
Spara