summaryrefslogtreecommitdiff
path: root/libreofficekit
diff options
context:
space:
mode:
authorPranav Kant <pranavk@collabora.co.uk>2017-01-06 15:57:43 +0530
committerAndras Timar <andras.timar@collabora.com>2017-02-17 16:47:52 +0100
commitadf4c77b974c060fb287256bbc6d9e7047faa3be (patch)
tree626bc81be8d4a0893b4dd4180fb2f7d1e180150a /libreofficekit
parenta0763acce4ed93a8cc79e3b0a9853142f2381dfe (diff)
gtktiledviewer: Lets avoid using manual buffer sizes
Change-Id: I76e70ccb5b1f40193a1eda1cbca19b3444168dae (cherry picked from commit 29f697711e06b88fb8387518e7f8440cf49f0933)
Diffstat (limited to 'libreofficekit')
-rw-r--r--libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx22
1 files changed, 8 insertions, 14 deletions
diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 33829879b7c7..3c774c1a7fce 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -375,23 +375,17 @@ gboolean TiledRowColumnBar::docConfigureEvent(GtkWidget* pDocView, GdkEventConfi
gtk_widget_show(rWindow.m_pFormulabarEntry);
// Change horizontal alignment uno commands for spreadsheet
- const char* unoHorAlignArgs =
+ const std::string argsPrefix =
"{"
"\"HorizontalAlignment\":{"
"\"type\":\"unsigned short\", "
- "\"value\":\"%d\""
- "}"
- "}";
-
- char unoHorAlignArgsFormatted[strlen(unoHorAlignArgs)];
- snprintf(unoHorAlignArgsFormatted, sizeof(unoHorAlignArgsFormatted), unoHorAlignArgs, 1);
- lcl_registerToolItem(rWindow, rWindow.m_pLeftpara, ".uno:HorizontalAlignment", std::string(unoHorAlignArgsFormatted));
- snprintf(unoHorAlignArgsFormatted, sizeof(unoHorAlignArgsFormatted), unoHorAlignArgs, 2);
- lcl_registerToolItem(rWindow, rWindow.m_pCenterpara, ".uno:HorizontalAlignment", std::string(unoHorAlignArgsFormatted));
- snprintf(unoHorAlignArgsFormatted, sizeof(unoHorAlignArgsFormatted), unoHorAlignArgs, 3);
- lcl_registerToolItem(rWindow, rWindow.m_pRightpara, ".uno:HorizontalAlignment", std::string(unoHorAlignArgsFormatted));
- snprintf(unoHorAlignArgsFormatted, sizeof(unoHorAlignArgsFormatted), unoHorAlignArgs, 4);
- lcl_registerToolItem(rWindow, rWindow.m_pJustifypara, ".uno:HorizontalAlignment", std::string(unoHorAlignArgsFormatted));
+ "\"value\":\"";
+ const std::string argsSuffix = "\"}}";
+
+ lcl_registerToolItem(rWindow, rWindow.m_pLeftpara, ".uno:HorizontalAlignment", argsPrefix + std::to_string(1) + argsSuffix);
+ lcl_registerToolItem(rWindow, rWindow.m_pCenterpara, ".uno:HorizontalAlignment", argsPrefix + std::to_string(2) + argsSuffix);
+ lcl_registerToolItem(rWindow, rWindow.m_pRightpara, ".uno:HorizontalAlignment", argsPrefix + std::to_string(3) + argsSuffix);
+ lcl_registerToolItem(rWindow, rWindow.m_pJustifypara, ".uno:HorizontalAlignment", argsPrefix + std::to_string(4) + argsSuffix);
}
return TRUE;