Page 1 of 1

Not all string references are fully qualified

Posted: 2015-03-19T12:38:29-07:00
by hwright
Most string references in Magick++ are fully qualified (e.g., they use 'std::string' rather than 'string'). A few cases are missing, though, which causes build problems in environments which define their own string in the global namespace.

The attached patch fully qualifies string references which weren't previously.

Code: Select all

Index: Magick++/lib/CoderInfo.cpp
===================================================================
--- Magick++/lib/CoderInfo.cpp	(revision 18240)
+++ Magick++/lib/CoderInfo.cpp	(working copy)
@@ -55,9 +55,9 @@
     }
   else
     {
-      _name=string(magickInfo->name);
-      _description=string(magickInfo->description);
-      _mimeType=string(magickInfo->mime_type ? magickInfo->mime_type : "");
+      _name=std::string(magickInfo->name);
+      _description=std::string(magickInfo->description);
+      _mimeType=std::string(magickInfo->mime_type ? magickInfo->mime_type : "");
       _isReadable=((magickInfo->decoder == 0) ? false : true);
       _isWritable=((magickInfo->encoder == 0) ? false : true);
       _isMultiFrame=((magickInfo->adjoin == 0) ? false : true);
@@ -119,9 +119,9 @@
 }
 
 Magick::CoderInfo::CoderInfo(const MagickCore::MagickInfo *magickInfo_)
-  : _name(string(magickInfo_->name ? magickInfo_->name : "")),
-    _description(string(magickInfo_->description ? magickInfo_->description : "")),
-    _mimeType(string(magickInfo_->mime_type ? magickInfo_->mime_type : "")),
+  : _name(std::string(magickInfo_->name ? magickInfo_->name : "")),
+    _description(std::string(magickInfo_->description ? magickInfo_->description : "")),
+    _mimeType(std::string(magickInfo_->mime_type ? magickInfo_->mime_type : "")),
     _isReadable(magickInfo_->decoder ? true : false),
     _isWritable(magickInfo_->encoder ? true : false),
     _isMultiFrame(magickInfo_->adjoin ? true : false)
Index: Magick++/lib/Geometry.cpp
===================================================================
--- Magick++/lib/Geometry.cpp	(revision 18240)
+++ Magick++/lib/Geometry.cpp	(working copy)
@@ -288,7 +288,7 @@
   char
     buffer[MaxTextExtent];
 
-  string
+  std::string
     geometry;
 
   if (!isValid())
Index: Magick++/lib/Image.cpp
===================================================================
--- Magick++/lib/Image.cpp	(revision 18240)
+++ Magick++/lib/Image.cpp	(working copy)
@@ -1865,8 +1865,8 @@
         }
       else
         {
-          (void) CopyMagickString(boundingArea,string(boundingArea_).c_str(),
-            MaxTextExtent);
+          (void) CopyMagickString(boundingArea,
+            std::string(boundingArea_).c_str(), MaxTextExtent);
         }
       drawInfo->geometry=boundingArea;
     }

Re: Not all string references are fully qualified

Posted: 2015-03-19T14:54:59-07:00
by magick
We can reproduce the problem you posted and have a patch in ImageMagick 6.9.1-0 Beta, available by sometime tomorrow. Thanks.