summaryrefslogtreecommitdiff
path: root/libreofficekit
diff options
context:
space:
mode:
authorPranav Kant <pranavk@collabora.co.uk>2017-01-06 15:57:43 +0530
committerPranav Kant <pranavk@collabora.co.uk>2017-01-06 15:59:20 +0530
commit29f697711e06b88fb8387518e7f8440cf49f0933 (patch)
tree394123b47dd57ceb23254d147f2f74fd8437c8e8 /libreofficekit
parentc38aa3b734a0176eedb41d8c2c40f5ac293c11ba (diff)
gtktiledviewer: Lets avoid using manual buffer sizes
Change-Id: I76e70ccb5b1f40193a1eda1cbca19b3444168dae
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;