[Libreoffice-commits] .: 2 commits - scripting/source svtools/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Jan 15 08:32:43 PST 2013


 scripting/source/pyprov/mailmerge.py |   32 ++++++++++++++++----------------
 svtools/source/misc/sampletext.cxx   |   15 ++++++++++++---
 2 files changed, 28 insertions(+), 19 deletions(-)

New commits:
commit 5cd7c8906150b94c224ab9bc9f850684198c7f04
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jan 15 16:29:47 2013 +0000

    Resolves: fdo#37449 apparent access into empty codepage bitset
    
    Change-Id: I2efc3ea10cd4313eaa1894fdfbffd113a125e2ba

diff --git a/svtools/source/misc/sampletext.cxx b/svtools/source/misc/sampletext.cxx
index 8bc9bb5..42be4ca 100644
--- a/svtools/source/misc/sampletext.cxx
+++ b/svtools/source/misc/sampletext.cxx
@@ -634,6 +634,11 @@ namespace
 #if OSL_DEBUG_LEVEL > 2
     void lcl_dump_unicode_coverage(const boost::dynamic_bitset<sal_uInt32> &rIn)
     {
+        if (rIn.none())
+        {
+            fprintf(stderr, "<NONE>\n");
+            return;
+        }
         if (rIn[vcl::UnicodeCoverage::BASIC_LATIN])
             fprintf(stderr, "BASIC_LATIN\n");
         if (rIn[vcl::UnicodeCoverage::LATIN_1_SUPPLEMENT])
@@ -894,6 +899,11 @@ namespace
 
     void lcl_dump_codepage_coverage(const boost::dynamic_bitset<sal_uInt32> &rIn)
     {
+        if (rIn.none())
+        {
+            fprintf(stderr, "<NONE>\n");
+            return;
+        }
         if (rIn[vcl::CodePageCoverage::CP1252])
             fprintf(stderr, "CP1252\n");
         if (rIn[vcl::CodePageCoverage::CP1250])
@@ -1065,7 +1075,7 @@ namespace
         aMasked.set(vcl::UnicodeCoverage::PHAGS_PA, false);
 
         //So, possibly a CJK font
-        if (!aMasked.count())
+        if (!aMasked.count() && !rFontCapabilities.maCodePageRange.empty())
         {
             boost::dynamic_bitset<sal_uInt32> aCJKCodePageMask(vcl::CodePageCoverage::MAX_CP_ENUM);
             aCJKCodePageMask.set(vcl::CodePageCoverage::CP932);
@@ -1517,8 +1527,7 @@ rtl::OUString makeRepresentativeTextForFont(sal_Int16 nScriptType, const Font &r
             if (nScriptType != com::sun::star::i18n::ScriptType::ASIAN)
             {
                 aFontCapabilities.maUnicodeRange &= getCJKMask();
-                aFontCapabilities.maCodePageRange =
-                    boost::dynamic_bitset<sal_uInt32>(aFontCapabilities.maCodePageRange.size());
+                aFontCapabilities.maCodePageRange.clear();
             }
             if (nScriptType != com::sun::star::i18n::ScriptType::LATIN)
                 aFontCapabilities.maUnicodeRange &= getLatinMask();
commit 932e916a9c47071eec9eaf43eff9718f4be2d9bf
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jan 15 15:29:42 2013 +0000

    tidy mailmerge debuging messages
    
    Change-Id: Ibca2af0efa448ed4c2c5b7ad73febf16cbf03480

diff --git a/scripting/source/pyprov/mailmerge.py b/scripting/source/pyprov/mailmerge.py
index 448a030..482387f 100755
--- a/scripting/source/pyprov/mailmerge.py
+++ b/scripting/source/pyprov/mailmerge.py
@@ -118,7 +118,7 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
 				user = user.encode('ascii')
 				password = password.encode('ascii')
 			if dbg:
-				print("Logging in, username of", user, file=dbgout)
+				print("Logging in, username of: " + user, file=dbgout)
 			self.server.login(user, password)
 
 		for listener in self.listeners:
@@ -151,10 +151,10 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
 		ccrecipients = xMailMessage.getCcRecipients()
 		bccrecipients = xMailMessage.getBccRecipients()
 		if dbg:
-			print("PyMailSMTPService subject " + subject, file=dbgout)
-			print("PyMailSMTPService from " + sendername, file=dbgout)
-			print("PyMailSMTPService from " + sendermail, file=dbgout)
-			print("PyMailSMTPService send to %s" % (recipients,), file=dbgout)
+			print("PyMailSMTPService subject: " + subject, file=dbgout)
+			print("PyMailSMTPService from:  " + sendername, file=dbgout)
+			print("PyMailSMTPService from:  " + sendermail, file=dbgout)
+			print("PyMailSMTPService send to: %s" % (recipients,), file=dbgout)
 
 		attachments = xMailMessage.getAttachments()
 
@@ -163,13 +163,13 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
 		content = xMailMessage.Body
 		flavors = content.getTransferDataFlavors()
 		if dbg:
-			print("PyMailSMTPService flavors len %d" % (len(flavors),), file=dbgout)
+			print("PyMailSMTPService flavors len: %d" % (len(flavors),), file=dbgout)
 
 		#Use first flavor that's sane for an email body
 		for flavor in flavors:
 			if flavor.MimeType.find('text/html') != -1 or flavor.MimeType.find('text/plain') != -1:
 				if dbg:
-					print("PyMailSMTPService mimetype is " + flavor.MimeType, file=dbgout)
+					print("PyMailSMTPService mimetype is: " + flavor.MimeType, file=dbgout)
 				textbody = content.getTransferData(flavor)
 				#http://stackoverflow.com/questions/9403265/how-do-i-use-python-3-2-email-module-to-send-unicode-messages-encoded-in-utf-8-w
 				textbody = textbody.encode('utf-8').decode('iso8859-1')
@@ -251,7 +251,7 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
 		truerecipients = uniquer.keys()
 
 		if dbg:
-			print(("PyMailSMTPService recipients are ", truerecipients), file=dbgout)
+			print(("PyMailSMTPService recipients are: ", truerecipients), file=dbgout)
 
 		self.server.sendmail(sendermail, truerecipients, msg.as_string())
 
@@ -305,7 +305,7 @@ class PyMailIMAPService(unohelper.Base, XMailService):
 				user = user.encode('ascii')
 				password = password.encode('ascii')
 			if dbg:
-				print("Logging in, username of", user, file=dbgout)
+				print("Logging in, username of: " + user, file=dbgout)
 			self.server.login(user, password)
 
 		for listener in self.listeners:
@@ -383,7 +383,7 @@ class PyMailPOP3Service(unohelper.Base, XMailService):
 			user = user.encode('ascii')
 			password = password.encode('ascii')
 		if dbg:
-			print("Logging in, username of", user, file=dbgout)
+			print("Logging in, username of: " + user, file=dbgout)
 		self.server.user(user)
 		self.server.pass_(password)
 
@@ -444,27 +444,27 @@ class PyMailMessage(unohelper.Base, XMailMessage):
 			print("post PyMailMessage init", file=dbgout)
 	def addRecipient( self, recipient ):
 		if dbg:
-			print("PyMailMessage.addRecipient " + recipient, file=dbgout)
+			print("PyMailMessage.addRecipient: " + recipient, file=dbgout)
 		self.recipients.append(recipient)
 	def addCcRecipient( self, ccrecipient ):
 		if dbg:
-			print("PyMailMessage.addCcRecipient " + ccrecipient, file=dbgout)
+			print("PyMailMessage.addCcRecipient: " + ccrecipient, file=dbgout)
 		self.ccrecipients.append(ccrecipient)
 	def addBccRecipient( self, bccrecipient ):
 		if dbg:
-			print("PyMailMessage.addBccRecipient " + bccrecipient, file=dbgout)
+			print("PyMailMessage.addBccRecipient: " + bccrecipient, file=dbgout)
 		self.bccrecipients.append(bccrecipient)
 	def getRecipients( self ):
 		if dbg:
-			print("PyMailMessage.getRecipients " + self.recipients, file=dbgout)
+			print("PyMailMessage.getRecipients: " + self.recipients, file=dbgout)
 		return tuple(self.recipients)
 	def getCcRecipients( self ):
 		if dbg:
-			print("PyMailMessage.getCcRecipients " + self.ccrecipients, file=dbgout)
+			print("PyMailMessage.getCcRecipients: " + self.ccrecipients, file=dbgout)
 		return tuple(self.ccrecipients)
 	def getBccRecipients( self ):
 		if dbg:
-			print("PyMailMessage.getBccRecipients " + self.bccrecipients, file=dbgout)
+			print("PyMailMessage.getBccRecipients: " + self.bccrecipients, file=dbgout)
 		return tuple(self.bccrecipients)
 	def addAttachment( self, aMailAttachment ):
 		if dbg:


More information about the Libreoffice-commits mailing list