tag 345384 + patch
thanks

Having the same problem, I tracked it down. BTW getting a good
backtrace wasn't easy, what I ended up doing was grepping the source
for string replaces (which weren't that numerous) and setting
breakpoints.

The attached patch fixes this problem at least for me. The problem was
that std::string:npos is negative. Carefully reading compiler output
would also have caught this (warning about a comparison being always
false due to a limited data type). Maybe I'll take some time and read
the build log later today to see if there's more such warnings.

        Sami


--- widelands-build9half/src/text_parser.cc     2005-11-25 14:16:31.000000000 
+0200
+++ widelands-fixed/src/text_parser.cc  2006-01-07 10:38:35.000000000 +0200
@@ -39,7 +39,7 @@
       }
       text.erase(0,2);
       
-      uint format_end = text.find(">");
+      int format_end = text.find(">");
       if (format_end == std::string::npos) {
          log("WARNING: Formatdefinition of block '%s' not 
closed\n",(text.substr(0,30)+"...").c_str());
          return;
@@ -48,7 +48,7 @@
       std::string block_format = text.substr(0,format_end);
       text.erase(0,format_end+1);
             
-      uint block_end = text.find("</p>");
+      int block_end = text.find("</p>");
       if (block_end == std::string::npos) {
       
          log("WARNING: Block '%s' not 
closed!\n",(text.substr(0,30)+"...").c_str());
@@ -63,14 +63,14 @@
      
       // Replace <br> in text block through newlines. This is needed for 
       // Texts which may not contain newlines ( for example from conf files )
-      uint newline;
+      int newline;
       while( (newline = block_text.find("<br>")) != std::string::npos ) {
          block_text.replace( newline, 4, "\n" );
       }
       // Serch for map variables
-      uint offset;
+      int offset;
       while( (offset = block_text.find("<variable name=")) != 
std::string::npos) {
-         uint end = block_text.find(">");
+         int end = block_text.find(">");
          if( end == std::string::npos ) {
             log("WARNING: <variable> tag not closed!\n");
          } else {
@@ -106,13 +106,13 @@
       format.erase(0,1);
 
    while (format.size()) {
-      uint key_end = format.find("=");
+      int key_end = format.find("=");
       if (key_end == std::string::npos)
          return;
       else {
          std::string key = format.substr(0,key_end);
          format.erase(0,key_end+1);
-         uint val_end = format.find(" ");
+         int val_end = format.find(" ");
          if (val_end == std::string::npos)
             val_end = format.size();
          std::string val = format.substr(0,val_end);

Attachment: signature.asc
Description: Digital signature

Reply via email to