Skip to content

Download of Project does not work: basic_string::insert: __pos (which is 33) > this->size() (which is 20) #82

Description

@jbarth-ubhd

did add some debug statements:

diff --git a/rest/src/parser/PageXmlParserLine.cpp b/rest/src/parser/PageXmlParserLine.cpp
index 6bfe5171..ad9b3b86 100644
--- a/rest/src/parser/PageXmlParserLine.cpp
+++ b/rest/src/parser/PageXmlParserLine.cpp
@@ -122,7 +122,11 @@ bool PageXmlParserLine::first_line_in_region() const {
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void PageXmlParserLine::insert(size_t i, wchar_t c) { string_.insert(i, 1, c); }
+void PageXmlParserLine::insert(size_t i, wchar_t c) { 
+       std::wcerr << __FILE__ << "#" << __LINE__ << ": string=\"" << string_ << "\", pos=" << i << ", c=\"" << c << "\"" << std::endl;
+       assert(i <= string_.size());
+       string_.insert(i, 1, c);
+}
 
 ////////////////////////////////////////////////////////////////////////////////
 void PageXmlParserLine::erase(size_t i) { string_.erase(i); }

output:

rest/src/parser/PageXmlParserLine.cpp#126: string="e.", pos="0, c="E"
rest/src/parser/PageXmlParserLine.cpp#126: string="Ee.", pos="1, c="S"
rest/src/parser/PageXmlParserLine.cpp#126: string="ESe.", pos="2, c="S"
rest/src/parser/PageXmlParserLine.cpp#126: string="ESSe.", pos="3, c="E"
rest/src/parser/PageXmlParserLine.cpp#126: string="ESSEe.", pos="4, c=" "
rest/src/parser/PageXmlParserLine.cpp#126: string="ESSE e.", pos="5, c="Q"
rest/src/parser/PageXmlParserLine.cpp#126: string="ESSE Qe.", pos="6, c="U"
rest/src/parser/PageXmlParserLine.cpp#126: string="ESSE QUe.", pos="7, c="A"
rest/src/parser/PageXmlParserLine.cpp#126: string="ESSE QUAe.", pos="8, c="M"
rest/src/parser/PageXmlParserLine.cpp#126: string="ESSE QUAMe.", pos="9, c=" "
rest/src/parser/PageXmlParserLine.cpp#126: string="ESSE QUAM e.", pos="10, c="V"
rest/src/parser/PageXmlParserLine.cpp#126: string="ESSE QUAM Ve.", pos="11, c="I"
rest/src/parser/PageXmlParserLine.cpp#126: string="ESSE QUAM VIe.", pos="12, c="D"
rest/src/parser/PageXmlParserLine.cpp#126: string="ESSE QUAM VIDe.", pos="13, c="E"
rest/src/parser/PageXmlParserLine.cpp#126: string="e.", pos="0, c="B"
rest/src/parser/PageXmlParserLine.cpp#126: string="Be.", pos="1, c="U"
rest/src/parser/PageXmlParserLine.cpp#126: string="BUe.", pos="2, c="N"
rest/src/parser/PageXmlParserLine.cpp#126: string="BUNe.", pos="3, c="B"
rest/src/parser/PageXmlParserLine.cpp#126: string="BUNBe.", pos="4, c="U"
rest/src/parser/PageXmlParserLine.cpp#126: string="O", pos="0, c="H"
rest/src/parser/PageXmlParserLine.cpp#126: string="HO", pos="1, c="E"
rest/src/parser/PageXmlParserLine.cpp#126: string="HEO", pos="2, c="N"
rest/src/parser/PageXmlParserLine.cpp#126: string="HENO", pos="3, c="R"
rest/src/parser/PageXmlParserLine.cpp#126: string="HENRO", pos="4, c="Y"
rest/src/parser/PageXmlParserLine.cpp#126: string="HENRYO", pos="5, c=" "
rest/src/parser/PageXmlParserLine.cpp#126: string="HENRY O", pos="6, c="E"
rest/src/parser/PageXmlParserLine.cpp#126: string="HENRY EO", pos="7, c="D"
rest/src/parser/PageXmlParserLine.cpp#126: string="HENRY EDO", pos="8, c="W"
rest/src/parser/PageXmlParserLine.cpp#126: string="HENRY EDWO", pos="9, c="A"
rest/src/parser/PageXmlParserLine.cpp#126: string="HENRY EDWAO", pos="10, c="R"
rest/src/parser/PageXmlParserLine.cpp#126: string="REPRESENTEE", pos="0, c="E"
rest/src/parser/PageXmlParserLine.cpp#126: string="EREPRESENTEE", pos="1, c="T"
rest/src/parser/PageXmlParserLine.cpp#126: string="ETREPRESENTEE", pos="2, c=" "
rest/src/parser/PageXmlParserLine.cpp#126: string="EN FIGURES", pos="10, c="."
rest/src/parser/PageXmlParserLine.cpp#126: string="Le Culte des Grecs & des Romains", pos="32, c="."
rest/src/parser/PageXmlParserLine.cpp#126: string="FLORENTIN DELAULNE, ", pos="33, c=" "
Assertion failed: i <= string_.size() (rest/src/parser/PageXmlParserLine.cpp: insert: 127)

Excerpt of original XML:

        <pc:TextRegion id="region0009" orientation="0.5" type="caption" readingDirection="left-to-right" textLineOrder="top-to-bottom">
            <pc:Coords points="..."/>
            <pc:TextLine id="region0009_line0000">
                <pc:Coords points="..."/>
                <pc:TextEquiv conf="0.961043953895569">
                    <pc:Unicode>FLORENTIN DELAULNE, ( JEAN-GEOFFROYNYON,</pc:Unicode>
                </pc:TextEquiv>
            </pc:TextLine>
            <pc:TextLine id="region0009_line0001">
                <pc:Coords points="..."/>
                <pc:TextEquiv conf="0.993850290775299">
                    <pc:Unicode>HILAIRE FOUCAULT,ETIENNE GANEAU,</pc:Unicode>
                </pc:TextEquiv>
            </pc:TextLine>
            <pc:TextLine id="region0009_line0002">
                <pc:Coords points="..."/>
                <pc:TextEquiv conf="0.984751641750336">
                    <pc:Unicode>MICHEL CLOUSIER, NICOLAS GOSSELIN,</pc:Unicode>
                </pc:TextEquiv>
            </pc:TextLine>
            <pc:TextLine id="region0009_line0003">
                <pc:Coords points="..."/>
                <pc:TextEquiv conf="0.997291445732117">
                    <pc:Unicode>Et PIERRE-FRANCOIS GIFFART.</pc:Unicode>
                </pc:TextEquiv>
            </pc:TextLine>
            <pc:TextEquiv>
                <pc:Unicode>FLORENTIN DELAULNE, ( JEAN-GEOFFROYNYON,
HILAIRE FOUCAULT,ETIENNE GANEAU,
MICHEL CLOUSIER, NICOLAS GOSSELIN,
Et PIERRE-FRANCOIS GIFFART.</pc:Unicode>
            </pc:TextEquiv>

Screenshot of edited text:
grafik

Book: https://digi.ub.uni-heidelberg.de/diglit/montfaucon1719bd2_1/0007/image,info

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions